@orangecharts/wrun-chart-host 0.11.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/constants/feature-flags.constants.d.ts +3 -4
- package/dist/constants/feature-flags.constants.js +34 -52
- package/dist/constants/feature-limits.constants.d.ts +1 -1
- package/dist/constants/feature-limits.constants.js +5 -4
- package/dist/constants/interval.constants.d.ts +7 -0
- package/dist/constants/interval.constants.js +7 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +20 -149
- package/dist/constants/scriptEditor/cme-official-scripts.constants.js +20 -309
- package/dist/constants/stocks-compliance.constants.d.ts +15 -0
- package/dist/constants/stocks-compliance.constants.js +15 -0
- package/dist/host-env.d.ts +55 -3
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +36 -3
- package/dist/index.d.ts +18 -0
- package/dist/index.js +19 -0
- package/dist/indicators/controls/tpo-session.util.d.ts +78 -15
- package/dist/indicators/controls/tpo-session.util.js +320 -242
- package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +6 -0
- package/dist/instances/script-engine-worker-ohlcv-transfer.js +16 -0
- package/dist/interfaces/cme-realtime.interface.d.ts +8 -0
- package/dist/interfaces/cme-realtime.interface.js +2 -1
- package/dist/interfaces/feed.interface.d.ts +15 -1
- package/dist/interfaces/replay.interface.d.ts +5 -0
- package/dist/interfaces/stocks-realtime.interface.d.ts +4 -3
- package/dist/interfaces/stocks-realtime.interface.js +5 -4
- package/dist/interfaces/wrun-runtime.interface.d.ts +97 -19
- package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +17 -0
- package/dist/kscript-data/controls/live-ohlcv-merge.util.js +22 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +46 -40
- package/dist/kscript-data/controls/live-trades-merge.util.js +80 -107
- package/dist/market-data/billing.interface.d.ts +9 -1
- package/dist/market-data/venue.d.ts +1 -1
- package/dist/market-data/venues/index.d.ts +4 -4
- package/dist/market-data/venues/stocks.contract.copy.json +4 -4
- package/dist/market-data/venues/stocks.d.ts +4 -4
- package/dist/market-data/venues/stocks.js +15 -13
- package/dist/settings-templates/frvp-fields.d.ts +12 -1
- package/dist/settings-templates/frvp-fields.js +15 -4
- package/dist/settings-templates/index.js +12 -5
- package/dist/settings-templates/indicator-fields.js +28 -2
- package/dist/settings-templates/tool-rules.d.ts +17 -8
- package/dist/settings-templates/tool-rules.js +15 -8
- package/dist/settings-templates/tool-tables.generated.js +4 -2
- package/dist/utility/auth/server-clock.util.d.ts +3 -1
- package/dist/utility/auth/server-clock.util.js +3 -1
- package/dist/utility/chart/book-live-bucket.util.js +2 -2
- package/dist/utility/chart/cache-alignment.util.d.ts +15 -7
- package/dist/utility/chart/cache-alignment.util.js +14 -7
- package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +2 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.js +16 -0
- package/dist/utility/chart/cme-session-bucket.util.d.ts +18 -75
- package/dist/utility/chart/cme-session-bucket.util.js +25 -332
- package/dist/utility/chart/continuous-contracts.util.js +6 -5
- package/dist/utility/chart/display-offset.leaf.d.ts +24 -0
- package/dist/utility/chart/display-offset.leaf.js +41 -0
- package/dist/utility/chart/effective-chart-session.util.d.ts +2 -1
- package/dist/utility/chart/effective-chart-session.util.js +13 -5
- package/dist/utility/chart/feed-interval.util.d.ts +6 -20
- package/dist/utility/chart/feed-interval.util.js +13 -22
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +27 -7
- package/dist/utility/chart/fetch-dedupe-policy.util.js +86 -11
- package/dist/utility/chart/host-bar-placement.util.d.ts +7 -4
- package/dist/utility/chart/host-bar-placement.util.js +8 -2
- package/dist/utility/chart/indicator-inflight-registry.util.d.ts +32 -0
- package/dist/utility/chart/indicator-inflight-registry.util.js +52 -0
- package/dist/utility/chart/indicator-run-interval.util.d.ts +10 -4
- package/dist/utility/chart/indicator-run-interval.util.js +21 -12
- package/dist/utility/chart/interval-registry.util.d.ts +1 -1
- package/dist/utility/chart/interval-registry.util.js +1 -1
- package/dist/utility/chart/kscript-legend-entries.util.d.ts +12 -0
- package/dist/utility/chart/kscript-legend-entries.util.js +16 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +1 -1
- package/dist/utility/chart/kscript-run-interval-projection.util.js +4 -2
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -62
- package/dist/utility/chart/kscript-venue-policy.util.js +85 -94
- package/dist/utility/chart/live-bucket.util.d.ts +39 -17
- package/dist/utility/chart/live-bucket.util.js +103 -57
- package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +58 -20
- package/dist/utility/chart/local-kscript-source-revalidation.util.js +98 -23
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +35 -11
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +24 -3
- package/dist/utility/chart/market-session-schedule.util.d.ts +8 -0
- package/dist/utility/chart/market-session-schedule.util.js +39 -1
- package/dist/utility/chart/market-session.util.d.ts +136 -0
- package/dist/utility/chart/market-session.util.js +341 -0
- package/dist/utility/chart/market-sessions.util.d.ts +83 -0
- package/dist/utility/chart/market-sessions.util.js +220 -0
- package/dist/utility/chart/om-panel.util.d.ts +5 -3
- package/dist/utility/chart/om-panel.util.js +42 -7
- package/dist/utility/chart/om-target.util.d.ts +14 -1
- package/dist/utility/chart/om-target.util.js +22 -5
- package/dist/utility/chart/opra-read-access.leaf.d.ts +16 -1
- package/dist/utility/chart/opra-read-access.leaf.js +22 -0
- package/dist/utility/chart/profile-row-height.util.d.ts +49 -16
- package/dist/utility/chart/profile-row-height.util.js +74 -37
- package/dist/utility/chart/rth-session.util.d.ts +55 -20
- package/dist/utility/chart/rth-session.util.js +94 -46
- package/dist/utility/chart/session-interval.util.d.ts +2 -1
- package/dist/utility/chart/session-interval.util.js +1 -3
- package/dist/utility/chart/session-lattice.util.d.ts +150 -0
- package/dist/utility/chart/session-lattice.util.js +488 -0
- package/dist/utility/chart/trading-day.util.d.ts +40 -2
- package/dist/utility/chart/trading-day.util.js +84 -7
- package/dist/utility/chart/us-equities-session.util.d.ts +32 -11
- package/dist/utility/chart/us-equities-session.util.js +44 -15
- package/dist/utility/chart/window-geometry.leaf.d.ts +28 -7
- package/dist/utility/chart/window-geometry.leaf.js +57 -8
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +21 -14
- package/dist/utility/chart/wrun-bar-session-facts.util.js +32 -38
- package/dist/utility/chart/wrun-run-result.util.d.ts +29 -12
- package/dist/utility/chart/wrun-run-result.util.js +89 -25
- package/dist/utility/common/time.util.js +5 -4
- package/dist/utility/market-events/earnings-scope.util.d.ts +10 -5
- package/dist/utility/market-events/earnings-scope.util.js +17 -9
- package/dist/utility/market-events/market-events.util.d.ts +14 -7
- package/dist/utility/market-events/market-events.util.js +30 -17
- package/dist/utility/number-format.util.d.ts +14 -21
- package/dist/utility/number-format.util.js +38 -24
- package/dist/utility/options/option-venue-disclosure.util.d.ts +40 -6
- package/dist/utility/options/option-venue-disclosure.util.js +71 -11
- package/dist/utility/options/option-venue.util.d.ts +1 -1
- package/dist/utility/options/option-venue.util.js +1 -1
- package/dist/utility/pool-symbol.leaf.d.ts +7 -0
- package/dist/utility/pool-symbol.leaf.js +50 -5
- package/dist/utility/stocks/stock-display.util.d.ts +15 -0
- package/dist/utility/stocks/stock-display.util.js +37 -0
- package/dist/utility/symbol-selection/contract-expiry.util.js +5 -4
- package/dist/utility/v2/gate-plane.util.d.ts +6 -0
- package/dist/utility/v2/gate-plane.util.js +11 -1
- package/dist/utility/v2/gate-session-latch.util.d.ts +1 -1
- package/dist/utility/v2/gate-session-latch.util.js +3 -3
- package/dist/utility/v2/governed-tier.leaf.d.ts +17 -16
- package/dist/utility/v2/governed-tier.leaf.js +17 -16
- package/dist/utility/v2/stocks-governed.util.d.ts +5 -0
- package/dist/utility/v2/stocks-governed.util.js +14 -0
- package/dist/utility/v2/v2-enums.leaf.d.ts +13 -0
- package/dist/utility/v2/v2-enums.leaf.js +458 -0
- package/dist/utility/wrun/derived-roots.leaf.d.ts +21 -1
- package/dist/utility/wrun/derived-roots.leaf.js +27 -1
- package/dist/utility/wrun/derived-roots.util.d.ts +44 -32
- package/dist/utility/wrun/derived-roots.util.js +97 -56
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -3
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -3
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +2 -1
- package/dist/utility/wrun/sources/lanes/option_daily.js +2 -1
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +3 -0
- package/dist/utility/wrun/sources/lanes/options_flow.js +23 -5
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -4
- package/dist/utility/wrun/sources/row-lane-registry.js +9 -4
- package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +19 -0
- package/dist/utility/wrun/sources/row-lanes/dark_pool.js +104 -0
- package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
- package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.d.ts +20 -0
- package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.js +103 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -2
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +15 -13
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +49 -23
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +14 -9
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +75 -27
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +139 -82
- package/dist/utility/wrun/wrun-app-layer.leaf.d.ts +78 -0
- package/dist/utility/wrun/wrun-app-layer.leaf.js +89 -0
- package/dist/utility/wrun/wrun-bar-count.util.d.ts +11 -7
- package/dist/utility/wrun/wrun-bar-count.util.js +12 -8
- package/dist/utility/wrun/wrun-batched-kinds.leaf.d.ts +13 -0
- package/dist/utility/wrun/wrun-batched-kinds.leaf.js +18 -0
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +41 -22
- package/dist/utility/wrun/wrun-batched-marks.util.js +255 -59
- package/dist/utility/wrun/wrun-batched-readout.util.d.ts +26 -19
- package/dist/utility/wrun/wrun-batched-readout.util.js +81 -27
- package/dist/utility/wrun/wrun-book-bands.leaf.d.ts +8 -0
- package/dist/utility/wrun/wrun-book-bands.leaf.js +7 -0
- package/dist/utility/wrun/wrun-candle-equal.leaf.d.ts +19 -0
- package/dist/utility/wrun/wrun-candle-equal.leaf.js +40 -0
- package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-canvases.util.js +7 -3
- package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +6 -3
- package/dist/utility/wrun/wrun-chart-context-names.util.js +8 -4
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +47 -29
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +201 -201
- package/dist/utility/wrun/wrun-child-overlay-id.util.js +2 -1
- package/dist/utility/wrun/wrun-cme-legs-note.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-cme-legs-note.util.js +49 -0
- package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +38 -0
- package/dist/utility/wrun/wrun-cme-root-specs.util.js +81 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +3 -0
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-color-settings.util.js +32 -7
- package/dist/utility/wrun/wrun-dark-pool.util.d.ts +50 -0
- package/dist/utility/wrun/wrun-dark-pool.util.js +127 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +67 -12
- package/dist/utility/wrun/wrun-declared-warmup.util.js +165 -13
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +18 -8
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +57 -11
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +14 -10
- package/dist/utility/wrun/wrun-draft-overlay.util.js +26 -14
- package/dist/utility/wrun/wrun-earnings-facts.util.js +3 -2
- package/dist/utility/wrun/wrun-etf-funds.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-etf-funds.util.js +4 -0
- package/dist/utility/wrun/wrun-held-lanes.util.js +8 -2
- package/dist/utility/wrun/wrun-history-as-of.util.d.ts +77 -0
- package/dist/utility/wrun/wrun-history-as-of.util.js +108 -0
- package/dist/utility/wrun/wrun-host.service.d.ts +64 -14
- package/dist/utility/wrun/wrun-host.service.js +137 -27
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +3 -3
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +12 -2
- package/dist/utility/wrun/wrun-inert-legend.util.d.ts +13 -0
- package/dist/utility/wrun/wrun-inert-legend.util.js +31 -3
- package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +7 -5
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +16 -6
- package/dist/utility/wrun/wrun-install-pacer.util.d.ts +26 -0
- package/dist/utility/wrun/wrun-install-pacer.util.js +145 -0
- package/dist/utility/wrun/wrun-kit-refusal-stages.types.d.ts +22 -0
- package/dist/utility/wrun/wrun-kit-refusal-stages.types.js +1 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +12 -5
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +23 -5
- package/dist/utility/wrun/wrun-lane-warmup.util.js +22 -4
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +6 -5
- package/dist/utility/wrun/wrun-leg-close.util.js +11 -9
- package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +3 -1
- package/dist/utility/wrun/wrun-leg-fetch.util.js +9 -2
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-levels-child.util.js +6 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +15 -6
- package/dist/utility/wrun/wrun-live-intake.util.js +167 -47
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +52 -8
- package/dist/utility/wrun/wrun-live-tick.util.js +648 -97
- package/dist/utility/wrun/wrun-market-facts.util.d.ts +16 -2
- package/dist/utility/wrun/wrun-market-facts.util.js +32 -3
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +27 -27
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +28 -16
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +34 -5
- package/dist/utility/wrun/wrun-oi-lane.util.d.ts +10 -7
- package/dist/utility/wrun/wrun-oi-lane.util.js +16 -10
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +1 -1
- package/dist/utility/wrun/wrun-option-views.util.d.ts +2 -2
- package/dist/utility/wrun/wrun-option-views.util.js +5 -2
- package/dist/utility/wrun/wrun-options-flow-underlying.leaf.d.ts +5 -0
- package/dist/utility/wrun/wrun-options-flow-underlying.leaf.js +16 -0
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-options-stop.util.js +6 -4
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +75 -11
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +176 -43
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +20 -10
- package/dist/utility/wrun/wrun-overlay-park.util.d.ts +84 -0
- package/dist/utility/wrun/wrun-overlay-park.util.js +135 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +37 -4
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +26 -14
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +239 -24
- package/dist/utility/wrun/wrun-overlay-run.util.js +2204 -405
- package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-panel-mount.util.js +20 -14
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-panel-style.util.js +3 -2
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +18 -4
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +26 -17
- package/dist/utility/wrun/wrun-pin-venues.util.js +43 -36
- package/dist/utility/wrun/wrun-pinned-lanes.util.d.ts +58 -0
- package/dist/utility/wrun/wrun-pinned-lanes.util.js +72 -0
- package/dist/utility/wrun/wrun-prefix-cohort.util.js +2 -1
- package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +22 -9
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +145 -26
- package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +29 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.js +23 -5
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +9 -1
- package/dist/utility/wrun/wrun-refusal-surface.util.js +15 -1
- package/dist/utility/wrun/wrun-refusal.util.d.ts +19 -1
- package/dist/utility/wrun/wrun-refusal.util.js +103 -16
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +20 -6
- package/dist/utility/wrun/wrun-registry-errors.util.js +20 -6
- package/dist/utility/wrun/wrun-replay-rows.util.js +6 -10
- package/dist/utility/wrun/wrun-run-health.util.d.ts +89 -2
- package/dist/utility/wrun/wrun-run-health.util.js +204 -1
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +2 -2
- package/dist/utility/wrun/wrun-run-interval-session.util.js +2 -2
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +9 -8
- package/dist/utility/wrun/wrun-run-interval.util.js +13 -11
- package/dist/utility/wrun/wrun-sandbox-row-source.js +5 -2
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +13 -3
- package/dist/utility/wrun/wrun-script-inputs.util.js +51 -13
- package/dist/utility/wrun/wrun-session-composition.util.d.ts +81 -0
- package/dist/utility/wrun/wrun-session-composition.util.js +169 -0
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +10 -7
- package/dist/utility/wrun/wrun-setting-words.util.js +25 -7
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +94 -28
- package/dist/utility/wrun/wrun-source-rows.util.js +738 -93
- package/dist/utility/wrun/wrun-stream-clock.util.d.ts +45 -0
- package/dist/utility/wrun/wrun-stream-clock.util.js +108 -0
- package/dist/utility/wrun/wrun-tape-coins.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-tape-coins.util.js +110 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +62 -32
- package/dist/utility/wrun/wrun-tape-source.util.js +72 -34
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +13 -5
- package/dist/utility/wrun/wrun-tier-grid.util.js +23 -13
- package/dist/utility/wrun/wrun-tpo-rows.util.js +2 -1
- package/dist/utility/wrun/wrun-trades-lane.util.d.ts +73 -0
- package/dist/utility/wrun/wrun-trades-lane.util.js +82 -0
- package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +5 -0
- package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +9 -2
- package/dist/utility/wrun/wrun-visibility-table.d.ts +13 -0
- package/dist/utility/wrun/wrun-visibility-table.js +9 -0
- package/dist/utility/wrun/wrun-volume-profile.util.js +44 -32
- package/dist/utils/replay/replay-buffer-math.d.ts +16 -6
- package/dist/utils/replay/replay-buffer-math.js +60 -30
- package/dist/workers/constants/socket-slots.d.ts +11 -7
- package/dist/workers/constants/socket-slots.js +6 -5
- package/package.json +11 -11
|
@@ -5,32 +5,81 @@
|
|
|
5
5
|
* stale-but-fast; the caching contract (perf/caching.md: stale paints, fresh
|
|
6
6
|
* replaces) then owes one live re-fetch. The boot second pass cannot be that
|
|
7
7
|
* re-fetch: on a warm boot it is skipped entirely, and on any pass the cache
|
|
8
|
-
* would simply hit again. So: the acquisition MARKS the overlay pending here
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
8
|
+
* would simply hit again. So: the acquisition MARKS the overlay pending here,
|
|
9
|
+
* with the window and the LANE the replay cache served (its replay-series
|
|
10
|
+
* identity, `kScriptSourceReplayLaneKey`); after that generation's first run
|
|
11
|
+
* integrates (the overlay actually painted), the owner (the wrun lifecycle
|
|
12
|
+
* door) runs a one-shot per-(chart, overlay) refresh over the recorded range
|
|
13
|
+
* with a generation-owned BYPASS TOKEN installed over the marked lanes. Only
|
|
14
|
+
* those lanes reach the wire: every other lane of the refresh takes its normal
|
|
15
|
+
* ladder (row cache, composition, resident split, replay cache read), so a lane
|
|
16
|
+
* the row cache holds fresh is never bought again. A token installed without
|
|
17
|
+
* lanes (the live tick's reconcile, the full-fetch debug oracle) covers every
|
|
18
|
+
* lane. Every source acquisition observes the standing tokens (and never
|
|
19
|
+
* consumes one); an owner releases only its own token, in `finally`. The
|
|
20
|
+
* tokens of one overlay stack: a lane bypasses while any standing token covers
|
|
21
|
+
* it, so a narrower token never narrows a wider one that stands. Teardown
|
|
22
|
+
* clears both maps.
|
|
15
23
|
*
|
|
16
|
-
* This module is pure state so titan-charts (acquisition side) and
|
|
17
|
-
*
|
|
24
|
+
* This module is pure state so titan-charts (acquisition side) and the
|
|
25
|
+
* lifecycle door (refresh side) can share it without an import cycle.
|
|
18
26
|
*/
|
|
19
27
|
const pendingByOverlay = new Map();
|
|
28
|
+
/** Per overlay, its standing tokens: each token's lane set, or null for a token over every lane. */
|
|
20
29
|
const bypassTokens = new Map();
|
|
21
30
|
function overlayKey(chartIndex, overlayId) {
|
|
22
31
|
return `${chartIndex}:${overlayId}`;
|
|
23
32
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
33
|
+
/** The request window as a source payload names it: never part of a lane's identity. */
|
|
34
|
+
const LANE_WINDOW_FIELDS = new Set(['from', 'period']);
|
|
35
|
+
/** Key-order-free JSON, an undefined field left out (the replay cache serialises its identity the same way). */
|
|
36
|
+
function stableStringify(value) {
|
|
37
|
+
if (value === null || typeof value !== 'object')
|
|
38
|
+
return JSON.stringify(value) ?? 'null';
|
|
39
|
+
if (Array.isArray(value))
|
|
40
|
+
return `[${value.map(stableStringify).join(',')}]`;
|
|
41
|
+
const record = value;
|
|
42
|
+
const fields = Object.keys(record)
|
|
43
|
+
.filter((field) => record[field] !== undefined)
|
|
44
|
+
.sort();
|
|
45
|
+
return `{${fields.map((field) => `${JSON.stringify(field)}:${stableStringify(record[field])}`).join(',')}}`;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A lane's replay-series identity: its replay cache key parts without the
|
|
49
|
+
* window, serialised key-order-free. A prefix page and a rerun of one lane ask
|
|
50
|
+
* the same parts over different windows (under different source names), so
|
|
51
|
+
* they share one key, and every replay-eligible type (K_VOLUME_PROFILE,
|
|
52
|
+
* K_BUY_SELL_VOLUME, K_ORDERBOOK) has one. Never the row cache's series key,
|
|
53
|
+
* which K_ORDERBOOK lacks. The parts are taken structurally: their type
|
|
54
|
+
* (`KScriptSourceReplayCacheKeyParts`) lives in the app, outside this package.
|
|
55
|
+
*/
|
|
56
|
+
export function kScriptSourceReplayLaneKey(parts) {
|
|
57
|
+
const identity = {};
|
|
58
|
+
for (const [field, value] of Object.entries(parts)) {
|
|
59
|
+
if (!LANE_WINDOW_FIELDS.has(field))
|
|
60
|
+
identity[field] = value;
|
|
61
|
+
}
|
|
62
|
+
return stableStringify(identity);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Called by the acquisition path on a non-polling replay-cache hit: the lane
|
|
66
|
+
* joins the overlay's pending lanes and the window joins its range. A mark
|
|
67
|
+
* with no lane key adds no lane (a record with no lanes revalidates every
|
|
68
|
+
* lane, never none).
|
|
69
|
+
*/
|
|
70
|
+
export function markLocalKScriptSourceCacheHit(chartIndex, overlayId, fromMs, toMs, laneKey) {
|
|
26
71
|
if (!Number.isFinite(fromMs) || !Number.isFinite(toMs) || toMs <= fromMs)
|
|
27
72
|
return;
|
|
28
73
|
const key = overlayKey(chartIndex, overlayId);
|
|
29
74
|
const existing = pendingByOverlay.get(key);
|
|
75
|
+
const lanes = new Set(existing?.lanes);
|
|
76
|
+
if (typeof laneKey === 'string' && laneKey.length > 0)
|
|
77
|
+
lanes.add(laneKey);
|
|
30
78
|
pendingByOverlay.set(key, {
|
|
31
79
|
fromMs: existing ? Math.min(existing.fromMs, fromMs) : fromMs,
|
|
32
80
|
toMs: existing ? Math.max(existing.toMs, toMs) : toMs,
|
|
33
81
|
markedAt: Date.now(),
|
|
82
|
+
lanes,
|
|
34
83
|
scheduled: existing?.scheduled === true,
|
|
35
84
|
});
|
|
36
85
|
}
|
|
@@ -51,7 +100,7 @@ export function disarmLocalKScriptSourceRevalidation(chartIndex, overlayId) {
|
|
|
51
100
|
if (pending)
|
|
52
101
|
pending.scheduled = false;
|
|
53
102
|
}
|
|
54
|
-
/** Consumes and returns the pending mark, if any (owner-side). */
|
|
103
|
+
/** Consumes and returns the pending mark, its lanes included, if any (owner-side). */
|
|
55
104
|
export function takePendingLocalKScriptSourceRevalidation(chartIndex, overlayId) {
|
|
56
105
|
const key = overlayKey(chartIndex, overlayId);
|
|
57
106
|
const pending = pendingByOverlay.get(key);
|
|
@@ -63,27 +112,35 @@ export function hasPendingLocalKScriptSourceRevalidation(chartIndex, overlayId)
|
|
|
63
112
|
return pendingByOverlay.has(overlayKey(chartIndex, overlayId));
|
|
64
113
|
}
|
|
65
114
|
/**
|
|
66
|
-
* Install a bypass token for one overlay's
|
|
67
|
-
*
|
|
68
|
-
*
|
|
115
|
+
* Install a bypass token for one overlay's refresh. With `lanes`, the token
|
|
116
|
+
* covers only those lanes (the revalidation of the lanes the replay cache
|
|
117
|
+
* served); without, every lane of the overlay (the live tick's reconcile, the
|
|
118
|
+
* full-fetch oracle). An empty set covers every lane too, so a stale caller
|
|
119
|
+
* never silently skips one. Returns the token; the owner must release with the
|
|
120
|
+
* SAME token, so one owner can never clear another's.
|
|
69
121
|
*/
|
|
70
|
-
export function installLocalKScriptSourceCacheBypass(chartIndex, overlayId) {
|
|
122
|
+
export function installLocalKScriptSourceCacheBypass(chartIndex, overlayId, lanes) {
|
|
71
123
|
const key = overlayKey(chartIndex, overlayId);
|
|
72
124
|
const token = Symbol(key);
|
|
73
|
-
bypassTokens.
|
|
125
|
+
const standing = bypassTokens.get(key) ?? new Map();
|
|
126
|
+
standing.set(token, lanes !== undefined && lanes.size > 0 ? new Set(lanes) : null);
|
|
127
|
+
bypassTokens.set(key, standing);
|
|
74
128
|
return token;
|
|
75
129
|
}
|
|
76
130
|
export function releaseLocalKScriptSourceCacheBypass(chartIndex, overlayId, token) {
|
|
77
131
|
const key = overlayKey(chartIndex, overlayId);
|
|
78
|
-
|
|
132
|
+
const standing = bypassTokens.get(key);
|
|
133
|
+
if (!standing?.delete(token))
|
|
134
|
+
return;
|
|
135
|
+
if (standing.size === 0)
|
|
79
136
|
bypassTokens.delete(key);
|
|
80
137
|
}
|
|
81
138
|
/**
|
|
82
139
|
* Install one bypass token per overlay for a whole-chart forced refresh (the
|
|
83
140
|
* full-fetch debug oracle): every listed overlay's source acquisitions reach
|
|
84
141
|
* the wire until the returned release runs. Release is token-owned per
|
|
85
|
-
* overlay, so a revalidation refresh that installed its own
|
|
86
|
-
*
|
|
142
|
+
* overlay, so a revalidation refresh that installed its own token in the
|
|
143
|
+
* meantime keeps it.
|
|
87
144
|
*/
|
|
88
145
|
export function installLocalKScriptSourceCacheBypassForOverlays(chartIndex, overlayIds) {
|
|
89
146
|
const owned = overlayIds.map((overlayId) => ({
|
|
@@ -95,9 +152,27 @@ export function installLocalKScriptSourceCacheBypassForOverlays(chartIndex, over
|
|
|
95
152
|
releaseLocalKScriptSourceCacheBypass(chartIndex, overlayId, token);
|
|
96
153
|
};
|
|
97
154
|
}
|
|
98
|
-
/**
|
|
99
|
-
|
|
100
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Which standing token covers the lane: 'overlay' when a token over every lane
|
|
157
|
+
* stands, 'lane' when a lane-scoped token holds the lane, null otherwise (no
|
|
158
|
+
* token, or only tokens over other lanes). Observed, never consumed.
|
|
159
|
+
*/
|
|
160
|
+
export function localKScriptSourceReplayCacheBypassScope(chartIndex, overlayId, laneKey) {
|
|
161
|
+
const standing = bypassTokens.get(overlayKey(chartIndex, overlayId));
|
|
162
|
+
if (!standing)
|
|
163
|
+
return null;
|
|
164
|
+
let scope = null;
|
|
165
|
+
for (const lanes of standing.values()) {
|
|
166
|
+
if (lanes === null)
|
|
167
|
+
return 'overlay';
|
|
168
|
+
if (lanes.has(laneKey))
|
|
169
|
+
scope = 'lane';
|
|
170
|
+
}
|
|
171
|
+
return scope;
|
|
172
|
+
}
|
|
173
|
+
/** Observed (never consumed) by every source acquisition of the overlay: true when a standing token covers the lane. */
|
|
174
|
+
export function shouldBypassLocalKScriptSourceReplayCache(chartIndex, overlayId, laneKey) {
|
|
175
|
+
return localKScriptSourceReplayCacheBypassScope(chartIndex, overlayId, laneKey) !== null;
|
|
101
176
|
}
|
|
102
177
|
/** Chart teardown / dataset replacement: drop marks and tokens for the chart (or one overlay). */
|
|
103
178
|
export function clearLocalKScriptSourceRevalidation(chartIndex, overlayId) {
|
|
@@ -41,13 +41,18 @@ export declare function warmupBucketsForNeed(needBars: number): number;
|
|
|
41
41
|
* shows, and a fetch for it buys nothing the eye can see.
|
|
42
42
|
*/
|
|
43
43
|
export declare const LOCAL_KSCRIPT_WARMUP_DEPTH_MIN_GAP_BARS = 25;
|
|
44
|
+
/** The bars a window must hold past a sheet's declared warm-up before an empty result is trusted: declarations
|
|
45
|
+
* under-report (a script declaring 252 first printed at bar 351), so one loader bucket of slack. */
|
|
46
|
+
export declare const LOCAL_KSCRIPT_WARMUP_DECLARED_SLACK_BARS = 250;
|
|
44
47
|
type LocalKScriptWarmupDepthSkipReason = 'no-rows' | 'no-viewport' | 'warmup-offscreen' | 'gap-too-small' | 'rounds-exhausted' | 'left-exhausted' | 'gesture-active'
|
|
45
|
-
/** A source
|
|
48
|
+
/** A source is still landing (for an empty result, any source unsettled): no evidence until it lands. */
|
|
46
49
|
| 'sources-pending'
|
|
47
50
|
/** The script declares a lookback of 0 and simply printed nothing: an empty output is not a warmup gap. */
|
|
48
51
|
| 'zero-lookback-empty'
|
|
49
52
|
/** The visible first value is where a source's history begins (`sourceReachFromTs`): no page can move it. */
|
|
50
|
-
| 'source-reach'
|
|
53
|
+
| 'source-reach'
|
|
54
|
+
/** Nothing printed over a window that holds the sheet's declared warm-up and its slack: not warmup. */
|
|
55
|
+
| 'no-values-declared-covered';
|
|
51
56
|
export type LocalKScriptWarmupDepthDecision = {
|
|
52
57
|
fetch: true;
|
|
53
58
|
reason: 'warmup-visible' | 'no-values-yet' | 'declared-depth';
|
|
@@ -105,17 +110,23 @@ export interface LocalKScriptWarmupDepthInput {
|
|
|
105
110
|
* script that declares 5 bars is never owed a second bucket.
|
|
106
111
|
*/
|
|
107
112
|
lookbackBars: number | null;
|
|
108
|
-
/** Every source
|
|
113
|
+
/** Every source answered for the current timeline (wrun: a dead lane leaves it false): an empty result needs it. */
|
|
109
114
|
sourcesSettled: boolean;
|
|
115
|
+
/** A source's recovery can still rerun it (wrun: `warmupSourceEntryLanding` over the degrade registry); absent,
|
|
116
|
+
* `!sourcesSettled`. A result with values waits for it alone: a source given up on cannot move a first value. */
|
|
117
|
+
sourcesLanding?: boolean;
|
|
110
118
|
/**
|
|
111
|
-
* Where the rows of the result's history sources begin at the clock, null or absent when unknown
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
119
|
+
* Where the rows of the result's history sources begin at the clock, null or absent when unknown (the wrun lane:
|
|
120
|
+
* `wrunRunSourceReachFromMs`, from declared reaches and every-bar answers only). A visible
|
|
121
|
+
* first value at or after it, with the reach at or after the loaded start, is that history beginning, not a warm-up:
|
|
122
|
+
* a page of candles older than the loaded start holds none of the source's rows, so it cannot move the first value
|
|
123
|
+
* ('source-reach'). Spot Exposures on a 52-day 1h viewport bought a 500-bar page this way for strike rows kept 7 days
|
|
124
|
+
* (INT 2026-10-20).
|
|
117
125
|
*/
|
|
118
126
|
sourceReachFromTs?: number | null;
|
|
127
|
+
/** A sheet's declared warm-up (wrun `warmup` / `warmup_bars`): true when the run's rows hold it plus
|
|
128
|
+
* LOCAL_KSCRIPT_WARMUP_DECLARED_SLACK_BARS, false when they do not; null or absent when it declares none. */
|
|
129
|
+
declaredWarmupCovered?: boolean | null;
|
|
119
130
|
}
|
|
120
131
|
/**
|
|
121
132
|
* Bars in the loaded main window: floor((last - first) / interval) + 1. Null
|
|
@@ -123,6 +134,16 @@ export interface LocalKScriptWarmupDepthInput {
|
|
|
123
134
|
* are inverted (a malformed read is unknown, never a small window).
|
|
124
135
|
*/
|
|
125
136
|
export declare function loadedBarsOfWindow(loadedFirstTs: number | null | undefined, loadedLastTs: number | null | undefined, intervalMs: number): number | null;
|
|
137
|
+
/** Whether a source's answer is still coming: the caller's `sourcesLanding`, else any source not settled. */
|
|
138
|
+
export declare function warmupSourcesLanding(input: Pick<LocalKScriptWarmupDepthInput, 'sourcesSettled' | 'sourcesLanding'>): boolean;
|
|
139
|
+
/** A source's entry in the degrade registry, as the warm-up reads it. */
|
|
140
|
+
export interface WarmupSourceEntryLike {
|
|
141
|
+
phase: 'pending' | 'degraded' | 'recovered';
|
|
142
|
+
terminal: boolean;
|
|
143
|
+
}
|
|
144
|
+
/** Whether a source is still landing: pending (in flight, a first slice) or degraded with its ladder not given up. Once
|
|
145
|
+
* the ladder is terminal it is settled, whatever its cause or retryable flag. */
|
|
146
|
+
export declare function warmupSourceEntryLanding(entry: WarmupSourceEntryLike): boolean;
|
|
126
147
|
/**
|
|
127
148
|
* Decide whether to spend a warmup round. The first value must sit inside or
|
|
128
149
|
* to the right of the visible window (offscreen warmup is the normal, harmless
|
|
@@ -131,13 +152,16 @@ export declare function loadedBarsOfWindow(loadedFirstTs: number | null | undefi
|
|
|
131
152
|
* all-NaN run is evidence only after every source settled (field 2026-09-05:
|
|
132
153
|
* Volume Bubbles fired a blind 500-bar page while its volume-profile source
|
|
133
154
|
* was still downloading, and every heavy native overlay refetched the widened
|
|
134
|
-
* range)
|
|
155
|
+
* range), and a result with values only once no source is still landing. A
|
|
156
|
+
* declared lookback deeper than the loaded window, with the first
|
|
135
157
|
* value at the loaded start, is the one non-observed reason ('declared-depth',
|
|
136
158
|
* sized to the shortfall, one page at a time; a shortfall under the absolute
|
|
137
159
|
* gap floor, or the caller's `minGapBars`, is left alone like any other small gap).
|
|
138
160
|
* A visible first value that a source's history explains (`sourceReachFromTs`:
|
|
139
161
|
* that history begins inside the loaded window and the first value at or after
|
|
140
|
-
* it) owes no page: older candles hold none of the source's rows.
|
|
162
|
+
* it) owes no page: older candles hold none of the source's rows. An all-NaN
|
|
163
|
+
* run whose rows hold the sheet's declared warm-up plus its slack owes none
|
|
164
|
+
* either ('no-values-declared-covered'); an undeclared one keeps its probe page.
|
|
141
165
|
*/
|
|
142
166
|
export declare function chooseLocalKScriptWarmupDepth(input: LocalKScriptWarmupDepthInput): LocalKScriptWarmupDepthDecision;
|
|
143
167
|
export interface WarmupOutputLike {
|
|
@@ -49,6 +49,9 @@ export function warmupBucketsForNeed(needBars) {
|
|
|
49
49
|
*/
|
|
50
50
|
export const LOCAL_KSCRIPT_WARMUP_DEPTH_MIN_GAP_BARS = 25;
|
|
51
51
|
const LOCAL_KSCRIPT_WARMUP_DEPTH_MIN_GAP_VIEWPORT_FRACTION = 0.1;
|
|
52
|
+
/** The bars a window must hold past a sheet's declared warm-up before an empty result is trusted: declarations
|
|
53
|
+
* under-report (a script declaring 252 first printed at bar 351), so one loader bucket of slack. */
|
|
54
|
+
export const LOCAL_KSCRIPT_WARMUP_DECLARED_SLACK_BARS = LOCAL_KSCRIPT_WARMUP_DEPTH_BUCKET_BARS;
|
|
52
55
|
function isFiniteTs(value) {
|
|
53
56
|
return typeof value === 'number' && Number.isFinite(value);
|
|
54
57
|
}
|
|
@@ -75,6 +78,15 @@ export function loadedBarsOfWindow(loadedFirstTs, loadedLastTs, intervalMs) {
|
|
|
75
78
|
const bars = Math.floor((loadedLastTs - loadedFirstTs) / intervalMs) + 1;
|
|
76
79
|
return bars >= 1 ? bars : null;
|
|
77
80
|
}
|
|
81
|
+
/** Whether a source's answer is still coming: the caller's `sourcesLanding`, else any source not settled. */
|
|
82
|
+
export function warmupSourcesLanding(input) {
|
|
83
|
+
return input.sourcesLanding ?? !input.sourcesSettled;
|
|
84
|
+
}
|
|
85
|
+
/** Whether a source is still landing: pending (in flight, a first slice) or degraded with its ladder not given up. Once
|
|
86
|
+
* the ladder is terminal it is settled, whatever its cause or retryable flag. */
|
|
87
|
+
export function warmupSourceEntryLanding(entry) {
|
|
88
|
+
return entry.phase === 'pending' || (entry.phase === 'degraded' && !entry.terminal);
|
|
89
|
+
}
|
|
78
90
|
/**
|
|
79
91
|
* Decide whether to spend a warmup round. The first value must sit inside or
|
|
80
92
|
* to the right of the visible window (offscreen warmup is the normal, harmless
|
|
@@ -83,13 +95,16 @@ export function loadedBarsOfWindow(loadedFirstTs, loadedLastTs, intervalMs) {
|
|
|
83
95
|
* all-NaN run is evidence only after every source settled (field 2026-09-05:
|
|
84
96
|
* Volume Bubbles fired a blind 500-bar page while its volume-profile source
|
|
85
97
|
* was still downloading, and every heavy native overlay refetched the widened
|
|
86
|
-
* range)
|
|
98
|
+
* range), and a result with values only once no source is still landing. A
|
|
99
|
+
* declared lookback deeper than the loaded window, with the first
|
|
87
100
|
* value at the loaded start, is the one non-observed reason ('declared-depth',
|
|
88
101
|
* sized to the shortfall, one page at a time; a shortfall under the absolute
|
|
89
102
|
* gap floor, or the caller's `minGapBars`, is left alone like any other small gap).
|
|
90
103
|
* A visible first value that a source's history explains (`sourceReachFromTs`:
|
|
91
104
|
* that history begins inside the loaded window and the first value at or after
|
|
92
|
-
* it) owes no page: older candles hold none of the source's rows.
|
|
105
|
+
* it) owes no page: older candles hold none of the source's rows. An all-NaN
|
|
106
|
+
* run whose rows hold the sheet's declared warm-up plus its slack owes none
|
|
107
|
+
* either ('no-values-declared-covered'); an undeclared one keeps its probe page.
|
|
93
108
|
*/
|
|
94
109
|
export function chooseLocalKScriptWarmupDepth(input) {
|
|
95
110
|
if (!isFiniteTs(input.loadedFirstTs))
|
|
@@ -114,6 +129,9 @@ export function chooseLocalKScriptWarmupDepth(input) {
|
|
|
114
129
|
return { fetch: false, reason: 'sources-pending' };
|
|
115
130
|
if (lookbackBars === 0)
|
|
116
131
|
return { fetch: false, reason: 'zero-lookback-empty' };
|
|
132
|
+
// A declaration is trusted: rows holding it and its slack that printed nothing are no warm-up (an interval gate).
|
|
133
|
+
if (input.declaredWarmupCovered === true)
|
|
134
|
+
return { fetch: false, reason: 'no-values-declared-covered' };
|
|
117
135
|
// The declared lookback under-reports (a script declaring 252 first
|
|
118
136
|
// printed at bar 351), so the need is at least one bucket; an unknown
|
|
119
137
|
// lookback keeps the two-bucket page the field relied on.
|
|
@@ -146,7 +164,7 @@ export function chooseLocalKScriptWarmupDepth(input) {
|
|
|
146
164
|
loadedBars < lookbackBars &&
|
|
147
165
|
input.firstValueTs <= input.loadedFirstTs + input.intervalMs) {
|
|
148
166
|
// A truncated run with sources still in flight proves nothing yet.
|
|
149
|
-
if (
|
|
167
|
+
if (warmupSourcesLanding(input))
|
|
150
168
|
return { fetch: false, reason: 'sources-pending' };
|
|
151
169
|
const missingBars = lookbackBars - loadedBars;
|
|
152
170
|
// The absolute gap floor applies here too: a shortfall under
|
|
@@ -174,6 +192,9 @@ export function chooseLocalKScriptWarmupDepth(input) {
|
|
|
174
192
|
const minGapBars = Math.max(LOCAL_KSCRIPT_WARMUP_DEPTH_MIN_GAP_BARS, Math.ceil(viewportBars * LOCAL_KSCRIPT_WARMUP_DEPTH_MIN_GAP_VIEWPORT_FRACTION));
|
|
175
193
|
if (missingBars < minGapBars)
|
|
176
194
|
return { fetch: false, reason: 'gap-too-small' };
|
|
195
|
+
// A lane still landing (a first slice) reads its first value late; the run after it settles judges again.
|
|
196
|
+
if (warmupSourcesLanding(input))
|
|
197
|
+
return { fetch: false, reason: 'sources-pending' };
|
|
177
198
|
// A first value a source's history explains: that history begins inside the loaded window and the first value sits
|
|
178
199
|
// at or after its start, so a page of older candles holds none of the source's rows and cannot move it.
|
|
179
200
|
const reachTs = input.sourceReachFromTs;
|
|
@@ -101,3 +101,11 @@ export declare function currentCmeSessionStartMs(nowMs: number, opts: {
|
|
|
101
101
|
symbol?: string | null;
|
|
102
102
|
rth: boolean;
|
|
103
103
|
}): number | null;
|
|
104
|
+
/** The session that traded last before a closed `nowMs`, in `currentCmeSessionStartMs`'s mode; null inside one, holidays unknown. */
|
|
105
|
+
export declare function lastCmeSessionBoundsBefore(nowMs: number, opts: {
|
|
106
|
+
symbol?: string | null;
|
|
107
|
+
rth: boolean;
|
|
108
|
+
}): {
|
|
109
|
+
openMs: number;
|
|
110
|
+
closeMs: number;
|
|
111
|
+
} | null;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import { cmeServedAccessForExchange } from './cme-cache-context.util.js';
|
|
27
27
|
import { zoneWallMsAt } from './ny-calendar.util.js';
|
|
28
|
-
import { getRthWindowForSymbol, rthSessionOpenMs } from './rth-session.util.js';
|
|
28
|
+
import { getRthWindowForSymbol, rthSessionOpenMs, sessionDayBoundsFor } from './rth-session.util.js';
|
|
29
29
|
import { delayedDefaultSecondsFor, gateProviderForExchange } from '../v2/gate-plane.util.js';
|
|
30
30
|
export const GOVERNED_FUTURES_TIME_ZONE = 'America/Chicago';
|
|
31
31
|
/** Sunday-based minutes-of-week for the two boundary kinds. */
|
|
@@ -373,3 +373,41 @@ export function currentCmeSessionStartMs(nowMs, opts) {
|
|
|
373
373
|
return alwaysOnSessionStartMs(nowMs, sinceMs);
|
|
374
374
|
return globexSessionStartMs(nowMs);
|
|
375
375
|
}
|
|
376
|
+
/** The session that traded last before a closed `nowMs`, in `currentCmeSessionStartMs`'s mode; null inside one, holidays unknown. */
|
|
377
|
+
export function lastCmeSessionBoundsBefore(nowMs, opts) {
|
|
378
|
+
if (!Number.isFinite(nowMs) || currentCmeSessionStartMs(nowMs, opts) !== null)
|
|
379
|
+
return null;
|
|
380
|
+
const window = opts.rth ? getRthWindowForSymbol(opts.symbol) : null;
|
|
381
|
+
if (window !== null) {
|
|
382
|
+
// The reader above names the days that trade (a holiday morning too): the newest window it reads open.
|
|
383
|
+
let cursorMs = nowMs;
|
|
384
|
+
for (let back = 0; back <= 7; back += 1) {
|
|
385
|
+
const day = sessionDayBoundsFor(window, cursorMs);
|
|
386
|
+
if (day === null)
|
|
387
|
+
return null;
|
|
388
|
+
if (day.closeMs <= nowMs && currentCmeSessionStartMs(day.closeMs - 1, opts) === day.openMs) {
|
|
389
|
+
return { openMs: day.openMs, closeMs: day.closeMs };
|
|
390
|
+
}
|
|
391
|
+
cursorMs = day.dayStartMs - 1;
|
|
392
|
+
}
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
395
|
+
const p = wallClockPartsAt(nowMs);
|
|
396
|
+
const sinceMs = cmeAlwaysOnSinceMs(opts.symbol);
|
|
397
|
+
if (sinceMs !== null && nowMs >= sinceMs) {
|
|
398
|
+
// Closed here means the Saturday maintenance window: the session ran from the Saturday before.
|
|
399
|
+
const opened = chicagoDateDaysBefore(p, 7);
|
|
400
|
+
return {
|
|
401
|
+
openMs: Math.max(sinceMs, chicagoWallTimeToUtc(opened.year, opened.month, opened.day, ALWAYS_ON_MAINTENANCE_END_HOUR)),
|
|
402
|
+
closeMs: chicagoWallTimeToUtc(p.year, p.month, p.day, ALWAYS_ON_MAINTENANCE_START_HOUR),
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
// The weekly cycle: the 16:00 CT close of today on a weekday, of Friday across the weekend.
|
|
406
|
+
const daysBack = p.weekday === 6 ? 1 : p.weekday === 0 ? 2 : 0;
|
|
407
|
+
const closed = chicagoDateDaysBefore(p, daysBack);
|
|
408
|
+
const opened = chicagoDateDaysBefore(p, daysBack + 1);
|
|
409
|
+
return {
|
|
410
|
+
openMs: chicagoWallTimeToUtc(opened.year, opened.month, opened.day, OPEN_HOUR),
|
|
411
|
+
closeMs: chicagoWallTimeToUtc(closed.year, closed.month, closed.day, CLOSE_HOUR),
|
|
412
|
+
};
|
|
413
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The market-session contract: which regular session a market has, whether a chart and an overlay ride it, and where
|
|
3
|
+
* its edges fall, for every market the chart's session-aware tools serve (the footprint, the session, delta, visible,
|
|
4
|
+
* fixed-range and developing profiles, CVD, volume delta and VWAP).
|
|
5
|
+
*
|
|
6
|
+
* Why this exists: those tools decided trading hours through rth-session.util, whose rules are futures-only
|
|
7
|
+
* (`hasRthWindow` needs a CME-governed venue, `getRthWindowForSymbol` keys futures roots), so a US stock had no
|
|
8
|
+
* session: regular-hours stock charts at 45m to 12h drew order flow 30 minutes off the 09:30 New York grid with the
|
|
9
|
+
* closing bar empty. This module answers both markets through one door:
|
|
10
|
+
* 'cme' exactly rth-session.util: every CME answer is the named rth-session helper's own answer (same null
|
|
11
|
+
* and fail-open contracts), byte-identical to the futures-only path it replaces.
|
|
12
|
+
* 'us-equity' the regular session 09:30 to 16:00 America/New_York (us-equities-session.util
|
|
13
|
+
* `US_EQUITIES_REGULAR_WINDOW`), DST-correct, on the per-window day walk the CME window rides
|
|
14
|
+
* (rth-session.util `sessionDayBoundsFor`). The gateway keeps a REGULAR bucket by its START, so the
|
|
15
|
+
* 16:00:00 closing cross sits outside the window, as it sits outside the candles.
|
|
16
|
+
* null every other market (crypto, forex, unmapped futures roots): each op answers what its rth-session
|
|
17
|
+
* helper answers with no window.
|
|
18
|
+
*
|
|
19
|
+
* The equities calendar is weekdays plus DST only: ny-calendar.util models no exchange holidays and no early closes.
|
|
20
|
+
* Saturday and Sunday hold no session (the per-instant ops answer out of session there); a holiday (2026-11-26) still
|
|
21
|
+
* reads as an ordinary weekday session and an early close (2026-11-27) as a full one. Bucketing is data-driven, so
|
|
22
|
+
* that is safe there: a holiday has no rows to bucket, and an early close's rows land in the buckets they fall in. A
|
|
23
|
+
* caller that PICKS a session (a developing-session window, a visible-range prior day) must pick one that holds
|
|
24
|
+
* candles: `latestMarketSessionBoundsAtOrBefore` names a holiday's window like any weekday's.
|
|
25
|
+
*
|
|
26
|
+
* Worker-safe: no Vue, store or i18n imports (workers and the live-feed gates call these per row and per frame).
|
|
27
|
+
*/
|
|
28
|
+
import { type RthWindow, type SessionDayWindow } from './rth-session.util.js';
|
|
29
|
+
export type MarketSessionKind = 'cme' | 'us-equity';
|
|
30
|
+
/**
|
|
31
|
+
* A US stock market: a Polygon listing code (marketKind.util `checkIsPolygon`: POLYGON, US_STOCKS, NYSE, NASDAQ,
|
|
32
|
+
* CBOE) or a stocks tape code (stocks-governed.util `isStocksTapeGoverned`: NYSE_TAPE, NYSE_ARCA_TAPE,
|
|
33
|
+
* NASDAQ_TAPE). Case-insensitive; false for anything that is not a string.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isUsEquityMarket(exchange: unknown): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The regular session a market has: 'cme' exactly when rth-session.util `hasRthWindow(symbol, exchange)` (a
|
|
38
|
+
* CME-governed venue and a mapped futures root), 'us-equity' when `isUsEquityMarket(exchange)`, else null. The two
|
|
39
|
+
* venue sets are disjoint.
|
|
40
|
+
*/
|
|
41
|
+
export declare function marketSessionKind(exchange: unknown, symbol: unknown): MarketSessionKind | null;
|
|
42
|
+
/**
|
|
43
|
+
* The market's regular window: the root's own window on CME (`getRthWindowForSymbol`, under the `hasRthWindow`
|
|
44
|
+
* gate), `US_EQUITIES_REGULAR_WINDOW` on a US stock, else null.
|
|
45
|
+
*/
|
|
46
|
+
export declare function marketRegularWindow(exchange: unknown, symbol: unknown): Readonly<RthWindow> | null;
|
|
47
|
+
export declare function marketHasRegularWindow(exchange: unknown, symbol: unknown): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The regular session THIS chart draws at `chartTfMs` (milliseconds), for overlay purposes; intraday only:
|
|
50
|
+
* 'cme' exactly when rth-session.util `isChartRthActive(exchange, symbol, sessionType, chartTfMs)`.
|
|
51
|
+
* 'us-equity' when the candles' own gate holds, us-equities-session.util
|
|
52
|
+
* `isEquityRegularSessionGated(exchange, sessionType, chartTfMs)` (a Polygon listing whose word is not
|
|
53
|
+
* an active 'extended'), at an intraday `chartTfMs`. A chart opened on a tape venue (NASDAQ_TAPE) has
|
|
54
|
+
* no candle session handling, so it answers null, as it rides today.
|
|
55
|
+
* null otherwise: an ETH or extended chart, a daily or longer interval, a label instead of milliseconds.
|
|
56
|
+
*/
|
|
57
|
+
export declare function chartRegularSessionKind(exchange: unknown, symbol: unknown, sessionType: unknown, chartTfMs: unknown): MarketSessionKind | null;
|
|
58
|
+
/**
|
|
59
|
+
* The chart's regular session as a cache-key settings bag carries it (cache-key-guard.util `indicatorCacheSettings`):
|
|
60
|
+
* its `chartRegularKind`, else the CME-only `chartRthActive` flag the bag always carried (true reads 'cme'), so a bag
|
|
61
|
+
* without the kind keys every CME overlay as before; else null. Key builders read the TARGET chart's session from the
|
|
62
|
+
* bag, never the focused cell. The one reader: the footprint, profile and order-flow keys must never disagree on it.
|
|
63
|
+
*/
|
|
64
|
+
export declare function chartRegularKindFromCacheBag(bag: Readonly<Record<string, unknown>> | {
|
|
65
|
+
chartRegularKind?: unknown;
|
|
66
|
+
chartRthActive?: unknown;
|
|
67
|
+
} | null | undefined): MarketSessionKind | null;
|
|
68
|
+
/**
|
|
69
|
+
* Whether an overlay's session filter is ACTIVE on a chart whose regular session is `chartRegularKind`
|
|
70
|
+
* (`chartRegularSessionKind` of the chart). The overlay's own market decides the rule:
|
|
71
|
+
* CME exactly rth-session.util `isRthSessionHoursActive(settings, chartTfMs, chartRegularKind === 'cme')`:
|
|
72
|
+
* an explicit 'rth' stays active on any chart (a stock, crypto or ETH chart included), 'eth' never
|
|
73
|
+
* is, and the 'chart' default follows a CME RTH chart only.
|
|
74
|
+
* US stock active exactly while the chart draws the US equities regular session at an intraday `chartTfMs`.
|
|
75
|
+
* Stock overlays always follow the chart: their session row is hidden, so a persisted 'rth' or 'eth'
|
|
76
|
+
* carried over from a futures chart is ignored.
|
|
77
|
+
* any other never active (no window to filter on).
|
|
78
|
+
*/
|
|
79
|
+
export declare function isMarketSessionHoursActive(settings: {
|
|
80
|
+
sessionHours?: unknown;
|
|
81
|
+
symbol?: unknown;
|
|
82
|
+
exchange?: unknown;
|
|
83
|
+
} | null | undefined, chartTfMs: unknown, chartRegularKind: MarketSessionKind | null): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* `isWithinRthWindow`: whether `tsMs` sits in the market's `[open, close)` session. Fails OPEN with no window (a
|
|
86
|
+
* market without a regular session keeps every row), false for a non-finite instant on a market with one.
|
|
87
|
+
*/
|
|
88
|
+
export declare function isWithinMarketRegularWindow(exchange: unknown, symbol: unknown, tsMs: number): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* `rthSessionOpenMs`: the open of the session holding `tsMs`, null outside it. Null for EVERY instant on a market
|
|
91
|
+
* without a window, so a caller gates on `marketHasRegularWindow` before reading null as "out of session".
|
|
92
|
+
*/
|
|
93
|
+
export declare function marketSessionOpenMs(exchange: unknown, symbol: unknown, tsMs: number): number | null;
|
|
94
|
+
/** `rthSessionCloseMs`: the EXCLUSIVE close of the session holding `tsMs`; the open's null contract. */
|
|
95
|
+
export declare function marketSessionCloseMs(exchange: unknown, symbol: unknown, tsMs: number): number | null;
|
|
96
|
+
/**
|
|
97
|
+
* `rthBucketOverlapsSessionMs`: whether `[bucketStartMs, bucketStartMs + tfMs)` overlaps the session of the day
|
|
98
|
+
* holding its start or its last ms (a UTC-grid bucket holding the open or the close carries in-session rows although
|
|
99
|
+
* its start sits outside). False with no window or invalid inputs.
|
|
100
|
+
*/
|
|
101
|
+
export declare function marketBucketOverlapsSession(exchange: unknown, symbol: unknown, bucketStartMs: number, tfMs: number): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* `rthAnchoredBucketStartMs`: the session-anchored bucket holding `tsMs`, `open + n * tfMs` (the grid the gateway
|
|
104
|
+
* serves REGULAR bars on above 30m: 13:30Z hourly bars in EDT). Null with no window, invalid inputs, or `tsMs` out
|
|
105
|
+
* of session (live callers drop such a frame). On a stock it equals us-equities-session.util
|
|
106
|
+
* `usEquityAnchoredBucketStartMs`.
|
|
107
|
+
*/
|
|
108
|
+
export declare function marketAnchoredBucketStartMs(exchange: unknown, symbol: unknown, tsMs: number, tfMs: number): number | null;
|
|
109
|
+
/**
|
|
110
|
+
* `rthAnchoredBucketEndMs`: the EXCLUSIVE end of the anchored bucket starting at `bucketStartMs`,
|
|
111
|
+
* `min(start + tfMs, session close)` (a stock's 15:30 hourly bucket ends at 16:00). Null mirrors the start.
|
|
112
|
+
*/
|
|
113
|
+
export declare function marketAnchoredBucketEndMs(exchange: unknown, symbol: unknown, bucketStartMs: number, tfMs: number): number | null;
|
|
114
|
+
/**
|
|
115
|
+
* `footprintFoldBucketEndMs`: the instant a folded bucket stops changing. 'anchored' is the anchored end; 'eth'
|
|
116
|
+
* (the market's own full-session grid) is `start + tfMs` capped at the close of the session it holds. With no window,
|
|
117
|
+
* 'anchored' is null and 'eth' the nominal end.
|
|
118
|
+
*/
|
|
119
|
+
export declare function marketFoldBucketEndMs(exchange: unknown, symbol: unknown, bucketStartMs: number, tfMs: number, bucketMode: 'anchored' | 'eth'): number | null;
|
|
120
|
+
/**
|
|
121
|
+
* `latestRthSessionBoundsAtOrBefore`: the most recent session whose OPEN is at or before `tsMs`, in session or not
|
|
122
|
+
* (a session-anchored profile shows the last session outside trading hours). CME names CME trade dates only; a stock
|
|
123
|
+
* names the most recent WEEKDAY session (a Saturday or a Monday pre-open names Friday's), with no holiday calendar:
|
|
124
|
+
* a caller picking a session to draw skips one that holds no candles. Null with no window or a non-finite instant.
|
|
125
|
+
*/
|
|
126
|
+
export declare function latestMarketSessionBoundsAtOrBefore(exchange: unknown, symbol: unknown, tsMs: number): {
|
|
127
|
+
openMs: number;
|
|
128
|
+
closeMs: number;
|
|
129
|
+
} | null;
|
|
130
|
+
/**
|
|
131
|
+
* `rthWindowsInRange` / us-equities-session.util `usEquityRegularWindowsInRange`: every venue-local calendar day's
|
|
132
|
+
* `[open, close)` window touching `[fromMs, toMs]`, in order. Calendar-based on both markets: Saturday and Sunday
|
|
133
|
+
* windows are listed too, harmless for consumers that shade or reset on BARS (none trade then) and wrong for one that
|
|
134
|
+
* counts windows as trading days. Empty with no window.
|
|
135
|
+
*/
|
|
136
|
+
export declare function marketWindowsInRange(exchange: unknown, symbol: unknown, fromMs: number, toMs: number): SessionDayWindow[];
|