@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
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
import { Intervals } from '../../constants/interval.constants.js';
|
|
18
18
|
import { barEndMs, barStartMs } from '../chart/calendar-interval.util.js';
|
|
19
19
|
import { intervalLabelForMs } from '../chart/interval-ladder.util.js';
|
|
20
|
-
import {
|
|
20
|
+
import { viewScaledProfileRowMultiplier } from '../chart/profile-row-height.util.js';
|
|
21
|
+
import { marketSessionAtOrBefore, marketSessionNamed, profileRegionSessionKeys, } from '../chart/market-sessions.util.js';
|
|
21
22
|
import { getSessionInterval } from '../chart/session-interval.util.js';
|
|
22
23
|
import { parseWrunThemeToken, wrunFontFamilyCss, wrunThemeTokenScaleAlpha } from './wrun-style-words.util.js';
|
|
23
24
|
/** The sheet's mode words to the engine's display modes; "delta" is the
|
|
@@ -53,7 +54,10 @@ function bucketWidthOf(rows) {
|
|
|
53
54
|
const high = Number(bucket[1]);
|
|
54
55
|
if (!Number.isFinite(low) || !Number.isFinite(high) || high <= low)
|
|
55
56
|
continue;
|
|
56
|
-
|
|
57
|
+
// Nine significant digits, like the profile workers' spacings (volume-profile.worker.util): a raw subtraction
|
|
58
|
+
// drifts (65000.2 - 65000.1 = 0.0999999999985), and decimalsOf would then print every level label with 8
|
|
59
|
+
// decimals (POC 65000.10000000).
|
|
60
|
+
const candidate = Number((high - low).toPrecision(9));
|
|
57
61
|
if (width === undefined || candidate < width)
|
|
58
62
|
width = candidate;
|
|
59
63
|
}
|
|
@@ -85,24 +89,27 @@ function intervalLabelOf(intervalMs) {
|
|
|
85
89
|
}
|
|
86
90
|
return best ?? '1d';
|
|
87
91
|
}
|
|
88
|
-
/** The
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
92
|
+
/** The sheet's region words, to the region names the native session profiles store. */
|
|
93
|
+
const WRUN_REGION_SESSION_TYPES = {
|
|
94
|
+
us: 'US',
|
|
95
|
+
eu: 'EU',
|
|
96
|
+
asia: 'Asia',
|
|
97
|
+
};
|
|
98
|
+
/** The engine's session keys: "auto" the native Targeted mapping, a length word its ms, a region word its own day. */
|
|
99
|
+
function sessionKeysOf(word, intervalLabel, intervalMs) {
|
|
100
|
+
const value = word ?? 'auto';
|
|
101
|
+
const region = Object.prototype.hasOwnProperty.call(WRUN_REGION_SESSION_TYPES, value)
|
|
102
|
+
? WRUN_REGION_SESSION_TYPES[value]
|
|
103
|
+
: undefined;
|
|
104
|
+
if (region !== undefined) {
|
|
105
|
+
// Never the region's name: titan reads a name off its fixed-UTC table, an hour off every winter.
|
|
106
|
+
const keys = profileRegionSessionKeys(region, intervalMs);
|
|
107
|
+
return keys ? { ...keys, region } : { session: getSessionInterval(region, intervalLabel) };
|
|
105
108
|
}
|
|
109
|
+
if (value === 'auto')
|
|
110
|
+
return { session: getSessionInterval('Targeted', intervalLabel) };
|
|
111
|
+
const length = Intervals.map_unit[value];
|
|
112
|
+
return { session: typeof length === 'number' ? length : getSessionInterval('Targeted', intervalLabel) };
|
|
106
113
|
}
|
|
107
114
|
/** A colour word at a fraction of its own alpha: a token keeps its word
|
|
108
115
|
* (`theme.text/14`), a hex colour becomes `rgba(r, g, b, a)`; any other
|
|
@@ -148,13 +155,13 @@ function newestCloseMs(ctx, rows) {
|
|
|
148
155
|
return newest === undefined ? undefined : barEndMs(newest, ctx.intervalMs);
|
|
149
156
|
}
|
|
150
157
|
/** The rows of the session holding the newest bar (span "developing"): the
|
|
151
|
-
* window of the session length
|
|
152
|
-
*
|
|
153
|
-
* session is its calendar bar (`barStartMs`
|
|
154
|
-
* of the average length opened the March 2026
|
|
155
|
-
* and handed it February's row too. */
|
|
156
|
-
function developingRows(rows,
|
|
157
|
-
const sessionMs =
|
|
158
|
+
* window of the session length that contains the newest row's timestamp, or
|
|
159
|
+
* for a region its own session (the latest one opened by the newest row). A
|
|
160
|
+
* month, quarter, half-year or year session is its calendar bar (`barStartMs`
|
|
161
|
+
* to `barEndMs`): the epoch floor of the average length opened the March 2026
|
|
162
|
+
* session on January 31 10:30 and handed it February's row too. */
|
|
163
|
+
function developingRows(rows, keys) {
|
|
164
|
+
const sessionMs = keys.session > 0 ? keys.session : Intervals.DAY;
|
|
158
165
|
let newest;
|
|
159
166
|
for (const row of rows) {
|
|
160
167
|
const ts = rowTs(row);
|
|
@@ -163,8 +170,10 @@ function developingRows(rows, session) {
|
|
|
163
170
|
}
|
|
164
171
|
if (newest === undefined)
|
|
165
172
|
return [];
|
|
166
|
-
const
|
|
167
|
-
const
|
|
173
|
+
const regionWindow = keys.region !== undefined ? marketSessionNamed(keys.region) : null;
|
|
174
|
+
const regionSession = regionWindow ? marketSessionAtOrBefore(regionWindow, newest) : null;
|
|
175
|
+
const start = regionSession ? regionSession[0] : barStartMs(newest, sessionMs);
|
|
176
|
+
const end = regionSession ? regionSession[1] : barEndMs(start, sessionMs);
|
|
168
177
|
return rows.filter((row) => {
|
|
169
178
|
const ts = rowTs(row);
|
|
170
179
|
return ts !== undefined && ts >= start && ts < end;
|
|
@@ -185,7 +194,7 @@ export function wrunVolumeProfileChild(profile, cellRows, ctx) {
|
|
|
185
194
|
return null;
|
|
186
195
|
const span = profile.span ?? 'session';
|
|
187
196
|
const intervalLabel = intervalLabelOf(ctx.intervalMs);
|
|
188
|
-
const
|
|
197
|
+
const sessionKeys = sessionKeysOf(profile.session, intervalLabel, ctx.intervalMs);
|
|
189
198
|
let data;
|
|
190
199
|
const anchor = {};
|
|
191
200
|
switch (span) {
|
|
@@ -208,7 +217,7 @@ export function wrunVolumeProfileChild(profile, cellRows, ctx) {
|
|
|
208
217
|
break;
|
|
209
218
|
}
|
|
210
219
|
case 'developing':
|
|
211
|
-
data = developingRows(rows,
|
|
220
|
+
data = developingRows(rows, sessionKeys);
|
|
212
221
|
anchor.profileWindow = 'data';
|
|
213
222
|
anchor.lineBounds = 'profile';
|
|
214
223
|
break;
|
|
@@ -218,11 +227,14 @@ export function wrunVolumeProfileChild(profile, cellRows, ctx) {
|
|
|
218
227
|
default:
|
|
219
228
|
data = [...rows];
|
|
220
229
|
anchor.variant = 'session';
|
|
221
|
-
anchor.session = session;
|
|
230
|
+
anchor.session = sessionKeys.session;
|
|
231
|
+
if (sessionKeys.customSessionWindow)
|
|
232
|
+
anchor.customSessionWindow = sessionKeys.customSessionWindow;
|
|
222
233
|
}
|
|
223
234
|
const bucketWidth = bucketWidthOf(rows);
|
|
224
235
|
const rowHeight = profile.row_height ?? 'auto';
|
|
225
|
-
|
|
236
|
+
// View-scaled on purpose (PROFILE-ROWS LEFT: titan's row cap).
|
|
237
|
+
const multiplier = rowHeight === 'auto' ? viewScaledProfileRowMultiplier('session', intervalLabel) : undefined;
|
|
226
238
|
const barHeight = rowHeight === 'auto' ? (bucketWidth === undefined ? undefined : bucketWidth * (multiplier ?? 1)) : rowHeight;
|
|
227
239
|
const dockLeft = (profile.dock ?? (span === 'visible' ? 'right' : 'left')) === 'left';
|
|
228
240
|
const widthFrac = profile.width_frac ?? (span === 'session' || span === 'range' ? 0.7 : 0.2);
|
|
@@ -102,16 +102,25 @@ export interface AggregateOhlcvOptions {
|
|
|
102
102
|
export declare function aggregateOhlcvRows(rows: number[][], bucketMs: number, minMs?: number, maxMs?: number, options?: AggregateOhlcvOptions): number[][];
|
|
103
103
|
export declare function sourceGranularReplaySubRows(rows: number[][], minMs: number, maxMs: number): number[][];
|
|
104
104
|
export declare function replaySubSourceIntervalMs(buffer: ReplayBuffer, chartIntervalMs: number): number;
|
|
105
|
+
/**
|
|
106
|
+
* The newest sub-row stamp playable at `targetMs`: every sub row stamped at or before it may show, none after it.
|
|
107
|
+
* A tick row is a point-in-time event, playable at its own stamp. A bar-lane row is start-stamped and covers
|
|
108
|
+
* [stamp, stamp + source interval): it plays once its last millisecond (stamp + interval - 1, the stamp an irregular
|
|
109
|
+
* timeline steps on, see playableRowsForBuffer) is at or before the target. Played at its open, it showed a whole
|
|
110
|
+
* sub-bar of future price. The one rule for every sub-row reader: the forming candle a seek and the replay bar read,
|
|
111
|
+
* the candle coverage check, and the replay clock's fold.
|
|
112
|
+
*/
|
|
113
|
+
export declare function latestPlayableSubRowMs(buffer: ReplayBuffer, chartIntervalMs: number, targetMs: number): number;
|
|
105
114
|
/**
|
|
106
115
|
* Whether the sub rows already hold what the forming candle shows at the
|
|
107
116
|
* playhead: on the tick rail a row inside [this step, playhead] of the active
|
|
108
|
-
* chart bucket, on a bar lane a source row
|
|
117
|
+
* chart bucket, on a bar lane a source row playable inside it (latestPlayableSubRowMs).
|
|
109
118
|
* Runs every clock tick (the candle coverage check); sub rows stay sorted, so
|
|
110
119
|
* the first row at or past the earliest qualifying stamp decides instead of a
|
|
111
120
|
* scan of the whole rail, which on bar lanes is never shed and grows one batch
|
|
112
121
|
* per autoload.
|
|
113
122
|
*/
|
|
114
|
-
export declare function replaySubRowsHoldFormingRow(buffer: ReplayBuffer, playheadMs: number, chartIntervalMs: number, stepMs: number
|
|
123
|
+
export declare function replaySubRowsHoldFormingRow(buffer: ReplayBuffer, playheadMs: number, chartIntervalMs: number, stepMs: number): boolean;
|
|
115
124
|
export declare function formingChartRowFromSubRows(buffer: ReplayBuffer, chartIntervalMs: number, targetMs: number): number[] | null;
|
|
116
125
|
export declare function mergeHeatmapColumns(existing: Float64Array[], incoming: Float64Array[]): Float64Array[];
|
|
117
126
|
export declare function mergeHeatmapColumnsIncrementally(existing: Float64Array[], incoming: Float64Array[]): Float64Array[];
|
|
@@ -148,14 +157,15 @@ export type ReplayBarVenue = LiveBucketVenue | null;
|
|
|
148
157
|
*/
|
|
149
158
|
export declare function replayBarKeyMs(timestampMs: number, chartIntervalMs: number, venue: ReplayBarVenue): number | null;
|
|
150
159
|
/**
|
|
151
|
-
* The OPEN of the bar keyed `barKeyMs`: its key, except a
|
|
152
|
-
* 00:00Z, which opens at the
|
|
160
|
+
* The OPEN of the bar keyed `barKeyMs`: its key, except a session-lattice trade-date bar (1d, 3d,
|
|
161
|
+
* 1w) keyed 00:00Z, which opens at the session open the evening before (`venueSessionLatticeBarOpenMs`:
|
|
162
|
+
* 17:00 Chicago on the CME family, 17:00 New York on forex).
|
|
153
163
|
*/
|
|
154
164
|
export declare function replayBarOpenMs(barKeyMs: number, chartIntervalMs: number, venue: ReplayBarVenue): number;
|
|
155
165
|
/**
|
|
156
166
|
* The END of the bar keyed `barKeyMs`, the instant it stops taking rows: its key plus the interval
|
|
157
|
-
* on the plain grid; the
|
|
158
|
-
*
|
|
167
|
+
* on the plain grid; the session lattice's own end (`venueSessionLatticeBarEndMs`: a 1d bar runs to
|
|
168
|
+
* the next session open, a fall-back Sunday's 4h bar an hour longer); a calendar bar's calendar end;
|
|
159
169
|
* and on a session grid the end of its last session (an RTH stub at the 20:15Z close, a stock's 3d
|
|
160
170
|
* bar at its third session's 16:00 close), walked once per bar on the quarter-hour probe.
|
|
161
171
|
*/
|
|
@@ -2,8 +2,7 @@ import { Intervals } from '../../constants/interval.constants.js';
|
|
|
2
2
|
import { intervalLabelForMs } from '../../utility/chart/interval-registry.util.js';
|
|
3
3
|
import { CANDLE_TICK_BACKFILL_SEC, FALLBACK_VIEW_BEHIND_MS, FOLLOW_SPAN_ECHO_TOLERANCE_BARS, MONDAY_BUCKET_ORIGIN_MS, REPLAY_COARSE_FORWARD_BATCH, REPLAY_FOLLOW_RIGHT_OFFSET_FRACTION, REPLAY_FORWARD_BATCH, } from '../../constants/replay-ladder.leaf.js';
|
|
4
4
|
import { barEndMs, calendarMonthsOfMs } from '../../utility/chart/calendar-interval.util.js';
|
|
5
|
-
import {
|
|
6
|
-
import { cmeSessionLatticeBucketMs, liveBucketStartMs, } from '../../utility/chart/live-bucket.util.js';
|
|
5
|
+
import { liveBucketStartMs, venueSessionLatticeBarEndMs, venueSessionLatticeBarOpenMs, venueSessionLatticeBucketMs, } from '../../utility/chart/live-bucket.util.js';
|
|
7
6
|
import { replayResolutionBookEdgeSec, replayResolutionStepMs, tfLabelForMs } from '../../replay/replayLadder.js';
|
|
8
7
|
const DAY_MS = Intervals.DAY;
|
|
9
8
|
const WEEK_MS = Intervals.WEEK;
|
|
@@ -378,10 +377,16 @@ export function aggregateOhlcvRows(rows, bucketMs, minMs = -Infinity, maxMs = In
|
|
|
378
377
|
}
|
|
379
378
|
return Array.from(byBucket.values()).sort((a, b) => a[0] - b[0]);
|
|
380
379
|
}
|
|
380
|
+
/** The step a sub-row rail collapses to (playableRowsForBuffer). */
|
|
381
|
+
function replaySubStepMs(buffer, chartIntervalMs) {
|
|
382
|
+
return buffer.subStepMs ?? replayResolutionMs(buffer.tf, chartIntervalMs);
|
|
383
|
+
}
|
|
384
|
+
/** A collapsed step wider than a second (a bar lane) is stamped at its last millisecond, the 1s tick step at its open. */
|
|
385
|
+
const subStepStampedAtEnd = (stepMs) => stepMs > Intervals.SECOND;
|
|
381
386
|
function aggregateReplaySubRows(rows, stepMs, minMs, maxMs, originMs) {
|
|
382
387
|
return aggregateOhlcvRows(rows, stepMs, minMs, maxMs, {
|
|
383
388
|
originMs,
|
|
384
|
-
timestamp: stepMs
|
|
389
|
+
timestamp: subStepStampedAtEnd(stepMs) ? 'end' : 'start',
|
|
385
390
|
});
|
|
386
391
|
}
|
|
387
392
|
export function sourceGranularReplaySubRows(rows, minMs, maxMs) {
|
|
@@ -400,16 +405,27 @@ export function replaySubSourceIntervalMs(buffer, chartIntervalMs) {
|
|
|
400
405
|
: sourceIntervalMsForLabel(replayResolutionSourceLabel(buffer.tf, chartIntervalMs));
|
|
401
406
|
return requestIntervalMs ?? replayResolutionMs(buffer.tf, chartIntervalMs);
|
|
402
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* The newest sub-row stamp playable at `targetMs`: every sub row stamped at or before it may show, none after it.
|
|
410
|
+
* A tick row is a point-in-time event, playable at its own stamp. A bar-lane row is start-stamped and covers
|
|
411
|
+
* [stamp, stamp + source interval): it plays once its last millisecond (stamp + interval - 1, the stamp an irregular
|
|
412
|
+
* timeline steps on, see playableRowsForBuffer) is at or before the target. Played at its open, it showed a whole
|
|
413
|
+
* sub-bar of future price. The one rule for every sub-row reader: the forming candle a seek and the replay bar read,
|
|
414
|
+
* the candle coverage check, and the replay clock's fold.
|
|
415
|
+
*/
|
|
416
|
+
export function latestPlayableSubRowMs(buffer, chartIntervalMs, targetMs) {
|
|
417
|
+
return buffer.tf.kind === 'tick' ? targetMs : targetMs - replaySubSourceIntervalMs(buffer, chartIntervalMs) + 1;
|
|
418
|
+
}
|
|
403
419
|
/**
|
|
404
420
|
* Whether the sub rows already hold what the forming candle shows at the
|
|
405
421
|
* playhead: on the tick rail a row inside [this step, playhead] of the active
|
|
406
|
-
* chart bucket, on a bar lane a source row
|
|
422
|
+
* chart bucket, on a bar lane a source row playable inside it (latestPlayableSubRowMs).
|
|
407
423
|
* Runs every clock tick (the candle coverage check); sub rows stay sorted, so
|
|
408
424
|
* the first row at or past the earliest qualifying stamp decides instead of a
|
|
409
425
|
* scan of the whole rail, which on bar lanes is never shed and grows one batch
|
|
410
426
|
* per autoload.
|
|
411
427
|
*/
|
|
412
|
-
export function replaySubRowsHoldFormingRow(buffer, playheadMs, chartIntervalMs, stepMs
|
|
428
|
+
export function replaySubRowsHoldFormingRow(buffer, playheadMs, chartIntervalMs, stepMs) {
|
|
413
429
|
const subRows = buffer.subRows;
|
|
414
430
|
if (!subRows?.length)
|
|
415
431
|
return false;
|
|
@@ -422,6 +438,7 @@ export function replaySubRowsHoldFormingRow(buffer, playheadMs, chartIntervalMs,
|
|
|
422
438
|
const formingFromMs = tickRail
|
|
423
439
|
? Math.max(activeBucketStartMs, Math.floor(playheadMs / stepMs) * stepMs)
|
|
424
440
|
: activeBucketStartMs;
|
|
441
|
+
const playableToMs = latestPlayableSubRowMs(buffer, chartIntervalMs, playheadMs);
|
|
425
442
|
// The first row the grid books to the active bar (a fall-back night interleaves other bars' rows).
|
|
426
443
|
const barOf = replayBarKeyReader(chartIntervalMs, venue);
|
|
427
444
|
for (let index = sortedLowerBound(subRows, formingFromMs, (row) => row[0]); index < subRows.length; index++) {
|
|
@@ -431,7 +448,7 @@ export function replaySubRowsHoldFormingRow(buffer, playheadMs, chartIntervalMs,
|
|
|
431
448
|
const barMs = barOf(rowMs);
|
|
432
449
|
if (barMs !== activeBarMs && barMs !== null)
|
|
433
450
|
continue;
|
|
434
|
-
return
|
|
451
|
+
return rowMs <= playableToMs;
|
|
435
452
|
}
|
|
436
453
|
return false;
|
|
437
454
|
}
|
|
@@ -448,11 +465,9 @@ export function formingChartRowFromSubRows(buffer, chartIntervalMs, targetMs) {
|
|
|
448
465
|
if (bucketKeyMs === null)
|
|
449
466
|
return null;
|
|
450
467
|
const bucketOpenMs = replayBarOpenMs(bucketKeyMs, chartIntervalMs, venue);
|
|
451
|
-
// Tick rows are point-in-time events and retain their existing inclusive reveal semantics.
|
|
452
|
-
// Bar-lane source rows are start-stamped and become playable only after their source interval closes.
|
|
453
|
-
const completionOffsetMs = buffer.tf.kind === 'tick' ? 0 : replaySubSourceIntervalMs(buffer, chartIntervalMs);
|
|
454
468
|
const startIndex = sortedLowerBound(buffer.subRows, bucketOpenMs, (row) => row[0]);
|
|
455
|
-
const
|
|
469
|
+
const playableToMs = latestPlayableSubRowMs(buffer, chartIntervalMs, targetMs);
|
|
470
|
+
const endIndex = sortedPrefixEnd(buffer.subRows, playableToMs, (row) => row[0], true);
|
|
456
471
|
const barOf = replayBarKeyReader(chartIntervalMs, venue);
|
|
457
472
|
return foldRowsIntoBar(buffer.subRows.slice(startIndex, endIndex), bucketKeyMs, targetMs, (rowMs) => {
|
|
458
473
|
const barMs = barOf(rowMs);
|
|
@@ -527,7 +542,7 @@ export function playableRowsForBuffer(buffer, chartIntervalMs) {
|
|
|
527
542
|
// replayUsesSubRowRail already requires subRows; the local read only lets the compiler see it.
|
|
528
543
|
const subRows = buffer.subRows;
|
|
529
544
|
if (subRows !== undefined && replayUsesSubRowRail(buffer, chartIntervalMs)) {
|
|
530
|
-
const stepMs =
|
|
545
|
+
const stepMs = replaySubStepMs(buffer, chartIntervalMs);
|
|
531
546
|
const originMs = buffer.subOriginMs ?? chartBucketOriginMs(stepMs);
|
|
532
547
|
const memo = playableSubRowsMemo.get(buffer);
|
|
533
548
|
if (memo && memo.stepMs === stepMs && memo.originMs === originMs && replayRowsStampMatches(memo.source, subRows)) {
|
|
@@ -655,19 +670,20 @@ export function replayBarKeyMs(timestampMs, chartIntervalMs, venue) {
|
|
|
655
670
|
});
|
|
656
671
|
}
|
|
657
672
|
/**
|
|
658
|
-
* The OPEN of the bar keyed `barKeyMs`: its key, except a
|
|
659
|
-
* 00:00Z, which opens at the
|
|
673
|
+
* The OPEN of the bar keyed `barKeyMs`: its key, except a session-lattice trade-date bar (1d, 3d,
|
|
674
|
+
* 1w) keyed 00:00Z, which opens at the session open the evening before (`venueSessionLatticeBarOpenMs`:
|
|
675
|
+
* 17:00 Chicago on the CME family, 17:00 New York on forex).
|
|
660
676
|
*/
|
|
661
677
|
export function replayBarOpenMs(barKeyMs, chartIntervalMs, venue) {
|
|
662
|
-
if (venue &&
|
|
663
|
-
return
|
|
678
|
+
if (venue && venueSessionLatticeBucketMs(barKeyMs, chartIntervalMs, venue) === barKeyMs) {
|
|
679
|
+
return venueSessionLatticeBarOpenMs(barKeyMs, chartIntervalMs, venue) ?? barKeyMs;
|
|
664
680
|
}
|
|
665
681
|
return barKeyMs;
|
|
666
682
|
}
|
|
667
683
|
/**
|
|
668
684
|
* The END of the bar keyed `barKeyMs`, the instant it stops taking rows: its key plus the interval
|
|
669
|
-
* on the plain grid; the
|
|
670
|
-
*
|
|
685
|
+
* on the plain grid; the session lattice's own end (`venueSessionLatticeBarEndMs`: a 1d bar runs to
|
|
686
|
+
* the next session open, a fall-back Sunday's 4h bar an hour longer); a calendar bar's calendar end;
|
|
671
687
|
* and on a session grid the end of its last session (an RTH stub at the 20:15Z close, a stock's 3d
|
|
672
688
|
* bar at its third session's 16:00 close), walked once per bar on the quarter-hour probe.
|
|
673
689
|
*/
|
|
@@ -675,8 +691,8 @@ export function replayBarEndMs(barKeyMs, chartIntervalMs, venue) {
|
|
|
675
691
|
const nominalEndMs = barKeyMs + chartIntervalMs;
|
|
676
692
|
if (!venue)
|
|
677
693
|
return nominalEndMs;
|
|
678
|
-
if (
|
|
679
|
-
return
|
|
694
|
+
if (venueSessionLatticeBucketMs(barKeyMs, chartIntervalMs, venue) === barKeyMs) {
|
|
695
|
+
return venueSessionLatticeBarEndMs(barKeyMs, chartIntervalMs, venue) ?? nominalEndMs;
|
|
680
696
|
}
|
|
681
697
|
if (calendarMonthsOfMs(chartIntervalMs) !== null)
|
|
682
698
|
return barEndMs(barKeyMs, chartIntervalMs);
|
|
@@ -818,12 +834,8 @@ export function loadedBarsForRows(buffer, chartIntervalMs) {
|
|
|
818
834
|
return Math.min(rawLoadedBars, maxLoadedBars);
|
|
819
835
|
}
|
|
820
836
|
const tfMs = replayResolutionMs(buffer.tf, chartIntervalMs);
|
|
821
|
-
const
|
|
822
|
-
const
|
|
823
|
-
const ts = row[0];
|
|
824
|
-
return typeof ts === 'number' && ts > max ? ts : max;
|
|
825
|
-
}, buffer.anchorMs);
|
|
826
|
-
const rawLoadedBars = Math.max(0, Math.floor((maxTs - buffer.anchorMs) / tfMs));
|
|
837
|
+
const playedMs = Math.max(buffer.anchorMs, playableRowsEndMs(buffer, chartIntervalMs));
|
|
838
|
+
const rawLoadedBars = Math.max(0, Math.floor((playedMs - buffer.anchorMs) / tfMs));
|
|
827
839
|
return Math.min(rawLoadedBars, maxLoadedBars);
|
|
828
840
|
}
|
|
829
841
|
export function encodedHeatmapColumn(time, source) {
|
|
@@ -863,17 +875,35 @@ export function downsampleHeatmapColumns(columns, stepMs, minMs = -Infinity, max
|
|
|
863
875
|
}
|
|
864
876
|
return Array.from(byBucket.values()).sort((a, b) => a[1] - b[1]);
|
|
865
877
|
}
|
|
866
|
-
/**
|
|
878
|
+
/**
|
|
879
|
+
* The instant the newest playable row after the anchor has played (-Infinity when none), memoized per buffer like
|
|
880
|
+
* the rows it scans. A chart row and a tick-rail step play at their stamp. A bar-lane rail runs on whole steps of
|
|
881
|
+
* its source rows: the newest source row has played at its close (stamp + source interval, latestPlayableSubRowMs),
|
|
882
|
+
* and the runway ends at the last step that close covers whole. A step holding only some of its source rows (a 10m
|
|
883
|
+
* step whose second 5m row has not loaded) stays outside, so playback stops at its open and the forward load starts
|
|
884
|
+
* there and fills it.
|
|
885
|
+
*/
|
|
867
886
|
function playableRowsEndMs(buffer, chartIntervalMs) {
|
|
868
887
|
const rows = playableRowsForBuffer(buffer, chartIntervalMs);
|
|
869
888
|
const memo = playableEndMemo.get(buffer);
|
|
870
889
|
if (memo && memo.anchorMs === buffer.anchorMs && replayRowsStampMatches(memo.source, rows)) {
|
|
871
890
|
return memo.endMs;
|
|
872
891
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
892
|
+
let endMs;
|
|
893
|
+
const subRows = buffer.subRows;
|
|
894
|
+
if (subRows !== undefined && replayUsesSubRowRail(buffer, chartIntervalMs) && buffer.tf.kind !== 'tick') {
|
|
895
|
+
const newestSourceMs = subRows.reduce((max, row) => (Number.isFinite(row[0]) && row[0] > max ? row[0] : max), Number.NEGATIVE_INFINITY);
|
|
896
|
+
const stepMs = replaySubStepMs(buffer, chartIntervalMs);
|
|
897
|
+
const playedMs = newestSourceMs + replaySubSourceIntervalMs(buffer, chartIntervalMs);
|
|
898
|
+
const wholeSteps = Math.floor((playedMs - buffer.anchorMs) / stepMs);
|
|
899
|
+
endMs = wholeSteps > 0 ? buffer.anchorMs + wholeSteps * stepMs : Number.NEGATIVE_INFINITY;
|
|
900
|
+
}
|
|
901
|
+
else {
|
|
902
|
+
endMs = rows.reduce((max, row) => {
|
|
903
|
+
const ts = row[0];
|
|
904
|
+
return typeof ts === 'number' && ts > buffer.anchorMs && ts > max ? ts : max;
|
|
905
|
+
}, Number.NEGATIVE_INFINITY);
|
|
906
|
+
}
|
|
877
907
|
playableEndMemo.set(buffer, { source: replayRowsStamp(rows), anchorMs: buffer.anchorMs, endMs });
|
|
878
908
|
return endMs;
|
|
879
909
|
}
|
|
@@ -30,15 +30,19 @@ type SlotSubscribeParams = 'brotliV2' | null;
|
|
|
30
30
|
* keeps the liveness verdict and the token push; the worker only pings a
|
|
31
31
|
* socket nothing has written to for a while, so the gateway's 60 s read
|
|
32
32
|
* deadline (WEBSOCKET_READ_DEADLINE) never cuts an idle background tab.
|
|
33
|
+
* `feedIdlePing`: the crypto feed trio, whose main-thread loop (liveFeedService)
|
|
34
|
+
* keeps the liveness verdict; the worker only pings a socket nothing has
|
|
35
|
+
* written to for a while, so the feed's 60 s read deadline never cuts a tab
|
|
36
|
+
* whose page timers are throttled.
|
|
33
37
|
*/
|
|
34
|
-
export type SlotWorkerKeepalive = 'alertPing' | 'gatePing' | 'readerIdlePing' | null;
|
|
38
|
+
export type SlotWorkerKeepalive = 'alertPing' | 'gatePing' | 'readerIdlePing' | 'feedIdlePing' | null;
|
|
35
39
|
/**
|
|
36
40
|
* Keepalive loops the MAIN THREAD owns, named by their service. The one property
|
|
37
41
|
* with no runtime reader by design — the loops live in the services, so there is
|
|
38
42
|
* nothing to look up; the table-shape spec asserts every connectable slot names
|
|
39
43
|
* an owner instead.
|
|
40
44
|
*/
|
|
41
|
-
type SlotMainThreadKeepalive = 'v2PingPong' | 'liveFeedService' |
|
|
45
|
+
type SlotMainThreadKeepalive = 'v2PingPong' | 'liveFeedService' | null;
|
|
42
46
|
/** The gate base URLs, two per plane (contract C1: tier is a path over these, not a new env var). */
|
|
43
47
|
type SlotUrlKey = 'CME_V2_WEB_SOCKET' | 'CME_LIVE_FEED_URL' | 'OPRA_V2_WEB_SOCKET' | 'OPRA_LIVE_FEED_URL' | 'STOCKS_V2_WEB_SOCKET' | 'STOCKS_LIVE_FEED_URL' | 'BLK_V2_WEB_SOCKET' | 'BLK_LIVE_FEED_URL' | null;
|
|
44
48
|
type SlotPathPrefix = '/live/' | '/delayed/' | '';
|
|
@@ -78,7 +82,7 @@ export declare const SOCKET_SLOTS: {
|
|
|
78
82
|
readonly auth: "frame";
|
|
79
83
|
readonly sendsTierFrame: false;
|
|
80
84
|
readonly subscribeParams: "brotliV2";
|
|
81
|
-
readonly workerKeepalive:
|
|
85
|
+
readonly workerKeepalive: "feedIdlePing";
|
|
82
86
|
readonly mainThreadKeepalive: "liveFeedService";
|
|
83
87
|
readonly parkingSlot: "pendingCloseLiveFeed";
|
|
84
88
|
readonly urlKey: null;
|
|
@@ -93,7 +97,7 @@ export declare const SOCKET_SLOTS: {
|
|
|
93
97
|
readonly auth: "frame";
|
|
94
98
|
readonly sendsTierFrame: false;
|
|
95
99
|
readonly subscribeParams: "brotliV2";
|
|
96
|
-
readonly workerKeepalive:
|
|
100
|
+
readonly workerKeepalive: "feedIdlePing";
|
|
97
101
|
readonly mainThreadKeepalive: "liveFeedService";
|
|
98
102
|
readonly parkingSlot: "pendingCloseLiveFeedOrderbook";
|
|
99
103
|
readonly urlKey: null;
|
|
@@ -108,7 +112,7 @@ export declare const SOCKET_SLOTS: {
|
|
|
108
112
|
readonly auth: "frame";
|
|
109
113
|
readonly sendsTierFrame: false;
|
|
110
114
|
readonly subscribeParams: "brotliV2";
|
|
111
|
-
readonly workerKeepalive:
|
|
115
|
+
readonly workerKeepalive: "feedIdlePing";
|
|
112
116
|
readonly mainThreadKeepalive: "liveFeedService";
|
|
113
117
|
readonly parkingSlot: "pendingCloseLiveFeedInCluster";
|
|
114
118
|
readonly urlKey: null;
|
|
@@ -198,7 +202,7 @@ export declare const SOCKET_SLOTS: {
|
|
|
198
202
|
readonly auth: "none";
|
|
199
203
|
readonly sendsTierFrame: false;
|
|
200
204
|
readonly subscribeParams: null;
|
|
201
|
-
readonly workerKeepalive:
|
|
205
|
+
readonly workerKeepalive: "readerIdlePing";
|
|
202
206
|
readonly mainThreadKeepalive: "v2PingPong";
|
|
203
207
|
readonly parkingSlot: null;
|
|
204
208
|
readonly urlKey: "BLK_V2_WEB_SOCKET";
|
|
@@ -454,7 +458,7 @@ export declare const SOCKET_SLOTS: {
|
|
|
454
458
|
readonly sendsTierFrame: false;
|
|
455
459
|
readonly subscribeParams: null;
|
|
456
460
|
readonly workerKeepalive: "alertPing";
|
|
457
|
-
readonly mainThreadKeepalive:
|
|
461
|
+
readonly mainThreadKeepalive: null;
|
|
458
462
|
readonly parkingSlot: null;
|
|
459
463
|
readonly urlKey: null;
|
|
460
464
|
readonly pathPrefix: "";
|
|
@@ -29,7 +29,7 @@ export const SOCKET_SLOTS = {
|
|
|
29
29
|
auth: 'frame',
|
|
30
30
|
sendsTierFrame: false,
|
|
31
31
|
subscribeParams: 'brotliV2',
|
|
32
|
-
workerKeepalive:
|
|
32
|
+
workerKeepalive: 'feedIdlePing',
|
|
33
33
|
mainThreadKeepalive: 'liveFeedService',
|
|
34
34
|
parkingSlot: 'pendingCloseLiveFeed',
|
|
35
35
|
urlKey: null,
|
|
@@ -44,7 +44,7 @@ export const SOCKET_SLOTS = {
|
|
|
44
44
|
auth: 'frame',
|
|
45
45
|
sendsTierFrame: false,
|
|
46
46
|
subscribeParams: 'brotliV2',
|
|
47
|
-
workerKeepalive:
|
|
47
|
+
workerKeepalive: 'feedIdlePing',
|
|
48
48
|
mainThreadKeepalive: 'liveFeedService',
|
|
49
49
|
parkingSlot: 'pendingCloseLiveFeedOrderbook',
|
|
50
50
|
urlKey: null,
|
|
@@ -59,7 +59,7 @@ export const SOCKET_SLOTS = {
|
|
|
59
59
|
auth: 'frame',
|
|
60
60
|
sendsTierFrame: false,
|
|
61
61
|
subscribeParams: 'brotliV2',
|
|
62
|
-
workerKeepalive:
|
|
62
|
+
workerKeepalive: 'feedIdlePing',
|
|
63
63
|
mainThreadKeepalive: 'liveFeedService',
|
|
64
64
|
parkingSlot: 'pendingCloseLiveFeedInCluster',
|
|
65
65
|
urlKey: null,
|
|
@@ -155,7 +155,7 @@ export const SOCKET_SLOTS = {
|
|
|
155
155
|
auth: 'none',
|
|
156
156
|
sendsTierFrame: false,
|
|
157
157
|
subscribeParams: null,
|
|
158
|
-
workerKeepalive:
|
|
158
|
+
workerKeepalive: 'readerIdlePing',
|
|
159
159
|
mainThreadKeepalive: 'v2PingPong',
|
|
160
160
|
parkingSlot: null,
|
|
161
161
|
urlKey: 'BLK_V2_WEB_SOCKET',
|
|
@@ -421,8 +421,9 @@ export const SOCKET_SLOTS = {
|
|
|
421
421
|
auth: 'frame',
|
|
422
422
|
sendsTierFrame: false,
|
|
423
423
|
subscribeParams: null,
|
|
424
|
+
// The worker's alertPing is the socket's one ping and one liveness verdict (alerts-socket-4).
|
|
424
425
|
workerKeepalive: 'alertPing',
|
|
425
|
-
mainThreadKeepalive:
|
|
426
|
+
mainThreadKeepalive: null,
|
|
426
427
|
parkingSlot: null,
|
|
427
428
|
urlKey: null,
|
|
428
429
|
pathPrefix: '',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangecharts/wrun-chart-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "The wrun chart-host layer shared by the kiyotaka web app and the mobile app: the wrun result reader and painter model, cut from the web app (its reference implementation).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -22,23 +22,23 @@
|
|
|
22
22
|
"default": "./dist/*.js"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "node scripts/generate-tool-tables.mjs && rm -rf dist && tsc -p tsconfig.build.json && node scripts/esm-dist.mjs dist",
|
|
27
|
+
"consumer-check": "node scripts/consumer-check.mjs",
|
|
28
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
29
|
+
},
|
|
25
30
|
"peerDependencies": {
|
|
26
|
-
"@orangecharts/indicator-kit": "0.
|
|
27
|
-
"@orangecharts/orange-v2-pb-common": "12.
|
|
31
|
+
"@orangecharts/indicator-kit": "0.116.1",
|
|
32
|
+
"@orangecharts/orange-v2-pb-common": "12.80.0",
|
|
28
33
|
"dayjs": "1.11.23",
|
|
29
34
|
"lodash-es": "4.18.1"
|
|
30
35
|
},
|
|
31
36
|
"devDependencies": {
|
|
32
|
-
"@orangecharts/indicator-kit": "0.
|
|
33
|
-
"@orangecharts/orange-v2-pb-common": "12.
|
|
37
|
+
"@orangecharts/indicator-kit": "0.116.1",
|
|
38
|
+
"@orangecharts/orange-v2-pb-common": "12.80.0",
|
|
34
39
|
"@types/lodash-es": "4.17.12",
|
|
35
40
|
"dayjs": "1.11.23",
|
|
36
41
|
"lodash-es": "4.18.1",
|
|
37
42
|
"typescript": "5.9.3"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "node scripts/generate-tool-tables.mjs && rm -rf dist && tsc -p tsconfig.build.json && node scripts/esm-dist.mjs dist",
|
|
41
|
-
"consumer-check": "node scripts/consumer-check.mjs",
|
|
42
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
43
43
|
}
|
|
44
|
-
}
|
|
44
|
+
}
|