@orangecharts/wrun-chart-host 0.11.1 → 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 +17 -0
- package/dist/index.js +18 -0
- package/dist/indicators/controls/tpo-session.util.d.ts +52 -12
- package/dist/indicators/controls/tpo-session.util.js +113 -16
- 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/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-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 +7 -3
- 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 +5 -5
|
@@ -0,0 +1,341 @@
|
|
|
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 { footprintFoldBucketEndMs, getRthWindowForSymbol, hasRthWindow, isChartRthActive, isIntradayIntervalMs, isRthSessionHoursActive, isWithinRthWindow, latestRthSessionBoundsAtOrBefore, rthAnchoredBucketEndMs, rthAnchoredBucketStartMs, rthBucketOverlapsSessionMs, rthSessionCloseMs, rthSessionOpenMs, rthWindowsInRange, sessionDayBoundsFor, } from './rth-session.util.js';
|
|
29
|
+
import { isEquityRegularSessionGated, US_EQUITIES_REGULAR_WINDOW, usEquityRegularWindowsInRange, } from './us-equities-session.util.js';
|
|
30
|
+
import { checkIsPolygon } from './marketKind.util.js';
|
|
31
|
+
import { isStocksTapeGoverned } from '../v2/stocks-governed.util.js';
|
|
32
|
+
// ─── Markets and their regular session ───────────────────────────────────────
|
|
33
|
+
/**
|
|
34
|
+
* A US stock market: a Polygon listing code (marketKind.util `checkIsPolygon`: POLYGON, US_STOCKS, NYSE, NASDAQ,
|
|
35
|
+
* CBOE) or a stocks tape code (stocks-governed.util `isStocksTapeGoverned`: NYSE_TAPE, NYSE_ARCA_TAPE,
|
|
36
|
+
* NASDAQ_TAPE). Case-insensitive; false for anything that is not a string.
|
|
37
|
+
*/
|
|
38
|
+
export function isUsEquityMarket(exchange) {
|
|
39
|
+
if (typeof exchange !== 'string')
|
|
40
|
+
return false;
|
|
41
|
+
return checkIsPolygon(exchange) || isStocksTapeGoverned(exchange);
|
|
42
|
+
}
|
|
43
|
+
// One-entry memo: the per-row and per-frame callers (the CVD sub-row walk, the live gates) ask about one market at a
|
|
44
|
+
// time, so the hot path pays a pair of compares, not the root regex and the venue sets on every row. Pure inputs:
|
|
45
|
+
// the answer depends only on the two values (anything that is not a string answers null).
|
|
46
|
+
let memoExchange;
|
|
47
|
+
let memoSymbol;
|
|
48
|
+
let memoKind = null;
|
|
49
|
+
let memoReady = false;
|
|
50
|
+
/**
|
|
51
|
+
* The regular session a market has: 'cme' exactly when rth-session.util `hasRthWindow(symbol, exchange)` (a
|
|
52
|
+
* CME-governed venue and a mapped futures root), 'us-equity' when `isUsEquityMarket(exchange)`, else null. The two
|
|
53
|
+
* venue sets are disjoint.
|
|
54
|
+
*/
|
|
55
|
+
export function marketSessionKind(exchange, symbol) {
|
|
56
|
+
if (memoReady && exchange === memoExchange && symbol === memoSymbol)
|
|
57
|
+
return memoKind;
|
|
58
|
+
const kind = hasRthWindow(symbol, exchange)
|
|
59
|
+
? 'cme'
|
|
60
|
+
: isUsEquityMarket(exchange)
|
|
61
|
+
? 'us-equity'
|
|
62
|
+
: null;
|
|
63
|
+
memoExchange = exchange;
|
|
64
|
+
memoSymbol = symbol;
|
|
65
|
+
memoKind = kind;
|
|
66
|
+
memoReady = true;
|
|
67
|
+
return kind;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The market's regular window: the root's own window on CME (`getRthWindowForSymbol`, under the `hasRthWindow`
|
|
71
|
+
* gate), `US_EQUITIES_REGULAR_WINDOW` on a US stock, else null.
|
|
72
|
+
*/
|
|
73
|
+
export function marketRegularWindow(exchange, symbol) {
|
|
74
|
+
switch (marketSessionKind(exchange, symbol)) {
|
|
75
|
+
case 'cme':
|
|
76
|
+
return getRthWindowForSymbol(symbol);
|
|
77
|
+
case 'us-equity':
|
|
78
|
+
return US_EQUITIES_REGULAR_WINDOW;
|
|
79
|
+
default:
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export function marketHasRegularWindow(exchange, symbol) {
|
|
84
|
+
return marketSessionKind(exchange, symbol) !== null;
|
|
85
|
+
}
|
|
86
|
+
// ─── The chart's session and an overlay's ────────────────────────────────────
|
|
87
|
+
/**
|
|
88
|
+
* The regular session THIS chart draws at `chartTfMs` (milliseconds), for overlay purposes; intraday only:
|
|
89
|
+
* 'cme' exactly when rth-session.util `isChartRthActive(exchange, symbol, sessionType, chartTfMs)`.
|
|
90
|
+
* 'us-equity' when the candles' own gate holds, us-equities-session.util
|
|
91
|
+
* `isEquityRegularSessionGated(exchange, sessionType, chartTfMs)` (a Polygon listing whose word is not
|
|
92
|
+
* an active 'extended'), at an intraday `chartTfMs`. A chart opened on a tape venue (NASDAQ_TAPE) has
|
|
93
|
+
* no candle session handling, so it answers null, as it rides today.
|
|
94
|
+
* null otherwise: an ETH or extended chart, a daily or longer interval, a label instead of milliseconds.
|
|
95
|
+
*/
|
|
96
|
+
export function chartRegularSessionKind(exchange, symbol, sessionType, chartTfMs) {
|
|
97
|
+
if (isChartRthActive(exchange, symbol, sessionType, chartTfMs))
|
|
98
|
+
return 'cme';
|
|
99
|
+
if (isIntradayIntervalMs(chartTfMs) && isEquityRegularSessionGated(exchange, sessionType, chartTfMs)) {
|
|
100
|
+
return 'us-equity';
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The chart's regular session as a cache-key settings bag carries it (cache-key-guard.util `indicatorCacheSettings`):
|
|
106
|
+
* its `chartRegularKind`, else the CME-only `chartRthActive` flag the bag always carried (true reads 'cme'), so a bag
|
|
107
|
+
* without the kind keys every CME overlay as before; else null. Key builders read the TARGET chart's session from the
|
|
108
|
+
* bag, never the focused cell. The one reader: the footprint, profile and order-flow keys must never disagree on it.
|
|
109
|
+
*/
|
|
110
|
+
export function chartRegularKindFromCacheBag(
|
|
111
|
+
// Any settings bag: a control's typed settings shape intersected with a record (CVD's) shares no declared key.
|
|
112
|
+
bag) {
|
|
113
|
+
const kind = bag?.chartRegularKind;
|
|
114
|
+
if (kind === 'cme' || kind === 'us-equity')
|
|
115
|
+
return kind;
|
|
116
|
+
return bag?.chartRthActive === true ? 'cme' : null;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Whether an overlay's session filter is ACTIVE on a chart whose regular session is `chartRegularKind`
|
|
120
|
+
* (`chartRegularSessionKind` of the chart). The overlay's own market decides the rule:
|
|
121
|
+
* CME exactly rth-session.util `isRthSessionHoursActive(settings, chartTfMs, chartRegularKind === 'cme')`:
|
|
122
|
+
* an explicit 'rth' stays active on any chart (a stock, crypto or ETH chart included), 'eth' never
|
|
123
|
+
* is, and the 'chart' default follows a CME RTH chart only.
|
|
124
|
+
* US stock active exactly while the chart draws the US equities regular session at an intraday `chartTfMs`.
|
|
125
|
+
* Stock overlays always follow the chart: their session row is hidden, so a persisted 'rth' or 'eth'
|
|
126
|
+
* carried over from a futures chart is ignored.
|
|
127
|
+
* any other never active (no window to filter on).
|
|
128
|
+
*/
|
|
129
|
+
export function isMarketSessionHoursActive(settings, chartTfMs, chartRegularKind) {
|
|
130
|
+
if (!settings)
|
|
131
|
+
return false;
|
|
132
|
+
switch (marketSessionKind(settings.exchange, settings.symbol)) {
|
|
133
|
+
case 'cme':
|
|
134
|
+
return isRthSessionHoursActive(settings, chartTfMs, chartRegularKind === 'cme');
|
|
135
|
+
case 'us-equity':
|
|
136
|
+
return chartRegularKind === 'us-equity' && isIntradayIntervalMs(chartTfMs);
|
|
137
|
+
default:
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// ─── Window ops ──────────────────────────────────────────────────────────────
|
|
142
|
+
//
|
|
143
|
+
// Each op answers the named rth-session helper's own answer on a CME market, the US equities window on a stock
|
|
144
|
+
// (Saturday and Sunday out of session), and the helper's no-window answer on any other market.
|
|
145
|
+
/** 1 Monday to 5 Friday: the weekday cycle ny-calendar.util reads (no holiday calendar). */
|
|
146
|
+
function isWeekday(day) {
|
|
147
|
+
return day.weekday >= 1 && day.weekday <= 5;
|
|
148
|
+
}
|
|
149
|
+
/** The weekday holding `tsMs` on the equities window, or null on Saturday, Sunday and for a non-finite instant. */
|
|
150
|
+
function equityTradeDayAt(tsMs) {
|
|
151
|
+
const day = sessionDayBoundsFor(US_EQUITIES_REGULAR_WINDOW, tsMs);
|
|
152
|
+
return day !== null && isWeekday(day) ? day : null;
|
|
153
|
+
}
|
|
154
|
+
/** The equities session holding `tsMs` in `[open, close)`, or null outside every session. */
|
|
155
|
+
function equitySessionAt(tsMs) {
|
|
156
|
+
const day = equityTradeDayAt(tsMs);
|
|
157
|
+
return day !== null && tsMs >= day.openMs && tsMs < day.closeMs ? day : null;
|
|
158
|
+
}
|
|
159
|
+
function isValidBucket(bucketStartMs, tfMs) {
|
|
160
|
+
return Number.isFinite(bucketStartMs) && Number.isFinite(tfMs) && tfMs > 0;
|
|
161
|
+
}
|
|
162
|
+
function equityAnchoredBucketEndMs(bucketStartMs, tfMs) {
|
|
163
|
+
if (!isValidBucket(bucketStartMs, tfMs))
|
|
164
|
+
return null;
|
|
165
|
+
const session = equitySessionAt(bucketStartMs);
|
|
166
|
+
return session === null ? null : Math.min(bucketStartMs + tfMs, session.closeMs);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* `isWithinRthWindow`: whether `tsMs` sits in the market's `[open, close)` session. Fails OPEN with no window (a
|
|
170
|
+
* market without a regular session keeps every row), false for a non-finite instant on a market with one.
|
|
171
|
+
*/
|
|
172
|
+
export function isWithinMarketRegularWindow(exchange, symbol, tsMs) {
|
|
173
|
+
switch (marketSessionKind(exchange, symbol)) {
|
|
174
|
+
case 'cme':
|
|
175
|
+
return isWithinRthWindow(symbol, tsMs);
|
|
176
|
+
case 'us-equity': {
|
|
177
|
+
if (!Number.isFinite(tsMs))
|
|
178
|
+
return false;
|
|
179
|
+
const day = sessionDayBoundsFor(US_EQUITIES_REGULAR_WINDOW, tsMs);
|
|
180
|
+
// A zone the runtime rejects fails open, as the CME helper does.
|
|
181
|
+
if (day === null)
|
|
182
|
+
return true;
|
|
183
|
+
return isWeekday(day) && tsMs >= day.openMs && tsMs < day.closeMs;
|
|
184
|
+
}
|
|
185
|
+
default:
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* `rthSessionOpenMs`: the open of the session holding `tsMs`, null outside it. Null for EVERY instant on a market
|
|
191
|
+
* without a window, so a caller gates on `marketHasRegularWindow` before reading null as "out of session".
|
|
192
|
+
*/
|
|
193
|
+
export function marketSessionOpenMs(exchange, symbol, tsMs) {
|
|
194
|
+
switch (marketSessionKind(exchange, symbol)) {
|
|
195
|
+
case 'cme':
|
|
196
|
+
return rthSessionOpenMs(symbol, tsMs);
|
|
197
|
+
case 'us-equity':
|
|
198
|
+
return equitySessionAt(tsMs)?.openMs ?? null;
|
|
199
|
+
default:
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/** `rthSessionCloseMs`: the EXCLUSIVE close of the session holding `tsMs`; the open's null contract. */
|
|
204
|
+
export function marketSessionCloseMs(exchange, symbol, tsMs) {
|
|
205
|
+
switch (marketSessionKind(exchange, symbol)) {
|
|
206
|
+
case 'cme':
|
|
207
|
+
return rthSessionCloseMs(symbol, tsMs);
|
|
208
|
+
case 'us-equity':
|
|
209
|
+
return equitySessionAt(tsMs)?.closeMs ?? null;
|
|
210
|
+
default:
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* `rthBucketOverlapsSessionMs`: whether `[bucketStartMs, bucketStartMs + tfMs)` overlaps the session of the day
|
|
216
|
+
* holding its start or its last ms (a UTC-grid bucket holding the open or the close carries in-session rows although
|
|
217
|
+
* its start sits outside). False with no window or invalid inputs.
|
|
218
|
+
*/
|
|
219
|
+
export function marketBucketOverlapsSession(exchange, symbol, bucketStartMs, tfMs) {
|
|
220
|
+
switch (marketSessionKind(exchange, symbol)) {
|
|
221
|
+
case 'cme':
|
|
222
|
+
return rthBucketOverlapsSessionMs(symbol, bucketStartMs, tfMs);
|
|
223
|
+
case 'us-equity': {
|
|
224
|
+
if (!isValidBucket(bucketStartMs, tfMs))
|
|
225
|
+
return false;
|
|
226
|
+
const bucketEndMs = bucketStartMs + tfMs;
|
|
227
|
+
for (const probe of [bucketStartMs, bucketEndMs - 1]) {
|
|
228
|
+
const day = equityTradeDayAt(probe);
|
|
229
|
+
if (day !== null && bucketStartMs < day.closeMs && bucketEndMs > day.openMs)
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
default:
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* `rthAnchoredBucketStartMs`: the session-anchored bucket holding `tsMs`, `open + n * tfMs` (the grid the gateway
|
|
240
|
+
* serves REGULAR bars on above 30m: 13:30Z hourly bars in EDT). Null with no window, invalid inputs, or `tsMs` out
|
|
241
|
+
* of session (live callers drop such a frame). On a stock it equals us-equities-session.util
|
|
242
|
+
* `usEquityAnchoredBucketStartMs`.
|
|
243
|
+
*/
|
|
244
|
+
export function marketAnchoredBucketStartMs(exchange, symbol, tsMs, tfMs) {
|
|
245
|
+
switch (marketSessionKind(exchange, symbol)) {
|
|
246
|
+
case 'cme':
|
|
247
|
+
return rthAnchoredBucketStartMs(symbol, tsMs, tfMs);
|
|
248
|
+
case 'us-equity': {
|
|
249
|
+
if (!isValidBucket(tsMs, tfMs))
|
|
250
|
+
return null;
|
|
251
|
+
const session = equitySessionAt(tsMs);
|
|
252
|
+
return session === null ? null : session.openMs + Math.floor((tsMs - session.openMs) / tfMs) * tfMs;
|
|
253
|
+
}
|
|
254
|
+
default:
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* `rthAnchoredBucketEndMs`: the EXCLUSIVE end of the anchored bucket starting at `bucketStartMs`,
|
|
260
|
+
* `min(start + tfMs, session close)` (a stock's 15:30 hourly bucket ends at 16:00). Null mirrors the start.
|
|
261
|
+
*/
|
|
262
|
+
export function marketAnchoredBucketEndMs(exchange, symbol, bucketStartMs, tfMs) {
|
|
263
|
+
switch (marketSessionKind(exchange, symbol)) {
|
|
264
|
+
case 'cme':
|
|
265
|
+
return rthAnchoredBucketEndMs(symbol, bucketStartMs, tfMs);
|
|
266
|
+
case 'us-equity':
|
|
267
|
+
return equityAnchoredBucketEndMs(bucketStartMs, tfMs);
|
|
268
|
+
default:
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* `footprintFoldBucketEndMs`: the instant a folded bucket stops changing. 'anchored' is the anchored end; 'eth'
|
|
274
|
+
* (the market's own full-session grid) is `start + tfMs` capped at the close of the session it holds. With no window,
|
|
275
|
+
* 'anchored' is null and 'eth' the nominal end.
|
|
276
|
+
*/
|
|
277
|
+
export function marketFoldBucketEndMs(exchange, symbol, bucketStartMs, tfMs, bucketMode) {
|
|
278
|
+
switch (marketSessionKind(exchange, symbol)) {
|
|
279
|
+
case 'cme':
|
|
280
|
+
return footprintFoldBucketEndMs(symbol, bucketStartMs, tfMs, bucketMode);
|
|
281
|
+
case 'us-equity': {
|
|
282
|
+
if (bucketMode === 'anchored')
|
|
283
|
+
return equityAnchoredBucketEndMs(bucketStartMs, tfMs);
|
|
284
|
+
if (!isValidBucket(bucketStartMs, tfMs))
|
|
285
|
+
return null;
|
|
286
|
+
const nominalEndMs = bucketStartMs + tfMs;
|
|
287
|
+
const closeMs = equitySessionAt(bucketStartMs)?.closeMs ?? equitySessionAt(nominalEndMs - 1)?.closeMs ?? null;
|
|
288
|
+
return closeMs !== null ? Math.min(nominalEndMs, closeMs) : nominalEndMs;
|
|
289
|
+
}
|
|
290
|
+
default:
|
|
291
|
+
if (bucketMode === 'anchored' || !isValidBucket(bucketStartMs, tfMs))
|
|
292
|
+
return null;
|
|
293
|
+
return bucketStartMs + tfMs;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/** Calendar days a session pick walks back: a week, the bound the CME pick reads. */
|
|
297
|
+
const LATEST_SESSION_LOOKBACK_DAYS = 7;
|
|
298
|
+
/**
|
|
299
|
+
* `latestRthSessionBoundsAtOrBefore`: the most recent session whose OPEN is at or before `tsMs`, in session or not
|
|
300
|
+
* (a session-anchored profile shows the last session outside trading hours). CME names CME trade dates only; a stock
|
|
301
|
+
* names the most recent WEEKDAY session (a Saturday or a Monday pre-open names Friday's), with no holiday calendar:
|
|
302
|
+
* a caller picking a session to draw skips one that holds no candles. Null with no window or a non-finite instant.
|
|
303
|
+
*/
|
|
304
|
+
export function latestMarketSessionBoundsAtOrBefore(exchange, symbol, tsMs) {
|
|
305
|
+
switch (marketSessionKind(exchange, symbol)) {
|
|
306
|
+
case 'cme':
|
|
307
|
+
return latestRthSessionBoundsAtOrBefore(symbol, tsMs);
|
|
308
|
+
case 'us-equity': {
|
|
309
|
+
if (!Number.isFinite(tsMs))
|
|
310
|
+
return null;
|
|
311
|
+
let cursorMs = tsMs;
|
|
312
|
+
for (let day = 0; day <= LATEST_SESSION_LOOKBACK_DAYS; day += 1) {
|
|
313
|
+
const bounds = sessionDayBoundsFor(US_EQUITIES_REGULAR_WINDOW, cursorMs);
|
|
314
|
+
if (bounds === null)
|
|
315
|
+
return null;
|
|
316
|
+
if (bounds.openMs <= tsMs && isWeekday(bounds))
|
|
317
|
+
return { openMs: bounds.openMs, closeMs: bounds.closeMs };
|
|
318
|
+
cursorMs = bounds.dayStartMs - 1;
|
|
319
|
+
}
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
default:
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* `rthWindowsInRange` / us-equities-session.util `usEquityRegularWindowsInRange`: every venue-local calendar day's
|
|
328
|
+
* `[open, close)` window touching `[fromMs, toMs]`, in order. Calendar-based on both markets: Saturday and Sunday
|
|
329
|
+
* windows are listed too, harmless for consumers that shade or reset on BARS (none trade then) and wrong for one that
|
|
330
|
+
* counts windows as trading days. Empty with no window.
|
|
331
|
+
*/
|
|
332
|
+
export function marketWindowsInRange(exchange, symbol, fromMs, toMs) {
|
|
333
|
+
switch (marketSessionKind(exchange, symbol)) {
|
|
334
|
+
case 'cme':
|
|
335
|
+
return rthWindowsInRange(symbol, fromMs, toMs);
|
|
336
|
+
case 'us-equity':
|
|
337
|
+
return usEquityRegularWindowsInRange(fromMs, toMs);
|
|
338
|
+
default:
|
|
339
|
+
return [];
|
|
340
|
+
}
|
|
341
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PanelTableCell, SetPanelData } from '../../interfaces/om-panel-data.interface.js';
|
|
2
2
|
import type { WrunPanelSeriesStyle, WrunPanelStyle } from '../../interfaces/wrun-runtime.interface.js';
|
|
3
|
+
import { type DisplayOffset } from './display-offset.leaf.js';
|
|
3
4
|
import { type PanelSeriesStyleWord, type PanelStyleWord } from './om-panel-push-style.util.js';
|
|
4
5
|
import type { WrunPanelTranslateContext } from '../wrun/wrun-panel-style.util.js';
|
|
5
6
|
import { type WrunColorTheme, type WrunNumberFormatSpec } from '../wrun/wrun-style-words.util.js';
|
|
@@ -131,9 +132,10 @@ export declare function engineTableCell(cell: ParsedPanel['rows'][number][number
|
|
|
131
132
|
export declare function withoutEmptyTableColumns(frame: ParsedPanel): ParsedPanel;
|
|
132
133
|
/** Labels for a time-keyed curve or bars panel, as short as the key set
|
|
133
134
|
* allows: clock times inside one day, dates for day-aligned keys, a year
|
|
134
|
-
* only past a year. `
|
|
135
|
-
*
|
|
136
|
-
|
|
135
|
+
* only past a year. `offset` is the chart's display-timezone shift (SC37),
|
|
136
|
+
* fixed or per instant: each label prints its key's own wall time (the key
|
|
137
|
+
* plus the offset at that key), UTC fields. */
|
|
138
|
+
export declare function panelTimeLabels(keys: readonly number[], offset?: DisplayOffset): string[];
|
|
137
139
|
/** Domain keys and presentation strings never enter the engine's numeric axes.
|
|
138
140
|
* The panel title stays on the overlay name (the pane's legend pill); the
|
|
139
141
|
* engine's in-canvas chrome title would print it a second time over that pill.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { displayWallMs } from './display-offset.leaf.js';
|
|
1
2
|
import { MAX_PANES } from './om-series.util.js';
|
|
2
3
|
import { invalidPanelStyleWord, invalidSeriesStyleWord, PANEL_SERIES_STYLE_WORDS, PANEL_STYLE_WORDS, } from './om-panel-push-style.util.js';
|
|
3
4
|
import { parseWrunColor } from '../wrun/wrun-color-facts.util.js';
|
|
@@ -546,12 +547,13 @@ export function withoutEmptyTableColumns(frame) {
|
|
|
546
547
|
const pad2 = (value) => String(value).padStart(2, '0');
|
|
547
548
|
/** Labels for a time-keyed curve or bars panel, as short as the key set
|
|
548
549
|
* allows: clock times inside one day, dates for day-aligned keys, a year
|
|
549
|
-
* only past a year. `
|
|
550
|
-
*
|
|
551
|
-
|
|
550
|
+
* only past a year. `offset` is the chart's display-timezone shift (SC37),
|
|
551
|
+
* fixed or per instant: each label prints its key's own wall time (the key
|
|
552
|
+
* plus the offset at that key), UTC fields. */
|
|
553
|
+
export function panelTimeLabels(keys, offset = 0) {
|
|
552
554
|
if (keys.length === 0)
|
|
553
555
|
return [];
|
|
554
|
-
const stamps = keys.map((key) => (
|
|
556
|
+
const stamps = keys.map((key) => displayWallMs(offset, timeKeyMs(key)));
|
|
555
557
|
let min = Infinity;
|
|
556
558
|
let max = -Infinity;
|
|
557
559
|
for (const stamp of stamps) {
|
|
@@ -575,6 +577,37 @@ export function panelTimeLabels(keys, offsetMs = 0) {
|
|
|
575
577
|
function timeKeyMs(key) {
|
|
576
578
|
return key < 1e11 ? key * 1000 : key;
|
|
577
579
|
}
|
|
580
|
+
/** A wall time as titan's curve titles a time x (its hover card, a marker's show_value: `formatCurveTime`, titan
|
|
581
|
+
* src/renderers/domainPanes/curveLayout.ts): `YYYY-MM-DD HH:MM`, UTC fields. */
|
|
582
|
+
function curveTimeTitle(wallMs) {
|
|
583
|
+
const date = new Date(wallMs);
|
|
584
|
+
const day = `${date.getUTCFullYear()}-${pad2(date.getUTCMonth() + 1)}-${pad2(date.getUTCDate())}`;
|
|
585
|
+
return `${day} ${pad2(date.getUTCHours())}:${pad2(date.getUTCMinutes())}`;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* The rich time curve's clock (SC37). Its x stays each key's instant, so points are spaced by true time: wall-time x
|
|
589
|
+
* folds the hour a fall change repeats (two passes over one stretch, the second unreachable by the hover) and opens an
|
|
590
|
+
* empty hour at a spring change. Titan's curve prints its ticks and its hover titles with ONE shift
|
|
591
|
+
* (`xTimeOffsetMs`): the offset at the newest key, right for every key while the keys hold no clock change. A key
|
|
592
|
+
* whose own offset differs (the far side of a change) is titled at its own offset (`xValueLabels`, the exact-x titles
|
|
593
|
+
* the hover card and a marker's show_value read first); the ticks over that side keep the newest key's clock until
|
|
594
|
+
* titan's curve takes a shift per instant (docs/features/chart/time-axis-clock.md, "A rich time-x curve pane").
|
|
595
|
+
*/
|
|
596
|
+
function timeCurveClock(instants, offset) {
|
|
597
|
+
if (typeof offset === 'number')
|
|
598
|
+
return { xTimeOffsetMs: offset };
|
|
599
|
+
const newest = instants[instants.length - 1];
|
|
600
|
+
if (newest === undefined)
|
|
601
|
+
return { xTimeOffsetMs: 0 };
|
|
602
|
+
const shiftMs = offset(newest);
|
|
603
|
+
let titles;
|
|
604
|
+
for (const ms of instants) {
|
|
605
|
+
const own = offset(ms);
|
|
606
|
+
if (own !== shiftMs)
|
|
607
|
+
(titles ??= {})[String(ms)] = curveTimeTitle(ms + own);
|
|
608
|
+
}
|
|
609
|
+
return titles === undefined ? { xTimeOffsetMs: shiftMs } : { xTimeOffsetMs: shiftMs, xValueLabels: titles };
|
|
610
|
+
}
|
|
578
611
|
/** A bars value cell's number (a styled cell's `value`). */
|
|
579
612
|
function barCellValue(cell) {
|
|
580
613
|
return isRecord(cell) ? cell.value : cell;
|
|
@@ -676,13 +709,15 @@ export function translatePanelToEngine(frame, ctx = {}) {
|
|
|
676
709
|
if (effective !== 'box') {
|
|
677
710
|
// The rich curve (every chrome but box, the hairlines default too)
|
|
678
711
|
// spaces points by their time (gaps stay gaps) and labels the axis
|
|
679
|
-
// in the chart's display timezone (SC37)
|
|
680
|
-
|
|
712
|
+
// in the chart's display timezone (SC37): each x is its key's
|
|
713
|
+
// instant, and the clock rides the settings (timeCurveClock).
|
|
714
|
+
const instants = sorted.map((row) => timeKeyMs(row[0]));
|
|
715
|
+
panelRows = sorted.map((row, index) => [instants[index], ...row.slice(1)]);
|
|
681
716
|
settings = {
|
|
682
717
|
series,
|
|
683
718
|
...optional('stacked'),
|
|
684
719
|
xFormat: 'time',
|
|
685
|
-
|
|
720
|
+
...timeCurveClock(instants, ctx.timezoneOffsetMs ?? 0),
|
|
686
721
|
fontFamily,
|
|
687
722
|
...chromeStyle,
|
|
688
723
|
};
|
|
@@ -4,8 +4,21 @@ export type OmTargetMetadata = {
|
|
|
4
4
|
symbol?: unknown;
|
|
5
5
|
exchange?: unknown;
|
|
6
6
|
} | null | undefined;
|
|
7
|
+
export type OmTarget = {
|
|
8
|
+
kind: 'series';
|
|
9
|
+
id: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'panel';
|
|
12
|
+
id: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'feed';
|
|
15
|
+
address: string;
|
|
16
|
+
column: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function parseOmTarget(metadata: OmTargetMetadata): OmTarget | null;
|
|
19
|
+
export declare function omTargetSymbol(target: OmTarget): string;
|
|
7
20
|
export declare function isOmTargetSymbol(symbol: unknown): symbol is string;
|
|
8
21
|
export declare function isOmTargetPane(metadata: OmTargetMetadata): boolean;
|
|
9
|
-
export declare function omTargetKind(metadata: OmTargetMetadata): '
|
|
22
|
+
export declare function omTargetKind(metadata: OmTargetMetadata): OmTarget['kind'] | null;
|
|
10
23
|
/** Only daemon cadences are legal, even when another chart interval exists. */
|
|
11
24
|
export declare function cadenceToInterval(cadenceSeconds: unknown): string | null;
|
|
@@ -2,16 +2,33 @@ import { Intervals } from '../../constants/interval.constants.js';
|
|
|
2
2
|
import { intervalLabelForMs } from './interval-ladder.util.js';
|
|
3
3
|
export const TARGET_EXCHANGE = 'OM';
|
|
4
4
|
export const OM_MAIN_CADENCES = [60, 300, 900, 1800, 3600, 14400, 86400, 604800];
|
|
5
|
+
const FEED_TARGET_SYMBOL = /^feed:(@[a-z0-9_-]+\/[a-z0-9][a-z0-9._-]{0,63})(?:#([^\s#]+))?$/;
|
|
6
|
+
function parseOmTargetSymbol(symbol) {
|
|
7
|
+
if (typeof symbol !== 'string')
|
|
8
|
+
return null;
|
|
9
|
+
if (symbol.startsWith('series:'))
|
|
10
|
+
return { kind: 'series', id: symbol.slice('series:'.length) };
|
|
11
|
+
if (symbol.startsWith('panel:'))
|
|
12
|
+
return { kind: 'panel', id: symbol.slice('panel:'.length) };
|
|
13
|
+
const feed = FEED_TARGET_SYMBOL.exec(symbol);
|
|
14
|
+
return feed ? { kind: 'feed', address: feed[1], column: feed[2] ?? '' } : null;
|
|
15
|
+
}
|
|
16
|
+
export function parseOmTarget(metadata) {
|
|
17
|
+
return metadata?.exchange === TARGET_EXCHANGE ? parseOmTargetSymbol(metadata?.symbol) : null;
|
|
18
|
+
}
|
|
19
|
+
export function omTargetSymbol(target) {
|
|
20
|
+
if (target.kind === 'feed')
|
|
21
|
+
return target.column ? `feed:${target.address}#${target.column}` : `feed:${target.address}`;
|
|
22
|
+
return `${target.kind}:${target.id}`;
|
|
23
|
+
}
|
|
5
24
|
export function isOmTargetSymbol(symbol) {
|
|
6
|
-
return
|
|
25
|
+
return parseOmTargetSymbol(symbol) !== null;
|
|
7
26
|
}
|
|
8
27
|
export function isOmTargetPane(metadata) {
|
|
9
|
-
return metadata
|
|
28
|
+
return parseOmTarget(metadata) !== null;
|
|
10
29
|
}
|
|
11
30
|
export function omTargetKind(metadata) {
|
|
12
|
-
|
|
13
|
-
return null;
|
|
14
|
-
return metadata.symbol.startsWith('series:') ? 'series' : 'panel';
|
|
31
|
+
return parseOmTarget(metadata)?.kind ?? null;
|
|
15
32
|
}
|
|
16
33
|
/** Only daemon cadences are legal, even when another chart interval exists. */
|
|
17
34
|
export function cadenceToInterval(cadenceSeconds) {
|
|
@@ -8,18 +8,33 @@
|
|
|
8
8
|
* and row lanes' plan context. Who may read is all it answers: the tier a read rides is the viewer's,
|
|
9
9
|
* decided by the gate per socket, never by this answer.
|
|
10
10
|
*
|
|
11
|
+
* Every CME option chain door reads `mayReadCmeChain` the same way: one that reads `official` alone walls a study.
|
|
12
|
+
* Every CME pin judge reads `mayReadCmePin` (the data wall's own answer, on any chart): a judge taking its verdict
|
|
13
|
+
* without the run's facts refuses a pin the data wall would serve.
|
|
14
|
+
*
|
|
11
15
|
* A LEAF on purpose (no imports): the poll-lane and row-lane planners sit on the row builder's import
|
|
12
16
|
* graph, and the venue policy is worker-safe; both read this without reaching each other.
|
|
13
17
|
*/
|
|
14
|
-
/** The
|
|
18
|
+
/** The facts the plane decisions read, as a run's head holds them: absent reads false (fail closed). */
|
|
15
19
|
export interface OpraReadFacts {
|
|
16
20
|
/** A first-party run (an OpenMarket package: `isOfficialWrunOverlay`; any first-party kScript run). */
|
|
17
21
|
official?: boolean;
|
|
18
22
|
/** A browser user run the `opra-user-scripts` flag opened the OPRA plane to (`isOpraUserScriptRun`). */
|
|
19
23
|
opraUserScripts?: boolean;
|
|
24
|
+
/** A CME chart study (kscript-venue-policy.util `isCmeChartStudyRun`): it reads CME option chains. */
|
|
25
|
+
cmeStudyChain?: boolean;
|
|
26
|
+
/** The `cme-user-scripts` gate opened the CME plane to this browser run, on any chart (`isCmeUserScriptRun`). */
|
|
27
|
+
cmeUserScripts?: boolean;
|
|
20
28
|
}
|
|
29
|
+
/** The facts whole, each absent one read false: the one copy the planners and the run head hand on. */
|
|
30
|
+
export declare function planeReadFactsOf(facts: OpraReadFacts | null | undefined): Required<OpraReadFacts>;
|
|
21
31
|
/** May the run the facts describe read the OPRA plane. */
|
|
22
32
|
export declare function mayReadOpra(facts: OpraReadFacts | null | undefined): boolean;
|
|
33
|
+
/** May the run read a CME option chain: off a CME chart a user run holds no CME mark or authorisation token. */
|
|
34
|
+
export declare function mayReadCmeChain(facts: OpraReadFacts | null | undefined): boolean;
|
|
35
|
+
/** May the run read a CME market it pins, on any chart: the data wall's own answer (`isCmeReadableKScriptRun`). Chains
|
|
36
|
+
* stay chart-keyed (`mayReadCmeChain`). */
|
|
37
|
+
export declare function mayReadCmePin(facts: OpraReadFacts | null | undefined): boolean;
|
|
23
38
|
/** The payload field a source ask carries when it reads the OPRA plane beyond its own exchange (a wrun lane
|
|
24
39
|
* asking a stock chart's options on the native-rows path: its `exchange` is the stock's placeholder). Door C
|
|
25
40
|
* judges such an ask as an OPRA one. */
|
|
@@ -8,13 +8,35 @@
|
|
|
8
8
|
* and row lanes' plan context. Who may read is all it answers: the tier a read rides is the viewer's,
|
|
9
9
|
* decided by the gate per socket, never by this answer.
|
|
10
10
|
*
|
|
11
|
+
* Every CME option chain door reads `mayReadCmeChain` the same way: one that reads `official` alone walls a study.
|
|
12
|
+
* Every CME pin judge reads `mayReadCmePin` (the data wall's own answer, on any chart): a judge taking its verdict
|
|
13
|
+
* without the run's facts refuses a pin the data wall would serve.
|
|
14
|
+
*
|
|
11
15
|
* A LEAF on purpose (no imports): the poll-lane and row-lane planners sit on the row builder's import
|
|
12
16
|
* graph, and the venue policy is worker-safe; both read this without reaching each other.
|
|
13
17
|
*/
|
|
18
|
+
/** The facts whole, each absent one read false: the one copy the planners and the run head hand on. */
|
|
19
|
+
export function planeReadFactsOf(facts) {
|
|
20
|
+
return {
|
|
21
|
+
official: facts?.official === true,
|
|
22
|
+
opraUserScripts: facts?.opraUserScripts === true,
|
|
23
|
+
cmeStudyChain: facts?.cmeStudyChain === true,
|
|
24
|
+
cmeUserScripts: facts?.cmeUserScripts === true,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
14
27
|
/** May the run the facts describe read the OPRA plane. */
|
|
15
28
|
export function mayReadOpra(facts) {
|
|
16
29
|
return facts?.official === true || facts?.opraUserScripts === true;
|
|
17
30
|
}
|
|
31
|
+
/** May the run read a CME option chain: off a CME chart a user run holds no CME mark or authorisation token. */
|
|
32
|
+
export function mayReadCmeChain(facts) {
|
|
33
|
+
return facts?.official === true || facts?.cmeStudyChain === true;
|
|
34
|
+
}
|
|
35
|
+
/** May the run read a CME market it pins, on any chart: the data wall's own answer (`isCmeReadableKScriptRun`). Chains
|
|
36
|
+
* stay chart-keyed (`mayReadCmeChain`). */
|
|
37
|
+
export function mayReadCmePin(facts) {
|
|
38
|
+
return facts?.official === true || facts?.cmeUserScripts === true;
|
|
39
|
+
}
|
|
18
40
|
/** The payload field a source ask carries when it reads the OPRA plane beyond its own exchange (a wrun lane
|
|
19
41
|
* asking a stock chart's options on the native-rows path: its `exchange` is the stock's placeholder). Door C
|
|
20
42
|
* judges such an ask as an OPRA one. */
|