@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
@@ -7,27 +7,31 @@
7
7
  *
8
8
  * `venue` is the SERIES being merged (a comparison leg passes its own
9
9
  * exchange and symbol, never the chart's). Precedence:
10
- * 1. calendar (1M 3M 6M 1Y): the CME trade-date months on a CME venue
11
- * (cme-session-bucket.util), else the UTC calendar boundary (the month's
12
- * 1st, quarters and halves from January, January 1; calendar-interval.util),
10
+ * 1. calendar (1M 3M 6M 1Y): the trade-date months on a session-lattice venue
11
+ * (session-lattice.util: the CME family on the Chicago trade calendar, forex
12
+ * on the New York day), else the UTC calendar boundary (the month's 1st,
13
+ * quarters and halves from January, January 1; calendar-interval.util),
13
14
  * never the average-length floor;
14
- * 2. weekly: the CME trade-date week on a CME venue, else `findMonday`;
15
+ * 2. weekly: the trade-date week on a session-lattice venue, else `findMonday`;
15
16
  * 3. chart RTH: above the 30m grid the bucket anchored at the venue's RTH
16
17
  * open (09:30 New York, 09:00 on NYMEX; rth-session.util), at 30m and
17
18
  * finer the UTC floor whose start the RTH window holds (the gateway keeps
18
19
  * a whole bucket by its start, so the 16:00 New York 30m bucket stays);
19
20
  * either only while the product trades by its schedule (no Saturday bars);
20
- * 4. regular-session US equities: the 09:30 anchored bucket from 45m to 12h,
21
- * the three-trade-date group at 3d, at 30m and finer the UTC floor of a
22
- * cash-session bar (`isUsEquityRegularSessionBarMs`);
23
- * 5. a CME venue on the Chicago session lattice (45m to 12h, 1d, 3d:
24
- * cme-session-bucket.util);
21
+ * 4. regular-session US equities (an extended-hours chart too from a day up:
22
+ * `isEquityRegularSessionGated` at the interval): the 09:30 anchored bucket
23
+ * from 45m to 12h, the three-trade-date group at 3d, at 30m and finer the
24
+ * UTC floor of a cash-session bar (`isUsEquityRegularSessionBarMs`);
25
+ * 5. a session-lattice venue on its own lattice (session-lattice.util: the CME
26
+ * family from 2m to 12h, 1d, 3d; forex from 4h up), the profile the
27
+ * gateway rolls that venue up on;
25
28
  * 6. everything else: the UTC floor.
26
29
  * Null means the frame has no bucket (off-session under 3 or 4): the chart
27
30
  * holds no bar there, so drop it. At 30m and finer the session grids share
28
31
  * the UTC floor's lattice, never its bars: a regular-session chart holds none
29
32
  * between its close and its next open.
30
33
  */
34
+ import { type SessionLatticeProfile } from './session-lattice.util.js';
31
35
  export interface LiveBucketVenue {
32
36
  exchange?: unknown;
33
37
  symbol?: unknown;
@@ -45,7 +49,13 @@ export declare function liveBucketVenueOf(metadata: {
45
49
  sessionType?: unknown;
46
50
  transformations?: unknown;
47
51
  } | null | undefined): LiveBucketVenue;
48
- /** Whether the series' history rides the CME session lattice: its formula's timeline legs, else its exchange. */
52
+ /**
53
+ * The session lattice the series' history rides (session-lattice.util, the
54
+ * profile the gateway rolls its venue up on): its formula's timeline legs,
55
+ * else its exchange; null for a venue on the UTC aggregates.
56
+ */
57
+ export declare function sessionLatticeOfVenue(venue: LiveBucketVenue | null | undefined): SessionLatticeProfile | null;
58
+ /** Whether the series' history rides the CME session lattice in particular (`sessionLatticeOfVenue` for the rule). */
49
59
  export declare function isCmeSessionLatticeVenue(venue: LiveBucketVenue | null | undefined): boolean;
50
60
  /**
51
61
  * The plain bar grid: calendar bars start on their UTC calendar boundary,
@@ -53,7 +63,7 @@ export declare function isCmeSessionLatticeVenue(venue: LiveBucketVenue | null |
53
63
  */
54
64
  export declare function plainBucketStartMs(tsMs: number, intervalMs: number): number;
55
65
  /**
56
- * The CME session-lattice bar for a series whose history never anchors to a
66
+ * The session-lattice bar for a series whose history never anchors to a
57
67
  * trading-hours grid of its own (overlays and script sources fetching the
58
68
  * full session), or null off the lattice, where the caller keeps
59
69
  * `plainBucketStartMs`. `venue` is the SERIES' own market (a comparison leg
@@ -61,16 +71,28 @@ export declare function plainBucketStartMs(tsMs: number, intervalMs: number): nu
61
71
  * so these writers never start anchoring to chart RTH or the regular
62
72
  * equities session.
63
73
  */
64
- export declare function cmeSessionLatticeBucketMs(tsMs: number, intervalMs: number, venue: LiveBucketVenue | null | undefined): number | null;
74
+ export declare function venueSessionLatticeBucketMs(tsMs: number, intervalMs: number, venue: LiveBucketVenue | null | undefined): number | null;
75
+ /** `venueSessionLatticeBucketMs` by its earlier name (the kit's host entry and older readers keep it). */
76
+ export declare const cmeSessionLatticeBucketMs: typeof venueSessionLatticeBucketMs;
77
+ /** When the lattice bar stamped `barMs` on the series' own market stops taking rows (`sessionLatticeBarEndMs`); null off its lattice. */
78
+ export declare function venueSessionLatticeBarEndMs(barMs: number, intervalMs: number, venue: LiveBucketVenue | null | undefined): number | null;
79
+ /** When the lattice bar holding `tsMs` on the series' own market opens (`sessionLatticeBarOpenMs`); null off its lattice. */
80
+ export declare function venueSessionLatticeBarOpenMs(tsMs: number, intervalMs: number, venue: LiveBucketVenue | null | undefined): number | null;
65
81
  export declare function liveBucketStartMs(tsMs: number, intervalMs: number, venue?: LiveBucketVenue | null): number | null;
66
82
  /**
67
- * Whether the venue's bars at `intervalMs` are stamped with a LABEL rather than their open: the CME trade-date lattice
68
- * from a day up (a bar labelled 00:00Z of its trade date opens at the 17:00 Chicago open the evening before) and a
69
- * regular-session stock's three-trade-date 3d group (one label over three sessions and the nights between them). A
70
- * bar there does not span [its stamp, the next bar's stamp), so only the bucket function says which bar holds an
71
- * instant (host-bar-placement.util's sweep reads it so).
83
+ * Whether the venue's bars at `intervalMs` are stamped with a LABEL rather than their open: a session-lattice venue's
84
+ * trade-date bars from a day up (a bar labelled 00:00Z of its trade date opens at the session open the evening before:
85
+ * 17:00 Chicago on the CME family, 17:00 New York on forex) and a regular-session stock's three-trade-date 3d group
86
+ * (one label over three sessions and the nights between them). A bar there does not span [its stamp, the next bar's
87
+ * stamp), so only the bucket function says which bar holds an instant (host-bar-placement.util's sweep reads it so).
72
88
  */
73
89
  export declare function liveBucketBarsAreLabels(intervalMs: number, venue?: LiveBucketVenue | null): boolean;
90
+ /**
91
+ * Whether the venue's bars at `intervalMs` open on the UTC interval lattice (the UTC floor, `findMonday`, a session's 30m
92
+ * and finer floor). False on a session lattice, where bars follow the trading calendar: anchored at the session's open
93
+ * (a stock or a chart-RTH product from 45m to 12h, a session-lattice venue) or labels (`liveBucketBarsAreLabels`).
94
+ */
95
+ export declare function liveBucketBarsOnUtcLattice(intervalMs: number, venue?: LiveBucketVenue | null): boolean;
74
96
  /**
75
97
  * The starts of the venue's bars that open inside `[fromMs, toMs]`, ascending, each keyed by
76
98
  * `liveBucketStartMs`: a regular-session stock chart's hourly columns sit on its 13:30Z (EDT) candles,
@@ -7,21 +7,24 @@
7
7
  *
8
8
  * `venue` is the SERIES being merged (a comparison leg passes its own
9
9
  * exchange and symbol, never the chart's). Precedence:
10
- * 1. calendar (1M 3M 6M 1Y): the CME trade-date months on a CME venue
11
- * (cme-session-bucket.util), else the UTC calendar boundary (the month's
12
- * 1st, quarters and halves from January, January 1; calendar-interval.util),
10
+ * 1. calendar (1M 3M 6M 1Y): the trade-date months on a session-lattice venue
11
+ * (session-lattice.util: the CME family on the Chicago trade calendar, forex
12
+ * on the New York day), else the UTC calendar boundary (the month's 1st,
13
+ * quarters and halves from January, January 1; calendar-interval.util),
13
14
  * never the average-length floor;
14
- * 2. weekly: the CME trade-date week on a CME venue, else `findMonday`;
15
+ * 2. weekly: the trade-date week on a session-lattice venue, else `findMonday`;
15
16
  * 3. chart RTH: above the 30m grid the bucket anchored at the venue's RTH
16
17
  * open (09:30 New York, 09:00 on NYMEX; rth-session.util), at 30m and
17
18
  * finer the UTC floor whose start the RTH window holds (the gateway keeps
18
19
  * a whole bucket by its start, so the 16:00 New York 30m bucket stays);
19
20
  * either only while the product trades by its schedule (no Saturday bars);
20
- * 4. regular-session US equities: the 09:30 anchored bucket from 45m to 12h,
21
- * the three-trade-date group at 3d, at 30m and finer the UTC floor of a
22
- * cash-session bar (`isUsEquityRegularSessionBarMs`);
23
- * 5. a CME venue on the Chicago session lattice (45m to 12h, 1d, 3d:
24
- * cme-session-bucket.util);
21
+ * 4. regular-session US equities (an extended-hours chart too from a day up:
22
+ * `isEquityRegularSessionGated` at the interval): the 09:30 anchored bucket
23
+ * from 45m to 12h, the three-trade-date group at 3d, at 30m and finer the
24
+ * UTC floor of a cash-session bar (`isUsEquityRegularSessionBarMs`);
25
+ * 5. a session-lattice venue on its own lattice (session-lattice.util: the CME
26
+ * family from 2m to 12h, 1d, 3d; forex from 4h up), the profile the
27
+ * gateway rolls that venue up on;
25
28
  * 6. everything else: the UTC floor.
26
29
  * Null means the frame has no bucket (off-session under 3 or 4): the chart
27
30
  * holds no bar there, so drop it. At 30m and finer the session grids share
@@ -29,14 +32,15 @@
29
32
  * between its close and its next open.
30
33
  */
31
34
  import { findMonday, TimeIntervalConstant } from './titan-constants.pin.js';
32
- import { cmeSessionBucketMs, isCmeSessionLatticeExchange, isCmeSessionLatticeIntervalMs, } from './cme-session-bucket.util.js';
35
+ import { CME_SESSION_LATTICE, isSessionLatticeIntervalMs, sessionLatticeBarEndMs, sessionLatticeBarOpenMs, sessionLatticeBucketMs, sessionLatticeOf, } from './session-lattice.util.js';
33
36
  import { Intervals } from '../../constants/interval.constants.js';
34
37
  import { calendarBarStartMs, calendarMonthsOfMs } from './calendar-interval.util.js';
35
38
  import { formulaCalendarPlan, formulaLegExchange } from './formula-calendar.util.js';
36
39
  import { checkIsEconomic } from './marketKind.util.js';
37
40
  import { extractTokensFromTransformations, parsedTransformations } from '../common/transformations.util.js';
38
41
  import { isGovernedFuturesSymbolOpenAt } from './market-session-schedule.util.js';
39
- import { isChartRthActive, isFootprintRthFoldTfMs, isRthBucketExactIntervalMs, isWithinRthWindow, nextRthSessionOpenMs, rthAnchoredBucketStartMs, } from './rth-session.util.js';
42
+ import { chartRegularSessionKind, isWithinMarketRegularWindow, marketAnchoredBucketStartMs, } from './market-session.util.js';
43
+ import { isFootprintRthFoldTfMs, isRthBucketExactIntervalMs, nextRthSessionOpenMs } from './rth-session.util.js';
40
44
  import { isEquityRegularSessionGated, isUsEquityRegularSessionBarMs, usEquityAnchoredBucketStartMs, usEquitySessionGridBucketStartMs, } from './us-equities-session.util.js';
41
45
  import { nyNextRegularOpenAfterMs } from './ny-calendar.util.js';
42
46
  const THREE_DAYS_MS = Intervals.map_unit['3d'];
@@ -53,22 +57,23 @@ export function liveBucketVenueOf(metadata) {
53
57
  ...(typeof metadata?.transformations === 'string' && { transformations: metadata.transformations }),
54
58
  };
55
59
  }
60
+ /** A formula's lattice: a profile, null for a formula off every lattice, undefined for a plain expression. */
56
61
  const formulaLatticeByExpression = new Map();
57
62
  const FORMULA_CACHE_MAX = 256;
58
63
  /**
59
- * Whether a formula's bars ride the CME session lattice, null for a plain
60
- * expression. The history worker builds a formula on its TIMELINE legs
61
- * (ohlcv.worker): economic series are carried as of the market legs' bars,
62
- * and a cross-calendar formula rides its anchor leg (formulaCalendarPlan).
63
- * Legs are fetched one venue each, so the formula rides the lattice when
64
- * every timeline leg is a CME Group venue; a CME + crypto formula at 4h
65
- * shares no stamps to join on and stays off it.
64
+ * The session lattice a formula's bars ride, null when they ride none,
65
+ * undefined for a plain expression. The history worker builds a formula on
66
+ * its TIMELINE legs (ohlcv.worker): economic series are carried as of the
67
+ * market legs' bars, and a cross-calendar formula rides its anchor leg
68
+ * (formulaCalendarPlan). Legs are fetched one venue each, so the formula
69
+ * rides a lattice when every timeline leg is a venue of that one profile; a
70
+ * CME + crypto formula at 4h, or a CME + forex one (two lattices an hour
71
+ * apart), shares no stamps to join on and stays off it.
66
72
  */
67
- function formulaTimelineOnLattice(expression) {
68
- const cached = formulaLatticeByExpression.get(expression);
69
- if (cached !== undefined)
70
- return cached;
71
- let onLattice = null;
73
+ function formulaTimelineLattice(expression) {
74
+ if (formulaLatticeByExpression.has(expression))
75
+ return formulaLatticeByExpression.get(expression);
76
+ let lattice;
72
77
  if (parsedTransformations(expression).length > 1) {
73
78
  const legs = extractTokensFromTransformations(expression).map((token) => ({
74
79
  token: token.token,
@@ -78,20 +83,29 @@ function formulaTimelineOnLattice(expression) {
78
83
  const timeline = plan
79
84
  ? legs.filter((leg) => leg.token === plan.anchor)
80
85
  : legs.filter((leg) => !checkIsEconomic(leg.exchange));
81
- onLattice = timeline.length > 0 && timeline.every((leg) => isCmeSessionLatticeExchange(leg.exchange));
86
+ const first = timeline.length > 0 ? sessionLatticeOf(timeline[0].exchange) : null;
87
+ lattice = first !== null && timeline.every((leg) => sessionLatticeOf(leg.exchange) === first) ? first : null;
82
88
  }
83
89
  if (formulaLatticeByExpression.size >= FORMULA_CACHE_MAX)
84
90
  formulaLatticeByExpression.clear();
85
- formulaLatticeByExpression.set(expression, onLattice);
86
- return onLattice;
91
+ formulaLatticeByExpression.set(expression, lattice);
92
+ return lattice;
87
93
  }
88
- /** Whether the series' history rides the CME session lattice: its formula's timeline legs, else its exchange. */
89
- export function isCmeSessionLatticeVenue(venue) {
94
+ /**
95
+ * The session lattice the series' history rides (session-lattice.util, the
96
+ * profile the gateway rolls its venue up on): its formula's timeline legs,
97
+ * else its exchange; null for a venue on the UTC aggregates.
98
+ */
99
+ export function sessionLatticeOfVenue(venue) {
90
100
  if (!venue)
91
- return false;
101
+ return null;
92
102
  const expression = venue.transformations;
93
- const formula = typeof expression === 'string' && expression.length > 0 ? formulaTimelineOnLattice(expression) : null;
94
- return formula ?? isCmeSessionLatticeExchange(venue.exchange);
103
+ const formula = typeof expression === 'string' && expression.length > 0 ? formulaTimelineLattice(expression) : undefined;
104
+ return formula === undefined ? sessionLatticeOf(venue.exchange) : formula;
105
+ }
106
+ /** Whether the series' history rides the CME session lattice in particular (`sessionLatticeOfVenue` for the rule). */
107
+ export function isCmeSessionLatticeVenue(venue) {
108
+ return sessionLatticeOfVenue(venue) === CME_SESSION_LATTICE;
95
109
  }
96
110
  /**
97
111
  * The plain bar grid: calendar bars start on their UTC calendar boundary,
@@ -103,8 +117,13 @@ export function plainBucketStartMs(tsMs, intervalMs) {
103
117
  return calendarBarStartMs(tsMs, months);
104
118
  return intervalMs === TimeIntervalConstant.week ? findMonday(tsMs) : tsMs - (tsMs % intervalMs);
105
119
  }
120
+ /** The venue's lattice at an interval the gateway rolls it up on, else null. */
121
+ function venueLatticeAt(intervalMs, venue) {
122
+ const lattice = sessionLatticeOfVenue(venue);
123
+ return lattice !== null && isSessionLatticeIntervalMs(lattice, intervalMs) ? lattice : null;
124
+ }
106
125
  /**
107
- * The CME session-lattice bar for a series whose history never anchors to a
126
+ * The session-lattice bar for a series whose history never anchors to a
108
127
  * trading-hours grid of its own (overlays and script sources fetching the
109
128
  * full session), or null off the lattice, where the caller keeps
110
129
  * `plainBucketStartMs`. `venue` is the SERIES' own market (a comparison leg
@@ -112,20 +131,31 @@ export function plainBucketStartMs(tsMs, intervalMs) {
112
131
  * so these writers never start anchoring to chart RTH or the regular
113
132
  * equities session.
114
133
  */
115
- export function cmeSessionLatticeBucketMs(tsMs, intervalMs, venue) {
116
- if (!venue || !isCmeSessionLatticeIntervalMs(intervalMs))
117
- return null;
118
- return isCmeSessionLatticeVenue(venue) ? cmeSessionBucketMs(tsMs, intervalMs) : null;
134
+ export function venueSessionLatticeBucketMs(tsMs, intervalMs, venue) {
135
+ const lattice = venueLatticeAt(intervalMs, venue);
136
+ return lattice === null ? null : sessionLatticeBucketMs(lattice, tsMs, intervalMs);
137
+ }
138
+ /** `venueSessionLatticeBucketMs` by its earlier name (the kit's host entry and older readers keep it). */
139
+ export const cmeSessionLatticeBucketMs = venueSessionLatticeBucketMs;
140
+ /** When the lattice bar stamped `barMs` on the series' own market stops taking rows (`sessionLatticeBarEndMs`); null off its lattice. */
141
+ export function venueSessionLatticeBarEndMs(barMs, intervalMs, venue) {
142
+ const lattice = venueLatticeAt(intervalMs, venue);
143
+ return lattice === null ? null : sessionLatticeBarEndMs(lattice, barMs, intervalMs);
144
+ }
145
+ /** When the lattice bar holding `tsMs` on the series' own market opens (`sessionLatticeBarOpenMs`); null off its lattice. */
146
+ export function venueSessionLatticeBarOpenMs(tsMs, intervalMs, venue) {
147
+ const lattice = venueLatticeAt(intervalMs, venue);
148
+ return lattice === null ? null : sessionLatticeBarOpenMs(lattice, tsMs, intervalMs);
119
149
  }
120
150
  function liveBucketGrid(intervalMs, venue) {
121
- // Calendar and weekly bars: a CME venue's trade-date months and weeks (a
122
- // month opens at the 17:00 Chicago open before its first trade date), else
123
- // the plain grid. Regular-session US equities group the session's daily bars
124
- // by month and are ASSUMED stamped on the 1st at 00:00 UTC like every other
125
- // market; if the gateway stamps them on the first trade date's open instead,
126
- // this branch needs the session's own month key.
151
+ // Calendar and weekly bars: a session-lattice venue's trade-date months and
152
+ // weeks (a month opens at the session open before its first trade date),
153
+ // else the plain grid. Regular-session US equities group the session's daily
154
+ // bars by month and are ASSUMED stamped on the 1st at 00:00 UTC like every
155
+ // other market; if the gateway stamps them on the first trade date's open
156
+ // instead, this branch needs the session's own month key.
127
157
  if (calendarMonthsOfMs(intervalMs) !== null || intervalMs === TimeIntervalConstant.week) {
128
- return isCmeSessionLatticeVenue(venue) ? 'cme-session' : 'plain';
158
+ return sessionLatticeOfVenue(venue) !== null ? 'session-lattice' : 'plain';
129
159
  }
130
160
  if (!venue)
131
161
  return 'utc-floor';
@@ -133,10 +163,11 @@ function liveBucketGrid(intervalMs, venue) {
133
163
  // bar there only inside its session, so the grid asks the session every time (a lattice that coincides is
134
164
  // no off-session drop).
135
165
  const exact = isRthBucketExactIntervalMs(intervalMs);
136
- if (isChartRthActive(venue.exchange, venue.symbol, venue.sessionType, intervalMs)) {
166
+ // The equities grids below also serve a stock's daily-and-longer bars, which the intraday chart kind never names.
167
+ if (chartRegularSessionKind(venue.exchange, venue.symbol, venue.sessionType, intervalMs) === 'cme') {
137
168
  return exact ? 'rth-floor' : 'rth-anchored';
138
169
  }
139
- if (isEquityRegularSessionGated(venue.exchange, venue.sessionType)) {
170
+ if (isEquityRegularSessionGated(venue.exchange, venue.sessionType, intervalMs)) {
140
171
  if (exact)
141
172
  return 'equity-floor';
142
173
  if (isFootprintRthFoldTfMs(intervalMs))
@@ -144,8 +175,8 @@ function liveBucketGrid(intervalMs, venue) {
144
175
  if (intervalMs === THREE_DAYS_MS)
145
176
  return 'equity-session-group';
146
177
  }
147
- if (!exact && isCmeSessionLatticeIntervalMs(intervalMs) && isCmeSessionLatticeVenue(venue))
148
- return 'cme-session';
178
+ if (!exact && venueLatticeAt(intervalMs, venue) !== null)
179
+ return 'session-lattice';
149
180
  return 'utc-floor';
150
181
  }
151
182
  /** The UTC floor of `tsMs`, the 30m bucket-exact grids' lattice. */
@@ -157,16 +188,21 @@ function rthBucketOrNull(symbol, startMs) {
157
188
  }
158
189
  function bucketStartOnGrid(grid, tsMs, intervalMs, venue) {
159
190
  switch (grid) {
160
- case 'cme-session':
161
- return cmeSessionBucketMs(tsMs, intervalMs);
191
+ case 'session-lattice': {
192
+ // The grid names a lattice venue (liveBucketGrid), so the profile resolves; the plain grid is the defensive floor.
193
+ const lattice = sessionLatticeOfVenue(venue);
194
+ return lattice === null
195
+ ? plainBucketStartMs(tsMs, intervalMs)
196
+ : sessionLatticeBucketMs(lattice, tsMs, intervalMs);
197
+ }
162
198
  case 'plain':
163
199
  return plainBucketStartMs(tsMs, intervalMs);
164
200
  case 'rth-anchored':
165
- return rthBucketOrNull(venue?.symbol, rthAnchoredBucketStartMs(venue?.symbol, tsMs, intervalMs));
201
+ return rthBucketOrNull(venue?.symbol, marketAnchoredBucketStartMs(venue?.exchange, venue?.symbol, tsMs, intervalMs));
166
202
  case 'rth-floor': {
167
203
  // The gateway keeps a whole bucket by its START: the 16:00 New York 30m bucket of a 16:15 close stays.
168
204
  const floor = utcFloorMs(tsMs, intervalMs);
169
- return rthBucketOrNull(venue?.symbol, isWithinRthWindow(venue?.symbol, floor) ? floor : null);
205
+ return rthBucketOrNull(venue?.symbol, isWithinMarketRegularWindow(venue?.exchange, venue?.symbol, floor) ? floor : null);
170
206
  }
171
207
  case 'equity-anchored':
172
208
  return usEquityAnchoredBucketStartMs(tsMs, intervalMs);
@@ -184,15 +220,24 @@ export function liveBucketStartMs(tsMs, intervalMs, venue) {
184
220
  return bucketStartOnGrid(liveBucketGrid(intervalMs, venue), tsMs, intervalMs, venue);
185
221
  }
186
222
  /**
187
- * Whether the venue's bars at `intervalMs` are stamped with a LABEL rather than their open: the CME trade-date lattice
188
- * from a day up (a bar labelled 00:00Z of its trade date opens at the 17:00 Chicago open the evening before) and a
189
- * regular-session stock's three-trade-date 3d group (one label over three sessions and the nights between them). A
190
- * bar there does not span [its stamp, the next bar's stamp), so only the bucket function says which bar holds an
191
- * instant (host-bar-placement.util's sweep reads it so).
223
+ * Whether the venue's bars at `intervalMs` are stamped with a LABEL rather than their open: a session-lattice venue's
224
+ * trade-date bars from a day up (a bar labelled 00:00Z of its trade date opens at the session open the evening before:
225
+ * 17:00 Chicago on the CME family, 17:00 New York on forex) and a regular-session stock's three-trade-date 3d group
226
+ * (one label over three sessions and the nights between them). A bar there does not span [its stamp, the next bar's
227
+ * stamp), so only the bucket function says which bar holds an instant (host-bar-placement.util's sweep reads it so).
192
228
  */
193
229
  export function liveBucketBarsAreLabels(intervalMs, venue) {
194
230
  const grid = liveBucketGrid(intervalMs, venue);
195
- return grid === 'equity-session-group' || (grid === 'cme-session' && intervalMs >= ONE_DAY_MS);
231
+ return grid === 'equity-session-group' || (grid === 'session-lattice' && intervalMs >= ONE_DAY_MS);
232
+ }
233
+ /**
234
+ * Whether the venue's bars at `intervalMs` open on the UTC interval lattice (the UTC floor, `findMonday`, a session's 30m
235
+ * and finer floor). False on a session lattice, where bars follow the trading calendar: anchored at the session's open
236
+ * (a stock or a chart-RTH product from 45m to 12h, a session-lattice venue) or labels (`liveBucketBarsAreLabels`).
237
+ */
238
+ export function liveBucketBarsOnUtcLattice(intervalMs, venue) {
239
+ const grid = liveBucketGrid(intervalMs, venue);
240
+ return grid === 'utc-floor' || grid === 'plain' || grid === 'equity-floor' || grid === 'rth-floor';
196
241
  }
197
242
  /** The probe step through an off-session gap: every open the anchored grids sit on is on the quarter hour. */
198
243
  const OFF_SESSION_PROBE_MS = 15 * 60_000;
@@ -217,6 +262,7 @@ function resumeProbeMs(grid, probeMs, stepMs, offSession, toMs, venue, intervalM
217
262
  const nextBoundaryMs = utcFloorMs(probeMs, intervalMs) + intervalMs;
218
263
  if (bucketStartOnGrid(grid, nextBoundaryMs, intervalMs, venue) !== null)
219
264
  return nextBoundaryMs;
265
+ // CME-only on purpose: 'rth-floor' is the CME chart-RTH grid alone, so its next open is a CME trade date's.
220
266
  const openMs = grid === 'equity-floor' ? nyNextRegularOpenAfterMs(probeMs, toMs) : nextRthSessionOpenMs(venue?.symbol, probeMs);
221
267
  if (openMs === null)
222
268
  return Number.POSITIVE_INFINITY;
@@ -5,21 +5,35 @@
5
5
  * stale-but-fast; the caching contract (perf/caching.md: stale paints, fresh
6
6
  * replaces) then owes one live re-fetch. The boot second pass cannot be that
7
7
  * re-fetch: on a warm boot it is skipped entirely, and on any pass the cache
8
- * would simply hit again. So: the acquisition MARKS the overlay pending here;
9
- * after that generation's first run integrates (the overlay actually painted),
10
- * the owner (data-fetching.util) runs a one-shot per-(chart, overlay) refresh
11
- * over the recorded range with a generation-owned BYPASS TOKEN installed.
12
- * Every source acquisition belonging to that refresh observes the token (and
13
- * never consumes it); the owner clears it in `finally` only if it still owns
14
- * it. Teardown clears both maps.
8
+ * would simply hit again. So: the acquisition MARKS the overlay pending here,
9
+ * with the window and the LANE the replay cache served (its replay-series
10
+ * identity, `kScriptSourceReplayLaneKey`); after that generation's first run
11
+ * integrates (the overlay actually painted), the owner (the wrun lifecycle
12
+ * door) runs a one-shot per-(chart, overlay) refresh over the recorded range
13
+ * with a generation-owned BYPASS TOKEN installed over the marked lanes. Only
14
+ * those lanes reach the wire: every other lane of the refresh takes its normal
15
+ * ladder (row cache, composition, resident split, replay cache read), so a lane
16
+ * the row cache holds fresh is never bought again. A token installed without
17
+ * lanes (the live tick's reconcile, the full-fetch debug oracle) covers every
18
+ * lane. Every source acquisition observes the standing tokens (and never
19
+ * consumes one); an owner releases only its own token, in `finally`. The
20
+ * tokens of one overlay stack: a lane bypasses while any standing token covers
21
+ * it, so a narrower token never narrows a wider one that stands. Teardown
22
+ * clears both maps.
15
23
  *
16
- * This module is pure state so titan-charts (acquisition side) and
17
- * data-fetching.util (refresh side) can share it without an import cycle.
24
+ * This module is pure state so titan-charts (acquisition side) and the
25
+ * lifecycle door (refresh side) can share it without an import cycle.
18
26
  */
19
27
  export interface PendingKScriptSourceRevalidation {
20
28
  fromMs: number;
21
29
  toMs: number;
22
30
  markedAt: number;
31
+ /**
32
+ * The lanes the replay cache served (`kScriptSourceReplayLaneKey`): the
33
+ * refresh's token bypasses only these. Empty only when every mark named no
34
+ * lane, and such a refresh covers every lane of the overlay.
35
+ */
36
+ lanes: Set<string>;
23
37
  /**
24
38
  * A one-shot runner has been armed for this mark. Cleared when the runner
25
39
  * consumes the mark OR bails on a guard without dispatching, so a later
@@ -28,8 +42,23 @@ export interface PendingKScriptSourceRevalidation {
28
42
  */
29
43
  scheduled: boolean;
30
44
  }
31
- /** Called by the acquisition path on a non-polling replay-cache hit. */
32
- export declare function markLocalKScriptSourceCacheHit(chartIndex: number, overlayId: string, fromMs: number, toMs: number): void;
45
+ /**
46
+ * A lane's replay-series identity: its replay cache key parts without the
47
+ * window, serialised key-order-free. A prefix page and a rerun of one lane ask
48
+ * the same parts over different windows (under different source names), so
49
+ * they share one key, and every replay-eligible type (K_VOLUME_PROFILE,
50
+ * K_BUY_SELL_VOLUME, K_ORDERBOOK) has one. Never the row cache's series key,
51
+ * which K_ORDERBOOK lacks. The parts are taken structurally: their type
52
+ * (`KScriptSourceReplayCacheKeyParts`) lives in the app, outside this package.
53
+ */
54
+ export declare function kScriptSourceReplayLaneKey(parts: object): string;
55
+ /**
56
+ * Called by the acquisition path on a non-polling replay-cache hit: the lane
57
+ * joins the overlay's pending lanes and the window joins its range. A mark
58
+ * with no lane key adds no lane (a record with no lanes revalidates every
59
+ * lane, never none).
60
+ */
61
+ export declare function markLocalKScriptSourceCacheHit(chartIndex: number, overlayId: string, fromMs: number, toMs: number, laneKey: string): void;
33
62
  /**
34
63
  * Arm a one-shot runner for the mark. Returns false when there is nothing to
35
64
  * arm or a runner is already armed (idempotent under per-run scheduling).
@@ -37,26 +66,35 @@ export declare function markLocalKScriptSourceCacheHit(chartIndex: number, overl
37
66
  export declare function armLocalKScriptSourceRevalidation(chartIndex: number, overlayId: string): boolean;
38
67
  /** Runner bailed on a guard without dispatching: allow a later run to re-arm. */
39
68
  export declare function disarmLocalKScriptSourceRevalidation(chartIndex: number, overlayId: string): void;
40
- /** Consumes and returns the pending mark, if any (owner-side). */
69
+ /** Consumes and returns the pending mark, its lanes included, if any (owner-side). */
41
70
  export declare function takePendingLocalKScriptSourceRevalidation(chartIndex: number, overlayId: string): PendingKScriptSourceRevalidation | undefined;
42
71
  export declare function hasPendingLocalKScriptSourceRevalidation(chartIndex: number, overlayId: string): boolean;
43
72
  /**
44
- * Install a bypass token for one overlay's revalidation refresh. Returns the
45
- * token; the owner must release with the SAME token so an older generation
46
- * can never clear a newer one.
73
+ * Install a bypass token for one overlay's refresh. With `lanes`, the token
74
+ * covers only those lanes (the revalidation of the lanes the replay cache
75
+ * served); without, every lane of the overlay (the live tick's reconcile, the
76
+ * full-fetch oracle). An empty set covers every lane too, so a stale caller
77
+ * never silently skips one. Returns the token; the owner must release with the
78
+ * SAME token, so one owner can never clear another's.
47
79
  */
48
- export declare function installLocalKScriptSourceCacheBypass(chartIndex: number, overlayId: string): symbol;
80
+ export declare function installLocalKScriptSourceCacheBypass(chartIndex: number, overlayId: string, lanes?: ReadonlySet<string>): symbol;
49
81
  export declare function releaseLocalKScriptSourceCacheBypass(chartIndex: number, overlayId: string, token: symbol): void;
50
82
  /**
51
83
  * Install one bypass token per overlay for a whole-chart forced refresh (the
52
84
  * full-fetch debug oracle): every listed overlay's source acquisitions reach
53
85
  * the wire until the returned release runs. Release is token-owned per
54
- * overlay, so a revalidation refresh that installed its own newer token in
55
- * the meantime keeps it.
86
+ * overlay, so a revalidation refresh that installed its own token in the
87
+ * meantime keeps it.
56
88
  */
57
89
  export declare function installLocalKScriptSourceCacheBypassForOverlays(chartIndex: number, overlayIds: readonly string[]): () => void;
58
- /** Observed (never consumed) by every source acquisition of the overlay. */
59
- export declare function shouldBypassLocalKScriptSourceReplayCache(chartIndex: number, overlayId: string): boolean;
90
+ /**
91
+ * Which standing token covers the lane: 'overlay' when a token over every lane
92
+ * stands, 'lane' when a lane-scoped token holds the lane, null otherwise (no
93
+ * token, or only tokens over other lanes). Observed, never consumed.
94
+ */
95
+ export declare function localKScriptSourceReplayCacheBypassScope(chartIndex: number, overlayId: string, laneKey: string): 'lane' | 'overlay' | null;
96
+ /** Observed (never consumed) by every source acquisition of the overlay: true when a standing token covers the lane. */
97
+ export declare function shouldBypassLocalKScriptSourceReplayCache(chartIndex: number, overlayId: string, laneKey: string): boolean;
60
98
  /** Chart teardown / dataset replacement: drop marks and tokens for the chart (or one overlay). */
61
99
  export declare function clearLocalKScriptSourceRevalidation(chartIndex: number, overlayId?: string): void;
62
100
  export declare function __resetLocalKScriptSourceRevalidationForTest(): void;