@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.
Files changed (311) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/feature-flags.constants.d.ts +3 -4
  3. package/dist/constants/feature-flags.constants.js +34 -52
  4. package/dist/constants/feature-limits.constants.d.ts +1 -1
  5. package/dist/constants/feature-limits.constants.js +5 -4
  6. package/dist/constants/interval.constants.d.ts +7 -0
  7. package/dist/constants/interval.constants.js +7 -0
  8. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +20 -149
  9. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +20 -309
  10. package/dist/constants/stocks-compliance.constants.d.ts +15 -0
  11. package/dist/constants/stocks-compliance.constants.js +15 -0
  12. package/dist/host-env.d.ts +55 -3
  13. package/dist/host-env.js +6 -0
  14. package/dist/host-ports.types.d.ts +36 -3
  15. package/dist/index.d.ts +18 -0
  16. package/dist/index.js +19 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +78 -15
  18. package/dist/indicators/controls/tpo-session.util.js +320 -242
  19. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +6 -0
  20. package/dist/instances/script-engine-worker-ohlcv-transfer.js +16 -0
  21. package/dist/interfaces/cme-realtime.interface.d.ts +8 -0
  22. package/dist/interfaces/cme-realtime.interface.js +2 -1
  23. package/dist/interfaces/feed.interface.d.ts +15 -1
  24. package/dist/interfaces/replay.interface.d.ts +5 -0
  25. package/dist/interfaces/stocks-realtime.interface.d.ts +4 -3
  26. package/dist/interfaces/stocks-realtime.interface.js +5 -4
  27. package/dist/interfaces/wrun-runtime.interface.d.ts +97 -19
  28. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +17 -0
  29. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +22 -0
  30. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +46 -40
  31. package/dist/kscript-data/controls/live-trades-merge.util.js +80 -107
  32. package/dist/market-data/billing.interface.d.ts +9 -1
  33. package/dist/market-data/venue.d.ts +1 -1
  34. package/dist/market-data/venues/index.d.ts +4 -4
  35. package/dist/market-data/venues/stocks.contract.copy.json +4 -4
  36. package/dist/market-data/venues/stocks.d.ts +4 -4
  37. package/dist/market-data/venues/stocks.js +15 -13
  38. package/dist/settings-templates/frvp-fields.d.ts +12 -1
  39. package/dist/settings-templates/frvp-fields.js +15 -4
  40. package/dist/settings-templates/index.js +12 -5
  41. package/dist/settings-templates/indicator-fields.js +28 -2
  42. package/dist/settings-templates/tool-rules.d.ts +17 -8
  43. package/dist/settings-templates/tool-rules.js +15 -8
  44. package/dist/settings-templates/tool-tables.generated.js +4 -2
  45. package/dist/utility/auth/server-clock.util.d.ts +3 -1
  46. package/dist/utility/auth/server-clock.util.js +3 -1
  47. package/dist/utility/chart/book-live-bucket.util.js +2 -2
  48. package/dist/utility/chart/cache-alignment.util.d.ts +15 -7
  49. package/dist/utility/chart/cache-alignment.util.js +14 -7
  50. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +2 -0
  51. package/dist/utility/chart/chart-data-fetch-generation.util.js +16 -0
  52. package/dist/utility/chart/cme-session-bucket.util.d.ts +18 -75
  53. package/dist/utility/chart/cme-session-bucket.util.js +25 -332
  54. package/dist/utility/chart/continuous-contracts.util.js +6 -5
  55. package/dist/utility/chart/display-offset.leaf.d.ts +24 -0
  56. package/dist/utility/chart/display-offset.leaf.js +41 -0
  57. package/dist/utility/chart/effective-chart-session.util.d.ts +2 -1
  58. package/dist/utility/chart/effective-chart-session.util.js +13 -5
  59. package/dist/utility/chart/feed-interval.util.d.ts +6 -20
  60. package/dist/utility/chart/feed-interval.util.js +13 -22
  61. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +27 -7
  62. package/dist/utility/chart/fetch-dedupe-policy.util.js +86 -11
  63. package/dist/utility/chart/host-bar-placement.util.d.ts +7 -4
  64. package/dist/utility/chart/host-bar-placement.util.js +8 -2
  65. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +32 -0
  66. package/dist/utility/chart/indicator-inflight-registry.util.js +52 -0
  67. package/dist/utility/chart/indicator-run-interval.util.d.ts +10 -4
  68. package/dist/utility/chart/indicator-run-interval.util.js +21 -12
  69. package/dist/utility/chart/interval-registry.util.d.ts +1 -1
  70. package/dist/utility/chart/interval-registry.util.js +1 -1
  71. package/dist/utility/chart/kscript-legend-entries.util.d.ts +12 -0
  72. package/dist/utility/chart/kscript-legend-entries.util.js +16 -0
  73. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +1 -1
  74. package/dist/utility/chart/kscript-run-interval-projection.util.js +4 -2
  75. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -62
  76. package/dist/utility/chart/kscript-venue-policy.util.js +85 -94
  77. package/dist/utility/chart/live-bucket.util.d.ts +39 -17
  78. package/dist/utility/chart/live-bucket.util.js +103 -57
  79. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +58 -20
  80. package/dist/utility/chart/local-kscript-source-revalidation.util.js +98 -23
  81. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +35 -11
  82. package/dist/utility/chart/local-kscript-warmup-depth.util.js +24 -3
  83. package/dist/utility/chart/market-session-schedule.util.d.ts +8 -0
  84. package/dist/utility/chart/market-session-schedule.util.js +39 -1
  85. package/dist/utility/chart/market-session.util.d.ts +136 -0
  86. package/dist/utility/chart/market-session.util.js +341 -0
  87. package/dist/utility/chart/market-sessions.util.d.ts +83 -0
  88. package/dist/utility/chart/market-sessions.util.js +220 -0
  89. package/dist/utility/chart/om-panel.util.d.ts +5 -3
  90. package/dist/utility/chart/om-panel.util.js +42 -7
  91. package/dist/utility/chart/om-target.util.d.ts +14 -1
  92. package/dist/utility/chart/om-target.util.js +22 -5
  93. package/dist/utility/chart/opra-read-access.leaf.d.ts +16 -1
  94. package/dist/utility/chart/opra-read-access.leaf.js +22 -0
  95. package/dist/utility/chart/profile-row-height.util.d.ts +49 -16
  96. package/dist/utility/chart/profile-row-height.util.js +74 -37
  97. package/dist/utility/chart/rth-session.util.d.ts +55 -20
  98. package/dist/utility/chart/rth-session.util.js +94 -46
  99. package/dist/utility/chart/session-interval.util.d.ts +2 -1
  100. package/dist/utility/chart/session-interval.util.js +1 -3
  101. package/dist/utility/chart/session-lattice.util.d.ts +150 -0
  102. package/dist/utility/chart/session-lattice.util.js +488 -0
  103. package/dist/utility/chart/trading-day.util.d.ts +40 -2
  104. package/dist/utility/chart/trading-day.util.js +84 -7
  105. package/dist/utility/chart/us-equities-session.util.d.ts +32 -11
  106. package/dist/utility/chart/us-equities-session.util.js +44 -15
  107. package/dist/utility/chart/window-geometry.leaf.d.ts +28 -7
  108. package/dist/utility/chart/window-geometry.leaf.js +57 -8
  109. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +21 -14
  110. package/dist/utility/chart/wrun-bar-session-facts.util.js +32 -38
  111. package/dist/utility/chart/wrun-run-result.util.d.ts +29 -12
  112. package/dist/utility/chart/wrun-run-result.util.js +89 -25
  113. package/dist/utility/common/time.util.js +5 -4
  114. package/dist/utility/market-events/earnings-scope.util.d.ts +10 -5
  115. package/dist/utility/market-events/earnings-scope.util.js +17 -9
  116. package/dist/utility/market-events/market-events.util.d.ts +14 -7
  117. package/dist/utility/market-events/market-events.util.js +30 -17
  118. package/dist/utility/number-format.util.d.ts +14 -21
  119. package/dist/utility/number-format.util.js +38 -24
  120. package/dist/utility/options/option-venue-disclosure.util.d.ts +40 -6
  121. package/dist/utility/options/option-venue-disclosure.util.js +71 -11
  122. package/dist/utility/options/option-venue.util.d.ts +1 -1
  123. package/dist/utility/options/option-venue.util.js +1 -1
  124. package/dist/utility/pool-symbol.leaf.d.ts +7 -0
  125. package/dist/utility/pool-symbol.leaf.js +50 -5
  126. package/dist/utility/stocks/stock-display.util.d.ts +15 -0
  127. package/dist/utility/stocks/stock-display.util.js +37 -0
  128. package/dist/utility/symbol-selection/contract-expiry.util.js +5 -4
  129. package/dist/utility/v2/gate-plane.util.d.ts +6 -0
  130. package/dist/utility/v2/gate-plane.util.js +11 -1
  131. package/dist/utility/v2/gate-session-latch.util.d.ts +1 -1
  132. package/dist/utility/v2/gate-session-latch.util.js +3 -3
  133. package/dist/utility/v2/governed-tier.leaf.d.ts +17 -16
  134. package/dist/utility/v2/governed-tier.leaf.js +17 -16
  135. package/dist/utility/v2/stocks-governed.util.d.ts +5 -0
  136. package/dist/utility/v2/stocks-governed.util.js +14 -0
  137. package/dist/utility/v2/v2-enums.leaf.d.ts +13 -0
  138. package/dist/utility/v2/v2-enums.leaf.js +458 -0
  139. package/dist/utility/wrun/derived-roots.leaf.d.ts +21 -1
  140. package/dist/utility/wrun/derived-roots.leaf.js +27 -1
  141. package/dist/utility/wrun/derived-roots.util.d.ts +44 -32
  142. package/dist/utility/wrun/derived-roots.util.js +97 -56
  143. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -3
  144. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -3
  145. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +2 -1
  146. package/dist/utility/wrun/sources/lanes/option_daily.js +2 -1
  147. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +3 -0
  148. package/dist/utility/wrun/sources/lanes/options_flow.js +23 -5
  149. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -4
  150. package/dist/utility/wrun/sources/row-lane-registry.js +9 -4
  151. package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +19 -0
  152. package/dist/utility/wrun/sources/row-lanes/dark_pool.js +104 -0
  153. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  154. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.d.ts +20 -0
  155. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.js +103 -0
  156. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -2
  157. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +15 -13
  158. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +49 -23
  159. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +14 -9
  160. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +75 -27
  161. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +139 -82
  162. package/dist/utility/wrun/wrun-app-layer.leaf.d.ts +78 -0
  163. package/dist/utility/wrun/wrun-app-layer.leaf.js +89 -0
  164. package/dist/utility/wrun/wrun-bar-count.util.d.ts +11 -7
  165. package/dist/utility/wrun/wrun-bar-count.util.js +12 -8
  166. package/dist/utility/wrun/wrun-batched-kinds.leaf.d.ts +13 -0
  167. package/dist/utility/wrun/wrun-batched-kinds.leaf.js +18 -0
  168. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +41 -22
  169. package/dist/utility/wrun/wrun-batched-marks.util.js +255 -59
  170. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +26 -19
  171. package/dist/utility/wrun/wrun-batched-readout.util.js +81 -27
  172. package/dist/utility/wrun/wrun-book-bands.leaf.d.ts +8 -0
  173. package/dist/utility/wrun/wrun-book-bands.leaf.js +7 -0
  174. package/dist/utility/wrun/wrun-candle-equal.leaf.d.ts +19 -0
  175. package/dist/utility/wrun/wrun-candle-equal.leaf.js +40 -0
  176. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -2
  177. package/dist/utility/wrun/wrun-canvases.util.js +7 -3
  178. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +6 -3
  179. package/dist/utility/wrun/wrun-chart-context-names.util.js +8 -4
  180. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +47 -29
  181. package/dist/utility/wrun/wrun-chart-market-facts.util.js +201 -201
  182. package/dist/utility/wrun/wrun-child-overlay-id.util.js +2 -1
  183. package/dist/utility/wrun/wrun-cme-legs-note.util.d.ts +15 -0
  184. package/dist/utility/wrun/wrun-cme-legs-note.util.js +49 -0
  185. package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +38 -0
  186. package/dist/utility/wrun/wrun-cme-root-specs.util.js +81 -0
  187. package/dist/utility/wrun/wrun-coin-lane-live.util.js +3 -0
  188. package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -1
  189. package/dist/utility/wrun/wrun-color-settings.util.js +32 -7
  190. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +50 -0
  191. package/dist/utility/wrun/wrun-dark-pool.util.js +127 -0
  192. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +67 -12
  193. package/dist/utility/wrun/wrun-declared-warmup.util.js +165 -13
  194. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +18 -8
  195. package/dist/utility/wrun/wrun-draft-legend-note.util.js +57 -11
  196. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +14 -10
  197. package/dist/utility/wrun/wrun-draft-overlay.util.js +26 -14
  198. package/dist/utility/wrun/wrun-earnings-facts.util.js +3 -2
  199. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +2 -0
  200. package/dist/utility/wrun/wrun-etf-funds.util.js +4 -0
  201. package/dist/utility/wrun/wrun-held-lanes.util.js +8 -2
  202. package/dist/utility/wrun/wrun-history-as-of.util.d.ts +77 -0
  203. package/dist/utility/wrun/wrun-history-as-of.util.js +108 -0
  204. package/dist/utility/wrun/wrun-host.service.d.ts +64 -14
  205. package/dist/utility/wrun/wrun-host.service.js +137 -27
  206. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +3 -3
  207. package/dist/utility/wrun/wrun-hosted-wire-caps.js +12 -2
  208. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +13 -0
  209. package/dist/utility/wrun/wrun-inert-legend.util.js +31 -3
  210. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +7 -5
  211. package/dist/utility/wrun/wrun-input-requirements.leaf.js +16 -6
  212. package/dist/utility/wrun/wrun-install-pacer.util.d.ts +26 -0
  213. package/dist/utility/wrun/wrun-install-pacer.util.js +145 -0
  214. package/dist/utility/wrun/wrun-kit-refusal-stages.types.d.ts +22 -0
  215. package/dist/utility/wrun/wrun-kit-refusal-stages.types.js +1 -0
  216. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +12 -5
  217. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +23 -5
  218. package/dist/utility/wrun/wrun-lane-warmup.util.js +22 -4
  219. package/dist/utility/wrun/wrun-leg-close.util.d.ts +6 -5
  220. package/dist/utility/wrun/wrun-leg-close.util.js +11 -9
  221. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +3 -1
  222. package/dist/utility/wrun/wrun-leg-fetch.util.js +9 -2
  223. package/dist/utility/wrun/wrun-levels-child.util.d.ts +2 -0
  224. package/dist/utility/wrun/wrun-levels-child.util.js +6 -0
  225. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -0
  226. package/dist/utility/wrun/wrun-live-intake.util.d.ts +15 -6
  227. package/dist/utility/wrun/wrun-live-intake.util.js +167 -47
  228. package/dist/utility/wrun/wrun-live-tick.util.d.ts +52 -8
  229. package/dist/utility/wrun/wrun-live-tick.util.js +648 -97
  230. package/dist/utility/wrun/wrun-market-facts.util.d.ts +16 -2
  231. package/dist/utility/wrun/wrun-market-facts.util.js +32 -3
  232. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +27 -27
  233. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +28 -16
  234. package/dist/utility/wrun/wrun-market-size-defaults.util.js +34 -5
  235. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +10 -7
  236. package/dist/utility/wrun/wrun-oi-lane.util.js +16 -10
  237. package/dist/utility/wrun/wrun-option-strike-flow.util.js +1 -1
  238. package/dist/utility/wrun/wrun-option-views.util.d.ts +2 -2
  239. package/dist/utility/wrun/wrun-option-views.util.js +5 -2
  240. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.d.ts +5 -0
  241. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.js +16 -0
  242. package/dist/utility/wrun/wrun-options-stop.util.d.ts +3 -2
  243. package/dist/utility/wrun/wrun-options-stop.util.js +6 -4
  244. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +75 -11
  245. package/dist/utility/wrun/wrun-overlay-drivers.util.js +176 -43
  246. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +20 -10
  247. package/dist/utility/wrun/wrun-overlay-park.util.d.ts +84 -0
  248. package/dist/utility/wrun/wrun-overlay-park.util.js +135 -0
  249. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +37 -4
  250. package/dist/utility/wrun/wrun-overlay-recovery.util.js +26 -14
  251. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +239 -24
  252. package/dist/utility/wrun/wrun-overlay-run.util.js +2204 -405
  253. package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
  254. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +2 -1
  255. package/dist/utility/wrun/wrun-panel-mount.util.js +20 -14
  256. package/dist/utility/wrun/wrun-panel-style.util.d.ts +4 -2
  257. package/dist/utility/wrun/wrun-panel-style.util.js +3 -2
  258. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +7 -0
  259. package/dist/utility/wrun/wrun-pin-spelling.util.js +18 -4
  260. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +26 -17
  261. package/dist/utility/wrun/wrun-pin-venues.util.js +43 -36
  262. package/dist/utility/wrun/wrun-pinned-lanes.util.d.ts +58 -0
  263. package/dist/utility/wrun/wrun-pinned-lanes.util.js +72 -0
  264. package/dist/utility/wrun/wrun-prefix-cohort.util.js +2 -1
  265. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +22 -9
  266. package/dist/utility/wrun/wrun-prefix-lanes.util.js +145 -26
  267. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +29 -0
  268. package/dist/utility/wrun/wrun-prefix-proof.util.js +23 -5
  269. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +9 -1
  270. package/dist/utility/wrun/wrun-refusal-surface.util.js +15 -1
  271. package/dist/utility/wrun/wrun-refusal.util.d.ts +19 -1
  272. package/dist/utility/wrun/wrun-refusal.util.js +103 -16
  273. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +20 -6
  274. package/dist/utility/wrun/wrun-registry-errors.util.js +20 -6
  275. package/dist/utility/wrun/wrun-replay-rows.util.js +6 -10
  276. package/dist/utility/wrun/wrun-run-health.util.d.ts +89 -2
  277. package/dist/utility/wrun/wrun-run-health.util.js +204 -1
  278. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +2 -2
  279. package/dist/utility/wrun/wrun-run-interval-session.util.js +2 -2
  280. package/dist/utility/wrun/wrun-run-interval.util.d.ts +9 -8
  281. package/dist/utility/wrun/wrun-run-interval.util.js +13 -11
  282. package/dist/utility/wrun/wrun-sandbox-row-source.js +5 -2
  283. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +13 -3
  284. package/dist/utility/wrun/wrun-script-inputs.util.js +51 -13
  285. package/dist/utility/wrun/wrun-session-composition.util.d.ts +81 -0
  286. package/dist/utility/wrun/wrun-session-composition.util.js +169 -0
  287. package/dist/utility/wrun/wrun-setting-words.util.d.ts +10 -7
  288. package/dist/utility/wrun/wrun-setting-words.util.js +25 -7
  289. package/dist/utility/wrun/wrun-source-rows.util.d.ts +94 -28
  290. package/dist/utility/wrun/wrun-source-rows.util.js +738 -93
  291. package/dist/utility/wrun/wrun-stream-clock.util.d.ts +45 -0
  292. package/dist/utility/wrun/wrun-stream-clock.util.js +108 -0
  293. package/dist/utility/wrun/wrun-tape-coins.util.d.ts +116 -0
  294. package/dist/utility/wrun/wrun-tape-coins.util.js +110 -0
  295. package/dist/utility/wrun/wrun-tape-source.util.d.ts +62 -32
  296. package/dist/utility/wrun/wrun-tape-source.util.js +72 -34
  297. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +13 -5
  298. package/dist/utility/wrun/wrun-tier-grid.util.js +23 -13
  299. package/dist/utility/wrun/wrun-tpo-rows.util.js +2 -1
  300. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +73 -0
  301. package/dist/utility/wrun/wrun-trades-lane.util.js +82 -0
  302. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +5 -0
  303. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +9 -2
  304. package/dist/utility/wrun/wrun-visibility-table.d.ts +13 -0
  305. package/dist/utility/wrun/wrun-visibility-table.js +9 -0
  306. package/dist/utility/wrun/wrun-volume-profile.util.js +44 -32
  307. package/dist/utils/replay/replay-buffer-math.d.ts +16 -6
  308. package/dist/utils/replay/replay-buffer-math.js +60 -30
  309. package/dist/workers/constants/socket-slots.d.ts +11 -7
  310. package/dist/workers/constants/socket-slots.js +6 -5
  311. package/package.json +11 -11
@@ -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
+ }
@@ -0,0 +1,83 @@
1
+ /** A session's hours on its own clock. */
2
+ export interface MarketSessionWindow {
3
+ /** IANA zone the hours are written in. */
4
+ readonly timeZone: string;
5
+ /** Open, minutes after local midnight. */
6
+ readonly openMinutes: number;
7
+ /** Close, minutes after local midnight; at or below the open when the session crosses local midnight. */
8
+ readonly closeMinutes: number;
9
+ }
10
+ export type MarketSessionId = 'asia' | 'london' | 'newYork' | 'asiaFull' | 'londonFull' | 'newYorkFull';
11
+ export declare const MARKET_SESSIONS: Readonly<Record<MarketSessionId, MarketSessionWindow>>;
12
+ /** The window a stored session name means, or null for a name that is not a market session. */
13
+ export declare function marketSessionNamed(name: unknown): MarketSessionWindow | null;
14
+ /** The regions a session profile's Session dropdown stores (the Session VP family, Delta, the metric profiles). */
15
+ export declare const PROFILE_REGION_SESSION_TYPES: readonly ["US", "EU", "Asia"];
16
+ export type ProfileRegionSessionType = (typeof PROFILE_REGION_SESSION_TYPES)[number];
17
+ export declare function isProfileRegionSessionType(value: unknown): value is ProfileRegionSessionType;
18
+ /** The Session dropdown's day split (Session VP, Agg SVP): Asia, London, New York and after hours, a profile each. */
19
+ export declare const SESSION_SPLIT_TYPE = "Sessions";
20
+ export declare function isSessionSplitType(sessionType: unknown): boolean;
21
+ /** The longest chart bar the split draws on: a 1h bar straddles the 09:30 New York open. */
22
+ export declare const SESSION_SPLIT_MAX_CHART_MS: number;
23
+ export declare function isSessionSplitApplicable(chartIntervalMs: unknown): boolean;
24
+ /** A session type that brings its own hours (a region, the split): the Session start and Custom hours do not act. */
25
+ export declare function isMarketSessionType(sessionType: unknown): boolean;
26
+ /** A session profile's daily window as titan reads it (`customSessionWindow`): minutes after midnight on its zone. */
27
+ export interface SessionProfileDailyWindow {
28
+ timeZone: string;
29
+ startMinutes: number;
30
+ endMinutes: number;
31
+ }
32
+ /**
33
+ * A region's session profile keys: one profile a day inside the region's own window, which titan resolves on the
34
+ * region's clock each day. Null off the regions, and on a daily or longer chart, where a bar holds the whole session.
35
+ */
36
+ export declare function profileRegionSessionKeys(sessionType: unknown, chartIntervalMs: unknown): {
37
+ session: number;
38
+ customSessionWindow: SessionProfileDailyWindow;
39
+ } | null;
40
+ export type MarketSplitSliceId = 'asia' | 'london' | 'newYork' | 'afterHours';
41
+ export interface MarketSplitSlice {
42
+ readonly id: MarketSplitSliceId;
43
+ /** Start, minutes after midnight on the split's clock. */
44
+ readonly startMinutes: number;
45
+ /** End, minutes after midnight on the split's clock; below the start when the slice crosses midnight. */
46
+ readonly endMinutes: number;
47
+ }
48
+ export interface MarketSessionSplit {
49
+ /** The one IANA zone every slice is written in. */
50
+ readonly timeZone: string;
51
+ /** The slices in day order, each starting where the one before ends. */
52
+ readonly slices: readonly MarketSplitSlice[];
53
+ }
54
+ /**
55
+ * The day split into its sessions on ONE clock, New York, so the slices tile every day with no gap and no overlap
56
+ * whatever the clocks do: each slice ends where the next one opens. Asia opens with the CME Globex day at 18:00,
57
+ * London at 03:00 (08:00 in London, except in the weeks a year when the US and UK change clocks on different dates),
58
+ * New York at the 09:30 open, and after hours runs from the 16:00 close to the next Globex open. These are the
59
+ * America/New_York defaults of TradingView's "Three-Session Volume Profile" script. The London slice ends at the
60
+ * New York open, so it is shorter than the London session above.
61
+ */
62
+ export declare const MARKET_SESSION_SPLIT: MarketSessionSplit;
63
+ /** 'HH:MM' for minutes after local midnight: the clock text the wire and the dialogs use. */
64
+ export declare function sessionClockText(minutes: number): string;
65
+ /**
66
+ * The instant a window edge means on `timeZone`'s clock: the FIRST instant whose wall clock reads `wallMs` (a
67
+ * UTC-shaped epoch) or later. On an ordinary day that is the instant itself. A wall time that a fall-back change
68
+ * repeats is its first occurrence, and a wall time that a spring-forward change skips is the change itself: 02:30 New
69
+ * York on 2026-03-08 is 07:00Z, and 01:30 London on 2026-03-29 is 01:00Z. The gateway's local-minute filter reads a
70
+ * window the same way, so a session opens and closes where the served rows do. UTC reads as itself. NaN where the
71
+ * zone clock serves no reading.
72
+ */
73
+ export declare function zoneWallEdgeToUtcMs(timeZone: string, wallMs: number): number;
74
+ /**
75
+ * The session [open, close) as UTC instants on the local calendar day `localDayMs` (that day's midnight as a
76
+ * UTC-shaped epoch on the session's own clock). A close at or below the open lands on the next local day. Each edge
77
+ * is read on its own date with zoneWallEdgeToUtcMs, so a clock change moves the instant and keeps the wall hours, and
78
+ * an edge in a skipped or repeated hour lands where the gateway's filter puts it. NaN where the zone clock serves no
79
+ * reading.
80
+ */
81
+ export declare function marketSessionInstantsOn(session: MarketSessionWindow, localDayMs: number): readonly [number, number];
82
+ /** The [open, close) of the latest session opened at or before `tsMs` (forming or last closed); null if unreadable. */
83
+ export declare function marketSessionAtOrBefore(session: MarketSessionWindow, tsMs: number): readonly [number, number] | null;
@@ -0,0 +1,220 @@
1
+ /**
2
+ * The named trading sessions, written once. Every reader resolves a session's hours from here when it uses them and
3
+ * never keeps a copy: the Session Volume Profile family (Session VP, Aggregated Session VP, Delta, Open Interest and
4
+ * Liquidation profiles), TPO, Cumulative Returns by Session, session shading and wrun.
5
+ *
6
+ * Each session sits on its own city's clock (an IANA zone), so a name means the same hours in every indicator and
7
+ * daylight saving moves the session with its city. The mistake this ends: hours written as a fixed UTC window, or
8
+ * copied into another table or a saved setting, drift apart and ignore daylight saving. titan's fixed-UTC table put
9
+ * the US session at 08:30-15:00 New York every winter, and TPO's own table gave Asia, London and New York other
10
+ * hours again.
11
+ *
12
+ * Worker-safe: no Vue, store, i18n or dayjs imports.
13
+ */
14
+ import { zoneWallMsAt, zoneWallToUtcMs } from './ny-calendar.util.js';
15
+ const MINUTE_MS = 60_000;
16
+ const MINUTES_PER_DAY = 24 * 60;
17
+ const DAY_MS = MINUTES_PER_DAY * MINUTE_MS;
18
+ function sessionWindow(timeZone, openMinutes, closeMinutes) {
19
+ return Object.freeze({ timeZone, openMinutes, closeMinutes });
20
+ }
21
+ export const MARKET_SESSIONS = Object.freeze({
22
+ /** Asia: Tokyo hours with the pre-open, 08:00-15:00 Asia/Tokyo (23:00-06:00 UTC all year: Japan keeps no DST). */
23
+ asia: sessionWindow('Asia/Tokyo', 8 * 60, 15 * 60),
24
+ /** London: 08:00-16:00 Europe/London. */
25
+ london: sessionWindow('Europe/London', 8 * 60, 16 * 60),
26
+ /** New York: the cash session, 09:30-16:00 America/New_York. */
27
+ newYork: sessionWindow('America/New_York', 9 * 60 + 30, 16 * 60),
28
+ /** TPO's full Asia session, the forex Tokyo hours: 09:00-18:00 Asia/Tokyo. */
29
+ asiaFull: sessionWindow('Asia/Tokyo', 9 * 60, 18 * 60),
30
+ /** TPO's full London session, the forex London hours: 08:00-17:00 Europe/London. */
31
+ londonFull: sessionWindow('Europe/London', 8 * 60, 17 * 60),
32
+ /** TPO's full New York session, the forex New York hours: 08:00-17:00 America/New_York. */
33
+ newYorkFull: sessionWindow('America/New_York', 8 * 60, 17 * 60),
34
+ });
35
+ /**
36
+ * Every name a reader stores for a session, to its one window: the profiles' regions ('US', 'EU', 'Asia'),
37
+ * Cumulative Returns by Session's 'APAC', and TPO's trading-hour presets. A stored name stays as it was saved; only
38
+ * its hours come from here.
39
+ */
40
+ const SESSION_NAMES = Object.freeze({
41
+ US: 'newYork',
42
+ EU: 'london',
43
+ Asia: 'asia',
44
+ APAC: 'asia',
45
+ London: 'london',
46
+ 'New York': 'newYork',
47
+ 'Asia Full': 'asiaFull',
48
+ 'London Full': 'londonFull',
49
+ 'New York Full': 'newYorkFull',
50
+ });
51
+ /** The window a stored session name means, or null for a name that is not a market session. */
52
+ export function marketSessionNamed(name) {
53
+ if (typeof name !== 'string' || !Object.prototype.hasOwnProperty.call(SESSION_NAMES, name))
54
+ return null;
55
+ return MARKET_SESSIONS[SESSION_NAMES[name]];
56
+ }
57
+ /** The regions a session profile's Session dropdown stores (the Session VP family, Delta, the metric profiles). */
58
+ export const PROFILE_REGION_SESSION_TYPES = Object.freeze(['US', 'EU', 'Asia']);
59
+ export function isProfileRegionSessionType(value) {
60
+ return typeof value === 'string' && PROFILE_REGION_SESSION_TYPES.includes(value);
61
+ }
62
+ /** The Session dropdown's day split (Session VP, Agg SVP): Asia, London, New York and after hours, a profile each. */
63
+ export const SESSION_SPLIT_TYPE = 'Sessions';
64
+ export function isSessionSplitType(sessionType) {
65
+ return sessionType === SESSION_SPLIT_TYPE;
66
+ }
67
+ /** The longest chart bar the split draws on: a 1h bar straddles the 09:30 New York open. */
68
+ export const SESSION_SPLIT_MAX_CHART_MS = 30 * 60_000;
69
+ export function isSessionSplitApplicable(chartIntervalMs) {
70
+ return typeof chartIntervalMs === 'number' && chartIntervalMs > 0 && chartIntervalMs <= SESSION_SPLIT_MAX_CHART_MS;
71
+ }
72
+ /** A session type that brings its own hours (a region, the split): the Session start and Custom hours do not act. */
73
+ export function isMarketSessionType(sessionType) {
74
+ return isProfileRegionSessionType(sessionType) || isSessionSplitType(sessionType);
75
+ }
76
+ /**
77
+ * A region's session profile keys: one profile a day inside the region's own window, which titan resolves on the
78
+ * region's clock each day. Null off the regions, and on a daily or longer chart, where a bar holds the whole session.
79
+ */
80
+ export function profileRegionSessionKeys(sessionType, chartIntervalMs) {
81
+ if (!isProfileRegionSessionType(sessionType))
82
+ return null;
83
+ if (typeof chartIntervalMs !== 'number' || !(chartIntervalMs > 0) || chartIntervalMs >= DAY_MS)
84
+ return null;
85
+ const window = MARKET_SESSIONS[SESSION_NAMES[sessionType]];
86
+ return {
87
+ session: DAY_MS,
88
+ customSessionWindow: {
89
+ timeZone: window.timeZone,
90
+ startMinutes: window.openMinutes,
91
+ endMinutes: window.closeMinutes,
92
+ },
93
+ };
94
+ }
95
+ function splitSlice(id, startMinutes, endMinutes) {
96
+ return Object.freeze({ id, startMinutes, endMinutes });
97
+ }
98
+ /**
99
+ * The day split into its sessions on ONE clock, New York, so the slices tile every day with no gap and no overlap
100
+ * whatever the clocks do: each slice ends where the next one opens. Asia opens with the CME Globex day at 18:00,
101
+ * London at 03:00 (08:00 in London, except in the weeks a year when the US and UK change clocks on different dates),
102
+ * New York at the 09:30 open, and after hours runs from the 16:00 close to the next Globex open. These are the
103
+ * America/New_York defaults of TradingView's "Three-Session Volume Profile" script. The London slice ends at the
104
+ * New York open, so it is shorter than the London session above.
105
+ */
106
+ export const MARKET_SESSION_SPLIT = Object.freeze({
107
+ timeZone: 'America/New_York',
108
+ slices: Object.freeze([
109
+ splitSlice('asia', 18 * 60, 3 * 60),
110
+ splitSlice('london', 3 * 60, 9 * 60 + 30),
111
+ splitSlice('newYork', 9 * 60 + 30, 16 * 60),
112
+ splitSlice('afterHours', 16 * 60, 18 * 60),
113
+ ]),
114
+ });
115
+ /** 'HH:MM' for minutes after local midnight: the clock text the wire and the dialogs use. */
116
+ export function sessionClockText(minutes) {
117
+ const wrapped = ((Math.round(minutes) % MINUTES_PER_DAY) + MINUTES_PER_DAY) % MINUTES_PER_DAY;
118
+ const hours = Math.floor(wrapped / 60);
119
+ const mins = wrapped % 60;
120
+ return `${String(hours).padStart(2, '0')}:${String(mins).padStart(2, '0')}`;
121
+ }
122
+ /** How far a clock change moves the wall clock in every zone the session readers use (New York, Chicago, London). */
123
+ const CLOCK_CHANGE_MS = 60 * MINUTE_MS;
124
+ /**
125
+ * Every clock change in those zones moves the clock between 01:00 and 03:00 local (01:00 to 02:00 in London, 02:00 to
126
+ * 03:00 or back to 01:00 in New York and Chicago), so only a wall time in [01:00, 03:00) can be skipped or repeated.
127
+ * Any other edge is the solver's one reading, with no further clock reads.
128
+ */
129
+ const CHANGE_HOURS_START_MINUTES = 60;
130
+ const CHANGE_HOURS_END_MINUTES = 3 * 60;
131
+ function wallReadingAt(timeZone, ms) {
132
+ try {
133
+ return zoneWallMsAt(timeZone, ms);
134
+ }
135
+ catch {
136
+ return Number.NaN;
137
+ }
138
+ }
139
+ function solvedInstant(timeZone, wallMs) {
140
+ try {
141
+ return zoneWallToUtcMs(timeZone, wallMs);
142
+ }
143
+ catch {
144
+ return Number.NaN;
145
+ }
146
+ }
147
+ /**
148
+ * The instant a window edge means on `timeZone`'s clock: the FIRST instant whose wall clock reads `wallMs` (a
149
+ * UTC-shaped epoch) or later. On an ordinary day that is the instant itself. A wall time that a fall-back change
150
+ * repeats is its first occurrence, and a wall time that a spring-forward change skips is the change itself: 02:30 New
151
+ * York on 2026-03-08 is 07:00Z, and 01:30 London on 2026-03-29 is 01:00Z. The gateway's local-minute filter reads a
152
+ * window the same way, so a session opens and closes where the served rows do. UTC reads as itself. NaN where the
153
+ * zone clock serves no reading.
154
+ */
155
+ export function zoneWallEdgeToUtcMs(timeZone, wallMs) {
156
+ if (timeZone === 'UTC')
157
+ return wallMs;
158
+ const ms = solvedInstant(timeZone, wallMs);
159
+ if (!Number.isFinite(ms))
160
+ return Number.NaN;
161
+ const minuteOfDay = (((wallMs % DAY_MS) + DAY_MS) % DAY_MS) / MINUTE_MS;
162
+ if (minuteOfDay < CHANGE_HOURS_START_MINUTES || minuteOfDay >= CHANGE_HOURS_END_MINUTES)
163
+ return ms;
164
+ const readMs = wallReadingAt(timeZone, ms);
165
+ if (!Number.isFinite(readMs))
166
+ return Number.NaN;
167
+ if (readMs === wallMs) {
168
+ // A repeated wall time: the solver can hand back its later occurrence. One change earlier reads the same wall
169
+ // time only when the clock fell back in between, and that earlier instant is the first occurrence.
170
+ const earlier = ms - CLOCK_CHANGE_MS;
171
+ return wallReadingAt(timeZone, earlier) === wallMs ? earlier : ms;
172
+ }
173
+ // A skipped wall time: `ms` reads on one side of the jump, and one gap away the clock reads on the other. The first
174
+ // whole minute reading at or past the wall time is the change itself (changes fall on whole minutes).
175
+ let low = readMs < wallMs ? ms : ms - (readMs - wallMs);
176
+ let high = readMs < wallMs ? ms + (wallMs - readMs) : ms;
177
+ if (!(wallReadingAt(timeZone, high) >= wallMs) || wallReadingAt(timeZone, low) >= wallMs)
178
+ return ms;
179
+ while (high - low > MINUTE_MS) {
180
+ const mid = low + Math.floor((high - low) / (2 * MINUTE_MS)) * MINUTE_MS;
181
+ if (wallReadingAt(timeZone, mid) >= wallMs)
182
+ high = mid;
183
+ else
184
+ low = mid;
185
+ }
186
+ return high;
187
+ }
188
+ /**
189
+ * The session [open, close) as UTC instants on the local calendar day `localDayMs` (that day's midnight as a
190
+ * UTC-shaped epoch on the session's own clock). A close at or below the open lands on the next local day. Each edge
191
+ * is read on its own date with zoneWallEdgeToUtcMs, so a clock change moves the instant and keeps the wall hours, and
192
+ * an edge in a skipped or repeated hour lands where the gateway's filter puts it. NaN where the zone clock serves no
193
+ * reading.
194
+ */
195
+ export function marketSessionInstantsOn(session, localDayMs) {
196
+ const closeDayMs = session.closeMinutes <= session.openMinutes ? localDayMs + DAY_MS : localDayMs;
197
+ return [
198
+ zoneWallEdgeToUtcMs(session.timeZone, localDayMs + session.openMinutes * MINUTE_MS),
199
+ zoneWallEdgeToUtcMs(session.timeZone, closeDayMs + session.closeMinutes * MINUTE_MS),
200
+ ];
201
+ }
202
+ /** The [open, close) of the latest session opened at or before `tsMs` (forming or last closed); null if unreadable. */
203
+ export function marketSessionAtOrBefore(session, tsMs) {
204
+ try {
205
+ const wallMs = zoneWallMsAt(session.timeZone, tsMs);
206
+ if (!Number.isFinite(wallMs))
207
+ return null;
208
+ const localDayMs = Math.floor(wallMs / DAY_MS) * DAY_MS;
209
+ // A session that opens later in this local day than `tsMs` is the day before's; two back reaches one over midnight.
210
+ for (const back of [0, 1, 2]) {
211
+ const instants = marketSessionInstantsOn(session, localDayMs - back * DAY_MS);
212
+ if (Number.isFinite(instants[0]) && Number.isFinite(instants[1]) && instants[0] <= tsMs)
213
+ return instants;
214
+ }
215
+ }
216
+ catch {
217
+ // Intl's RangeError for a zone this runtime cannot read: no session.
218
+ }
219
+ return null;
220
+ }
@@ -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. `offsetMs` is the chart's display-timezone shift
135
- * (SC37): the labels print the wall time of key + offset, UTC fields. */
136
- export declare function panelTimeLabels(keys: readonly number[], offsetMs?: number): string[];
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.