@orangecharts/wrun-chart-host 0.11.1 → 0.15.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 (319) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/feature-flags.constants.d.ts +4 -4
  3. package/dist/constants/feature-flags.constants.js +38 -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 +69 -3
  13. package/dist/host-env.js +21 -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 +52 -12
  18. package/dist/indicators/controls/tpo-session.util.js +113 -16
  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 +141 -20
  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 +5 -5
  35. package/dist/market-data/venues/opra.js +3 -3
  36. package/dist/market-data/venues/stocks.contract.copy.json +6 -5
  37. package/dist/market-data/venues/stocks.d.ts +5 -5
  38. package/dist/market-data/venues/stocks.js +21 -18
  39. package/dist/settings-templates/frvp-fields.d.ts +12 -1
  40. package/dist/settings-templates/frvp-fields.js +15 -4
  41. package/dist/settings-templates/index.js +12 -5
  42. package/dist/settings-templates/indicator-fields.js +43 -2
  43. package/dist/settings-templates/tool-rules.d.ts +17 -8
  44. package/dist/settings-templates/tool-rules.js +15 -8
  45. package/dist/settings-templates/tool-tables.generated.js +4 -2
  46. package/dist/utility/auth/server-clock.util.d.ts +3 -1
  47. package/dist/utility/auth/server-clock.util.js +3 -1
  48. package/dist/utility/chart/book-live-bucket.util.js +2 -2
  49. package/dist/utility/chart/cache-alignment.util.d.ts +38 -7
  50. package/dist/utility/chart/cache-alignment.util.js +50 -13
  51. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +2 -0
  52. package/dist/utility/chart/chart-data-fetch-generation.util.js +16 -0
  53. package/dist/utility/chart/cme-session-bucket.util.d.ts +18 -75
  54. package/dist/utility/chart/cme-session-bucket.util.js +25 -332
  55. package/dist/utility/chart/continuous-contracts.util.js +6 -5
  56. package/dist/utility/chart/display-offset.leaf.d.ts +24 -0
  57. package/dist/utility/chart/display-offset.leaf.js +41 -0
  58. package/dist/utility/chart/effective-chart-session.util.d.ts +2 -1
  59. package/dist/utility/chart/effective-chart-session.util.js +13 -5
  60. package/dist/utility/chart/feed-interval.util.d.ts +6 -20
  61. package/dist/utility/chart/feed-interval.util.js +13 -22
  62. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +27 -7
  63. package/dist/utility/chart/fetch-dedupe-policy.util.js +86 -11
  64. package/dist/utility/chart/footprint-band.util.d.ts +21 -5
  65. package/dist/utility/chart/footprint-band.util.js +53 -14
  66. package/dist/utility/chart/host-bar-placement.util.d.ts +7 -4
  67. package/dist/utility/chart/host-bar-placement.util.js +8 -2
  68. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +32 -0
  69. package/dist/utility/chart/indicator-inflight-registry.util.js +52 -0
  70. package/dist/utility/chart/indicator-run-interval.util.d.ts +10 -4
  71. package/dist/utility/chart/indicator-run-interval.util.js +21 -12
  72. package/dist/utility/chart/interval-registry.util.d.ts +1 -1
  73. package/dist/utility/chart/interval-registry.util.js +1 -1
  74. package/dist/utility/chart/kscript-legend-entries.util.d.ts +12 -0
  75. package/dist/utility/chart/kscript-legend-entries.util.js +16 -0
  76. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +1 -1
  77. package/dist/utility/chart/kscript-run-interval-projection.util.js +4 -2
  78. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -62
  79. package/dist/utility/chart/kscript-venue-policy.util.js +85 -94
  80. package/dist/utility/chart/live-bucket.util.d.ts +39 -17
  81. package/dist/utility/chart/live-bucket.util.js +103 -57
  82. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +58 -20
  83. package/dist/utility/chart/local-kscript-source-revalidation.util.js +98 -23
  84. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +35 -11
  85. package/dist/utility/chart/local-kscript-warmup-depth.util.js +24 -3
  86. package/dist/utility/chart/market-session-schedule.util.d.ts +8 -0
  87. package/dist/utility/chart/market-session-schedule.util.js +39 -1
  88. package/dist/utility/chart/market-session.util.d.ts +136 -0
  89. package/dist/utility/chart/market-session.util.js +341 -0
  90. package/dist/utility/chart/om-panel.util.d.ts +5 -3
  91. package/dist/utility/chart/om-panel.util.js +42 -7
  92. package/dist/utility/chart/om-target.util.d.ts +14 -1
  93. package/dist/utility/chart/om-target.util.js +22 -5
  94. package/dist/utility/chart/opra-read-access.leaf.d.ts +16 -1
  95. package/dist/utility/chart/opra-read-access.leaf.js +22 -0
  96. package/dist/utility/chart/profile-row-height.util.d.ts +49 -16
  97. package/dist/utility/chart/profile-row-height.util.js +74 -37
  98. package/dist/utility/chart/rth-session.util.d.ts +55 -20
  99. package/dist/utility/chart/rth-session.util.js +94 -46
  100. package/dist/utility/chart/session-lattice.util.d.ts +150 -0
  101. package/dist/utility/chart/session-lattice.util.js +488 -0
  102. package/dist/utility/chart/trading-day.util.d.ts +40 -2
  103. package/dist/utility/chart/trading-day.util.js +84 -7
  104. package/dist/utility/chart/us-equities-session.util.d.ts +32 -11
  105. package/dist/utility/chart/us-equities-session.util.js +44 -15
  106. package/dist/utility/chart/window-geometry.leaf.d.ts +28 -7
  107. package/dist/utility/chart/window-geometry.leaf.js +57 -8
  108. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +21 -14
  109. package/dist/utility/chart/wrun-bar-session-facts.util.js +32 -38
  110. package/dist/utility/chart/wrun-run-result.util.d.ts +38 -13
  111. package/dist/utility/chart/wrun-run-result.util.js +97 -27
  112. package/dist/utility/common/time.util.js +5 -4
  113. package/dist/utility/market-events/earnings-scope.util.d.ts +10 -5
  114. package/dist/utility/market-events/earnings-scope.util.js +17 -9
  115. package/dist/utility/market-events/market-events.util.d.ts +14 -7
  116. package/dist/utility/market-events/market-events.util.js +30 -17
  117. package/dist/utility/number-format.util.d.ts +14 -21
  118. package/dist/utility/number-format.util.js +38 -24
  119. package/dist/utility/options/option-venue-disclosure.util.d.ts +40 -6
  120. package/dist/utility/options/option-venue-disclosure.util.js +71 -11
  121. package/dist/utility/options/option-venue.util.d.ts +1 -1
  122. package/dist/utility/options/option-venue.util.js +1 -1
  123. package/dist/utility/pool-symbol.leaf.d.ts +7 -0
  124. package/dist/utility/pool-symbol.leaf.js +50 -5
  125. package/dist/utility/stocks/stock-display.util.d.ts +15 -0
  126. package/dist/utility/stocks/stock-display.util.js +37 -0
  127. package/dist/utility/symbol-selection/contract-expiry.util.js +5 -4
  128. package/dist/utility/v2/gate-plane.util.d.ts +6 -0
  129. package/dist/utility/v2/gate-plane.util.js +11 -1
  130. package/dist/utility/v2/gate-session-latch.util.d.ts +1 -1
  131. package/dist/utility/v2/gate-session-latch.util.js +3 -3
  132. package/dist/utility/v2/governed-tier.leaf.d.ts +17 -16
  133. package/dist/utility/v2/governed-tier.leaf.js +17 -16
  134. package/dist/utility/v2/stocks-governed.util.d.ts +5 -0
  135. package/dist/utility/v2/stocks-governed.util.js +14 -0
  136. package/dist/utility/v2/v2-enums.leaf.d.ts +13 -0
  137. package/dist/utility/v2/v2-enums.leaf.js +458 -0
  138. package/dist/utility/wrun/derived-roots.leaf.d.ts +21 -1
  139. package/dist/utility/wrun/derived-roots.leaf.js +27 -1
  140. package/dist/utility/wrun/derived-roots.util.d.ts +44 -32
  141. package/dist/utility/wrun/derived-roots.util.js +97 -56
  142. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -3
  143. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -3
  144. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +2 -1
  145. package/dist/utility/wrun/sources/lanes/option_daily.js +2 -1
  146. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +3 -0
  147. package/dist/utility/wrun/sources/lanes/options_flow.js +23 -5
  148. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -4
  149. package/dist/utility/wrun/sources/row-lane-registry.js +9 -4
  150. package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +19 -0
  151. package/dist/utility/wrun/sources/row-lanes/dark_pool.js +104 -0
  152. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  153. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.d.ts +20 -0
  154. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.js +103 -0
  155. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -2
  156. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +15 -13
  157. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +49 -23
  158. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +14 -9
  159. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +75 -27
  160. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +139 -82
  161. package/dist/utility/wrun/wrun-app-layer.leaf.d.ts +78 -0
  162. package/dist/utility/wrun/wrun-app-layer.leaf.js +89 -0
  163. package/dist/utility/wrun/wrun-bar-count.util.d.ts +11 -7
  164. package/dist/utility/wrun/wrun-bar-count.util.js +12 -8
  165. package/dist/utility/wrun/wrun-batched-kinds.leaf.d.ts +13 -0
  166. package/dist/utility/wrun/wrun-batched-kinds.leaf.js +18 -0
  167. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +46 -23
  168. package/dist/utility/wrun/wrun-batched-marks.util.js +260 -62
  169. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +26 -19
  170. package/dist/utility/wrun/wrun-batched-readout.util.js +81 -27
  171. package/dist/utility/wrun/wrun-book-bands.leaf.d.ts +8 -0
  172. package/dist/utility/wrun/wrun-book-bands.leaf.js +7 -0
  173. package/dist/utility/wrun/wrun-candle-equal.leaf.d.ts +19 -0
  174. package/dist/utility/wrun/wrun-candle-equal.leaf.js +40 -0
  175. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -2
  176. package/dist/utility/wrun/wrun-canvases.util.d.ts +24 -7
  177. package/dist/utility/wrun/wrun-canvases.util.js +99 -30
  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-hover.util.d.ts +8 -2
  209. package/dist/utility/wrun/wrun-hover.util.js +24 -13
  210. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +13 -0
  211. package/dist/utility/wrun/wrun-inert-legend.util.js +31 -3
  212. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +7 -5
  213. package/dist/utility/wrun/wrun-input-requirements.leaf.js +16 -6
  214. package/dist/utility/wrun/wrun-install-pacer.util.d.ts +26 -0
  215. package/dist/utility/wrun/wrun-install-pacer.util.js +145 -0
  216. package/dist/utility/wrun/wrun-kit-refusal-stages.types.d.ts +22 -0
  217. package/dist/utility/wrun/wrun-kit-refusal-stages.types.js +1 -0
  218. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +12 -5
  219. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +23 -5
  220. package/dist/utility/wrun/wrun-lane-warmup.util.js +22 -4
  221. package/dist/utility/wrun/wrun-leg-close.util.d.ts +6 -5
  222. package/dist/utility/wrun/wrun-leg-close.util.js +11 -9
  223. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +3 -1
  224. package/dist/utility/wrun/wrun-leg-fetch.util.js +9 -2
  225. package/dist/utility/wrun/wrun-levels-child.util.d.ts +2 -0
  226. package/dist/utility/wrun/wrun-levels-child.util.js +6 -0
  227. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -0
  228. package/dist/utility/wrun/wrun-live-intake.util.d.ts +15 -6
  229. package/dist/utility/wrun/wrun-live-intake.util.js +167 -47
  230. package/dist/utility/wrun/wrun-live-tick.util.d.ts +52 -8
  231. package/dist/utility/wrun/wrun-live-tick.util.js +655 -97
  232. package/dist/utility/wrun/wrun-market-facts.util.d.ts +16 -2
  233. package/dist/utility/wrun/wrun-market-facts.util.js +32 -3
  234. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +27 -27
  235. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +28 -16
  236. package/dist/utility/wrun/wrun-market-size-defaults.util.js +34 -5
  237. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +10 -7
  238. package/dist/utility/wrun/wrun-oi-lane.util.js +16 -10
  239. package/dist/utility/wrun/wrun-option-strike-flow.util.js +1 -1
  240. package/dist/utility/wrun/wrun-option-views.util.d.ts +2 -2
  241. package/dist/utility/wrun/wrun-option-views.util.js +5 -2
  242. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.d.ts +5 -0
  243. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.js +16 -0
  244. package/dist/utility/wrun/wrun-options-stop.util.d.ts +3 -2
  245. package/dist/utility/wrun/wrun-options-stop.util.js +6 -4
  246. package/dist/utility/wrun/wrun-output-words.util.d.ts +14 -0
  247. package/dist/utility/wrun/wrun-output-words.util.js +51 -0
  248. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +116 -11
  249. package/dist/utility/wrun/wrun-overlay-drivers.util.js +208 -43
  250. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +20 -10
  251. package/dist/utility/wrun/wrun-overlay-park.util.d.ts +84 -0
  252. package/dist/utility/wrun/wrun-overlay-park.util.js +135 -0
  253. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +37 -4
  254. package/dist/utility/wrun/wrun-overlay-recovery.util.js +26 -14
  255. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +6 -1
  256. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  257. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +247 -26
  258. package/dist/utility/wrun/wrun-overlay-run.util.js +2234 -408
  259. package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
  260. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +11 -2
  261. package/dist/utility/wrun/wrun-panel-mount.util.js +122 -19
  262. package/dist/utility/wrun/wrun-panel-style.util.d.ts +4 -2
  263. package/dist/utility/wrun/wrun-panel-style.util.js +3 -2
  264. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +7 -0
  265. package/dist/utility/wrun/wrun-pin-spelling.util.js +18 -4
  266. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +26 -17
  267. package/dist/utility/wrun/wrun-pin-venues.util.js +43 -36
  268. package/dist/utility/wrun/wrun-pinned-lanes.util.d.ts +58 -0
  269. package/dist/utility/wrun/wrun-pinned-lanes.util.js +72 -0
  270. package/dist/utility/wrun/wrun-prefix-cohort.util.js +2 -1
  271. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +22 -9
  272. package/dist/utility/wrun/wrun-prefix-lanes.util.js +145 -26
  273. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +29 -0
  274. package/dist/utility/wrun/wrun-prefix-proof.util.js +23 -5
  275. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +9 -1
  276. package/dist/utility/wrun/wrun-refusal-surface.util.js +15 -1
  277. package/dist/utility/wrun/wrun-refusal.util.d.ts +19 -1
  278. package/dist/utility/wrun/wrun-refusal.util.js +103 -16
  279. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +20 -6
  280. package/dist/utility/wrun/wrun-registry-errors.util.js +20 -6
  281. package/dist/utility/wrun/wrun-replay-rows.util.js +6 -10
  282. package/dist/utility/wrun/wrun-run-health.util.d.ts +95 -5
  283. package/dist/utility/wrun/wrun-run-health.util.js +209 -3
  284. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +2 -2
  285. package/dist/utility/wrun/wrun-run-interval-session.util.js +2 -2
  286. package/dist/utility/wrun/wrun-run-interval.util.d.ts +9 -8
  287. package/dist/utility/wrun/wrun-run-interval.util.js +13 -11
  288. package/dist/utility/wrun/wrun-sandbox-row-source.js +5 -2
  289. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +38 -11
  290. package/dist/utility/wrun/wrun-script-inputs.util.js +194 -56
  291. package/dist/utility/wrun/wrun-session-composition.util.d.ts +81 -0
  292. package/dist/utility/wrun/wrun-session-composition.util.js +169 -0
  293. package/dist/utility/wrun/wrun-setting-words.util.d.ts +10 -7
  294. package/dist/utility/wrun/wrun-setting-words.util.js +25 -7
  295. package/dist/utility/wrun/wrun-source-rows.util.d.ts +94 -28
  296. package/dist/utility/wrun/wrun-source-rows.util.js +738 -93
  297. package/dist/utility/wrun/wrun-stream-clock.util.d.ts +45 -0
  298. package/dist/utility/wrun/wrun-stream-clock.util.js +108 -0
  299. package/dist/utility/wrun/wrun-style-names.util.d.ts +23 -0
  300. package/dist/utility/wrun/wrun-style-names.util.js +74 -0
  301. package/dist/utility/wrun/wrun-tape-coins.util.d.ts +116 -0
  302. package/dist/utility/wrun/wrun-tape-coins.util.js +110 -0
  303. package/dist/utility/wrun/wrun-tape-source.util.d.ts +62 -32
  304. package/dist/utility/wrun/wrun-tape-source.util.js +72 -34
  305. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +13 -5
  306. package/dist/utility/wrun/wrun-tier-grid.util.js +23 -13
  307. package/dist/utility/wrun/wrun-tpo-rows.util.js +2 -1
  308. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +73 -0
  309. package/dist/utility/wrun/wrun-trades-lane.util.js +82 -0
  310. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +5 -0
  311. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +9 -2
  312. package/dist/utility/wrun/wrun-visibility-table.d.ts +13 -0
  313. package/dist/utility/wrun/wrun-visibility-table.js +9 -0
  314. package/dist/utility/wrun/wrun-volume-profile.util.js +7 -3
  315. package/dist/utils/replay/replay-buffer-math.d.ts +16 -6
  316. package/dist/utils/replay/replay-buffer-math.js +60 -30
  317. package/dist/workers/constants/socket-slots.d.ts +11 -7
  318. package/dist/workers/constants/socket-slots.js +6 -5
  319. package/package.json +5 -5
@@ -20,7 +20,18 @@
20
20
  * A trades input pinned to another market (kit 0.77.0) reads a leg lane per
21
21
  * (quote, market), `trades@BYBIT|BTCUSDT`: its fetch key, live lane and
22
22
  * `tradeLegRows` key (docs: wrun-typed-inputs.md, "Coin legs").
23
+ *
24
+ * A leg lane is asked by ONE planner (`planWrunTradeLegAsk`, WRUN-PANBACK C): the
25
+ * whole run's window and a pan-back prefix page's ask the same request, a leg on
26
+ * the chart's own grid plainly and any other at the tier that fits both grids.
27
+ * The leg placement rules it reads (`wrunLegVenueOf`, `wrunLegStraddlesChartBars`,
28
+ * `wrunLegPlacementLeadMs`) are the pinned candle legs' too.
23
29
  */
30
+ import { Intervals } from '../../constants/interval.constants.js';
31
+ import { barEndMs, isCalendarIntervalMs } from '../chart/calendar-interval.util.js';
32
+ import { indexHostFetchTierMs, sourceRowsStraddleHostBars } from '../chart/index-host-tier.util.js';
33
+ import { liveBucketVenueOf } from '../chart/live-bucket.util.js';
34
+ import { wrunLegRidesNativeRows } from './wrun-pin-venues.util.js';
24
35
  export const WRUN_TRADES_LANES = {
25
36
  trades: { key: 'bsv' },
26
37
  trades_usd: { key: 'bsvusd', extras: { currency: 'USD' } },
@@ -56,3 +67,74 @@ export function wrunTradesLegExtras(lane) {
56
67
  const leg = wrunTradesLegOf(lane);
57
68
  return { symbol: leg.symbol, exchange: leg.exchange, ...WRUN_TRADES_LANES[leg.lane].extras, pinnedMarket: true };
58
69
  }
70
+ /** The chart's exchange word, when its venue names one. */
71
+ function wrunLegAskChartExchange(chart) {
72
+ return typeof chart.venue?.exchange === 'string' ? chart.venue.exchange : undefined;
73
+ }
74
+ /** A leg's own bar grid: its market (the chart's own where it names none) at the chart's session. */
75
+ export function wrunLegVenueOf(chart, market) {
76
+ return liveBucketVenueOf({
77
+ exchange: market?.exchange ?? wrunLegAskChartExchange(chart),
78
+ symbol: market?.symbol ?? chart.venue?.symbol,
79
+ sessionType: chart.venue?.sessionType,
80
+ });
81
+ }
82
+ /**
83
+ * Whether a leg's rows at `legMs` straddle the chart's bars (`sourceRowsStraddleHostBars`: a 24/7 market's :00 hours
84
+ * under a stock's 09:30-anchored bars, a crypto market's 4h bars on a CME chart's session lattice, or the reverse).
85
+ * Such a leg is placed on the chart's bars by the row builder alone (`wrunLegRowsOnHostBars`), so its asks ride
86
+ * dataFetch's native-rows path and its window opens one leg span early (`wrunLegPlacementLeadMs`): the chart's first
87
+ * bar is owed the row opening up to one leg span before it. A leg on the chart's own grid, or on a finer one dividing
88
+ * it, never straddles, and a leg coarser than the chart is never placed.
89
+ */
90
+ export function wrunLegStraddlesChartBars(chart, legMs, market) {
91
+ return (legMs > 0 &&
92
+ legMs <= chart.intervalMs &&
93
+ !isCalendarIntervalMs(legMs) &&
94
+ sourceRowsStraddleHostBars(chart.intervalMs, liveBucketVenueOf(chart.venue), legMs, wrunLegVenueOf(chart, market)));
95
+ }
96
+ /** The span a leg's window opens before the chart's first bar: one leg span where its rows straddle the chart's bars
97
+ * (`wrunLegStraddlesChartBars`), else none. */
98
+ export function wrunLegPlacementLeadMs(chart, legMs, market) {
99
+ return wrunLegStraddlesChartBars(chart, legMs, market) ? legMs : 0;
100
+ }
101
+ /** The chart's spelling of an interval span (an `Intervals.map_unit` key), the run's own: wrun-source-rows.util
102
+ * `wrunChartIntervalKeyOf`, which imports this module, so the word is spelled here by the same rule (the trades legs
103
+ * spec pins the two over every interval). */
104
+ function wrunLegTierIntervalKey(intervalMs) {
105
+ const entry = Object.entries(Intervals.map_unit).find(([, ms]) => ms === intervalMs);
106
+ return entry ? entry[0] : `${intervalMs}ms`;
107
+ }
108
+ /**
109
+ * The request a trades leg lane is asked with over a window `[fromMs, toMs]` (the run window's first bar through its
110
+ * last bar's open), on the chart `chart`: the whole run's ask (wrun-overlay-run.util, the browser lanes) and a
111
+ * pan-back prefix page's (`acquireWrunPrefixLanePages`) alike, so a page asks a leg exactly as the whole run it stands
112
+ * in for would. A trades leg rides the grid-leg model: its rows stay on its own market's grid and the row builder sums
113
+ * them into the chart bars holding them (wrun-source-rows `tradeLegRowsOf`). On an index-mode chart or market, and
114
+ * wherever its rows straddle the chart's bars (`wrunLegStraddlesChartBars`), it is asked at a tier (`tier`): the
115
+ * native-rows path (its rows at their own stamps, never placed on the chart's bars by the fetch) at the tier that fits
116
+ * every chart bar and every leg bar (`indexHostFetchTierMs`: 30m under a stock's :30 hours, so each bar sums whole
117
+ * tier rows; the chart's interval on a timestamp-mode chart), the chart's bars asked whole (through the last bar's
118
+ * close, from one tier row early where the rows straddle). The tier and the path ride its acquisition, which the
119
+ * intake folds the live prints at and the reconcile asks again. Elsewhere (a 24/7 leg on a 24/7 chart) the ask is the
120
+ * chart's own window at the chart's interval (`tier` null). Undefined for a lane that names no leg market.
121
+ */
122
+ export function planWrunTradeLegAsk(lane, chart, window) {
123
+ const leg = wrunTradesLegOf(lane);
124
+ if (leg === undefined)
125
+ return undefined;
126
+ const extras = wrunTradesLegExtras(lane);
127
+ const tierMs = indexHostFetchTierMs(chart.intervalMs, liveBucketVenueOf(chart.venue), [wrunLegVenueOf(chart, leg)]);
128
+ const native = wrunLegRidesNativeRows({ market: { exchange: leg.exchange } }, wrunLegAskChartExchange(chart)) ||
129
+ wrunLegStraddlesChartBars(chart, tierMs, leg);
130
+ if (!native)
131
+ return { lane, type: 'buy_sell_volume', extras, fromMs: window.fromMs, toMs: window.toMs, tier: null };
132
+ return {
133
+ lane,
134
+ type: 'buy_sell_volume',
135
+ extras,
136
+ fromMs: window.fromMs - wrunLegPlacementLeadMs(chart, tierMs, leg),
137
+ toMs: barEndMs(window.toMs, chart.intervalMs),
138
+ tier: { tierMs, extras: { ...extras, interval: wrunLegTierIntervalKey(tierMs), nativeRows: true } },
139
+ };
140
+ }
@@ -10,5 +10,10 @@
10
10
  * are style names). The kScript stand-in keys a twin's last drawing on these
11
11
  * values, so a period change moves the key and a colour pick or a Visible
12
12
  * flip does not. Declaration order, each name once; empty without rows.
13
+ *
14
+ * It reads the rows as handed over, on every key the stand-in builds: a
15
+ * caller holding a framework's reactive view hands over the plain objects
16
+ * (the web stand-in reads Vue's raw rows), since a row read through such a
17
+ * view comes back wrapped in a proxy of its own.
13
18
  */
14
19
  export declare function wrunTwinComputeInputNames(settings: unknown): string[];
@@ -37,6 +37,11 @@ function nonEmptyString(value) {
37
37
  * are style names). The kScript stand-in keys a twin's last drawing on these
38
38
  * values, so a period change moves the key and a colour pick or a Visible
39
39
  * flip does not. Declaration order, each name once; empty without rows.
40
+ *
41
+ * It reads the rows as handed over, on every key the stand-in builds: a
42
+ * caller holding a framework's reactive view hands over the plain objects
43
+ * (the web stand-in reads Vue's raw rows), since a row read through such a
44
+ * view comes back wrapped in a proxy of its own.
40
45
  */
41
46
  export function wrunTwinComputeInputNames(settings) {
42
47
  const rows = isRecord(settings) && Array.isArray(settings.scriptInputs) ? settings.scriptInputs : [];
@@ -49,9 +54,11 @@ export function wrunTwinComputeInputNames(settings) {
49
54
  continue;
50
55
  if (typeof row.type !== 'string' || !WRUN_TWIN_COMPUTE_ROW_TYPES.has(row.type))
51
56
  continue;
52
- const options = Array.isArray(row.options) ? row.options.map(Number) : undefined;
53
- if (row.type === 'select' && options?.some((value) => !Number.isFinite(value)))
57
+ if (row.type === 'select' &&
58
+ Array.isArray(row.options) &&
59
+ row.options.some((value) => !Number.isFinite(Number(value)))) {
54
60
  continue;
61
+ }
55
62
  names.add(name);
56
63
  }
57
64
  return [...names];
@@ -177,6 +177,15 @@ export type WrunVisibilityRule = {
177
177
  prefix: string;
178
178
  kinds: Readonly<Record<string, WrunVisibilityKindRule | 'not-drawn'>>;
179
179
  };
180
+ /**
181
+ * The section kinds the chart draws ahead of the kit release that lists them (the rule of
182
+ * wrun-section-kinds.util: a new kind is drawn before the kit bump lands), none while the kit lists every kind the
183
+ * chart draws. This table and WRUN_CHART_SECTION_DRAWS hold them beside the kit's union, and their specs read the
184
+ * kit's runtime list plus these; the bump whose kit lists a kind takes it out of here (the visibility spec fails
185
+ * until it does).
186
+ */
187
+ export declare const WRUN_SECTION_KINDS_AHEAD_OF_KIT: readonly [];
188
+ export type WrunSectionKindAheadOfKit = (typeof WRUN_SECTION_KINDS_AHEAD_OF_KIT)[number];
180
189
  /** THE table, in Style page order (its key order is the order a sheet's targets are offered). */
181
190
  export declare const WRUN_VISIBILITY_RULES: Readonly<{
182
191
  readonly outputs: {
@@ -366,6 +375,10 @@ export declare const WRUN_VISIBILITY_RULES: Readonly<{
366
375
  readonly prefix: "rays";
367
376
  readonly group: "skip";
368
377
  };
378
+ readonly flags: {
379
+ readonly prefix: "flags";
380
+ readonly group: "skip";
381
+ };
369
382
  readonly strategy: "not-drawn";
370
383
  readonly presentation: "not-drawn";
371
384
  readonly stats_strip: "not-drawn";
@@ -48,6 +48,14 @@ export const WRUN_HANDLE_KIND_RULES = Object.freeze({
48
48
  label: { group: 'drawing' },
49
49
  polyline: { group: 'drawing' },
50
50
  });
51
+ /**
52
+ * The section kinds the chart draws ahead of the kit release that lists them (the rule of
53
+ * wrun-section-kinds.util: a new kind is drawn before the kit bump lands), none while the kit lists every kind the
54
+ * chart draws. This table and WRUN_CHART_SECTION_DRAWS hold them beside the kit's union, and their specs read the
55
+ * kit's runtime list plus these; the bump whose kit lists a kind takes it out of here (the visibility spec fails
56
+ * until it does).
57
+ */
58
+ export const WRUN_SECTION_KINDS_AHEAD_OF_KIT = Object.freeze([]);
51
59
  /** THE table, in Style page order (its key order is the order a sheet's targets are offered). */
52
60
  export const WRUN_VISIBILITY_RULES = Object.freeze({
53
61
  outputs: { prefix: '', kinds: WRUN_OUTPUT_PLOT_RULES },
@@ -66,6 +74,7 @@ export const WRUN_VISIBILITY_RULES = Object.freeze({
66
74
  marks: { prefix: 'marks', group: 'skip' },
67
75
  spans: { prefix: 'spans', group: 'skip' },
68
76
  rays: { prefix: 'rays', group: 'skip' },
77
+ flags: { prefix: 'flags', group: 'skip' },
69
78
  strategy: 'not-drawn',
70
79
  presentation: 'not-drawn',
71
80
  stats_strip: 'not-drawn',
@@ -17,7 +17,7 @@
17
17
  import { Intervals } from '../../constants/interval.constants.js';
18
18
  import { barEndMs, barStartMs } from '../chart/calendar-interval.util.js';
19
19
  import { intervalLabelForMs } from '../chart/interval-ladder.util.js';
20
- import { profileRowMultiplier } from '../chart/profile-row-height.util.js';
20
+ import { viewScaledProfileRowMultiplier } from '../chart/profile-row-height.util.js';
21
21
  import { marketSessionAtOrBefore, marketSessionNamed, profileRegionSessionKeys, } from '../chart/market-sessions.util.js';
22
22
  import { getSessionInterval } from '../chart/session-interval.util.js';
23
23
  import { parseWrunThemeToken, wrunFontFamilyCss, wrunThemeTokenScaleAlpha } from './wrun-style-words.util.js';
@@ -54,7 +54,10 @@ function bucketWidthOf(rows) {
54
54
  const high = Number(bucket[1]);
55
55
  if (!Number.isFinite(low) || !Number.isFinite(high) || high <= low)
56
56
  continue;
57
- const candidate = high - low;
57
+ // Nine significant digits, like the profile workers' spacings (volume-profile.worker.util): a raw subtraction
58
+ // drifts (65000.2 - 65000.1 = 0.0999999999985), and decimalsOf would then print every level label with 8
59
+ // decimals (POC 65000.10000000).
60
+ const candidate = Number((high - low).toPrecision(9));
58
61
  if (width === undefined || candidate < width)
59
62
  width = candidate;
60
63
  }
@@ -230,7 +233,8 @@ export function wrunVolumeProfileChild(profile, cellRows, ctx) {
230
233
  }
231
234
  const bucketWidth = bucketWidthOf(rows);
232
235
  const rowHeight = profile.row_height ?? 'auto';
233
- const multiplier = rowHeight === 'auto' ? profileRowMultiplier('session', intervalLabel) : undefined;
236
+ // View-scaled on purpose (PROFILE-ROWS LEFT: titan's row cap).
237
+ const multiplier = rowHeight === 'auto' ? viewScaledProfileRowMultiplier('session', intervalLabel) : undefined;
234
238
  const barHeight = rowHeight === 'auto' ? (bucketWidth === undefined ? undefined : bucketWidth * (multiplier ?? 1)) : rowHeight;
235
239
  const dockLeft = (profile.dock ?? (span === 'visible' ? 'right' : 'left')) === 'left';
236
240
  const widthFrac = profile.width_frac ?? (span === 'session' || span === 'range' ? 0.7 : 0.2);
@@ -102,16 +102,25 @@ export interface AggregateOhlcvOptions {
102
102
  export declare function aggregateOhlcvRows(rows: number[][], bucketMs: number, minMs?: number, maxMs?: number, options?: AggregateOhlcvOptions): number[][];
103
103
  export declare function sourceGranularReplaySubRows(rows: number[][], minMs: number, maxMs: number): number[][];
104
104
  export declare function replaySubSourceIntervalMs(buffer: ReplayBuffer, chartIntervalMs: number): number;
105
+ /**
106
+ * The newest sub-row stamp playable at `targetMs`: every sub row stamped at or before it may show, none after it.
107
+ * A tick row is a point-in-time event, playable at its own stamp. A bar-lane row is start-stamped and covers
108
+ * [stamp, stamp + source interval): it plays once its last millisecond (stamp + interval - 1, the stamp an irregular
109
+ * timeline steps on, see playableRowsForBuffer) is at or before the target. Played at its open, it showed a whole
110
+ * sub-bar of future price. The one rule for every sub-row reader: the forming candle a seek and the replay bar read,
111
+ * the candle coverage check, and the replay clock's fold.
112
+ */
113
+ export declare function latestPlayableSubRowMs(buffer: ReplayBuffer, chartIntervalMs: number, targetMs: number): number;
105
114
  /**
106
115
  * Whether the sub rows already hold what the forming candle shows at the
107
116
  * playhead: on the tick rail a row inside [this step, playhead] of the active
108
- * chart bucket, on a bar lane a source row whose interval closed inside it.
117
+ * chart bucket, on a bar lane a source row playable inside it (latestPlayableSubRowMs).
109
118
  * Runs every clock tick (the candle coverage check); sub rows stay sorted, so
110
119
  * the first row at or past the earliest qualifying stamp decides instead of a
111
120
  * scan of the whole rail, which on bar lanes is never shed and grows one batch
112
121
  * per autoload.
113
122
  */
114
- export declare function replaySubRowsHoldFormingRow(buffer: ReplayBuffer, playheadMs: number, chartIntervalMs: number, stepMs: number, subSourceIntervalMs: number): boolean;
123
+ export declare function replaySubRowsHoldFormingRow(buffer: ReplayBuffer, playheadMs: number, chartIntervalMs: number, stepMs: number): boolean;
115
124
  export declare function formingChartRowFromSubRows(buffer: ReplayBuffer, chartIntervalMs: number, targetMs: number): number[] | null;
116
125
  export declare function mergeHeatmapColumns(existing: Float64Array[], incoming: Float64Array[]): Float64Array[];
117
126
  export declare function mergeHeatmapColumnsIncrementally(existing: Float64Array[], incoming: Float64Array[]): Float64Array[];
@@ -148,14 +157,15 @@ export type ReplayBarVenue = LiveBucketVenue | null;
148
157
  */
149
158
  export declare function replayBarKeyMs(timestampMs: number, chartIntervalMs: number, venue: ReplayBarVenue): number | null;
150
159
  /**
151
- * The OPEN of the bar keyed `barKeyMs`: its key, except a CME trade-date bar (1d, 3d, 1w) keyed
152
- * 00:00Z, which opens at the 17:00 Chicago open the evening before (`cmeSessionBarOpenMs`).
160
+ * The OPEN of the bar keyed `barKeyMs`: its key, except a session-lattice trade-date bar (1d, 3d,
161
+ * 1w) keyed 00:00Z, which opens at the session open the evening before (`venueSessionLatticeBarOpenMs`:
162
+ * 17:00 Chicago on the CME family, 17:00 New York on forex).
153
163
  */
154
164
  export declare function replayBarOpenMs(barKeyMs: number, chartIntervalMs: number, venue: ReplayBarVenue): number;
155
165
  /**
156
166
  * The END of the bar keyed `barKeyMs`, the instant it stops taking rows: its key plus the interval
157
- * on the plain grid; the CME lattice's own end (`cmeSessionBarEndMs`: a 1d bar runs to the next
158
- * 17:00 Chicago open, a fall-back Sunday's 4h bar an hour longer); a calendar bar's calendar end;
167
+ * on the plain grid; the session lattice's own end (`venueSessionLatticeBarEndMs`: a 1d bar runs to
168
+ * the next session open, a fall-back Sunday's 4h bar an hour longer); a calendar bar's calendar end;
159
169
  * and on a session grid the end of its last session (an RTH stub at the 20:15Z close, a stock's 3d
160
170
  * bar at its third session's 16:00 close), walked once per bar on the quarter-hour probe.
161
171
  */
@@ -2,8 +2,7 @@ import { Intervals } from '../../constants/interval.constants.js';
2
2
  import { intervalLabelForMs } from '../../utility/chart/interval-registry.util.js';
3
3
  import { CANDLE_TICK_BACKFILL_SEC, FALLBACK_VIEW_BEHIND_MS, FOLLOW_SPAN_ECHO_TOLERANCE_BARS, MONDAY_BUCKET_ORIGIN_MS, REPLAY_COARSE_FORWARD_BATCH, REPLAY_FOLLOW_RIGHT_OFFSET_FRACTION, REPLAY_FORWARD_BATCH, } from '../../constants/replay-ladder.leaf.js';
4
4
  import { barEndMs, calendarMonthsOfMs } from '../../utility/chart/calendar-interval.util.js';
5
- import { cmeSessionBarEndMs, cmeSessionBarOpenMs } from '../../utility/chart/cme-session-bucket.util.js';
6
- import { cmeSessionLatticeBucketMs, liveBucketStartMs, } from '../../utility/chart/live-bucket.util.js';
5
+ import { liveBucketStartMs, venueSessionLatticeBarEndMs, venueSessionLatticeBarOpenMs, venueSessionLatticeBucketMs, } from '../../utility/chart/live-bucket.util.js';
7
6
  import { replayResolutionBookEdgeSec, replayResolutionStepMs, tfLabelForMs } from '../../replay/replayLadder.js';
8
7
  const DAY_MS = Intervals.DAY;
9
8
  const WEEK_MS = Intervals.WEEK;
@@ -378,10 +377,16 @@ export function aggregateOhlcvRows(rows, bucketMs, minMs = -Infinity, maxMs = In
378
377
  }
379
378
  return Array.from(byBucket.values()).sort((a, b) => a[0] - b[0]);
380
379
  }
380
+ /** The step a sub-row rail collapses to (playableRowsForBuffer). */
381
+ function replaySubStepMs(buffer, chartIntervalMs) {
382
+ return buffer.subStepMs ?? replayResolutionMs(buffer.tf, chartIntervalMs);
383
+ }
384
+ /** A collapsed step wider than a second (a bar lane) is stamped at its last millisecond, the 1s tick step at its open. */
385
+ const subStepStampedAtEnd = (stepMs) => stepMs > Intervals.SECOND;
381
386
  function aggregateReplaySubRows(rows, stepMs, minMs, maxMs, originMs) {
382
387
  return aggregateOhlcvRows(rows, stepMs, minMs, maxMs, {
383
388
  originMs,
384
- timestamp: stepMs > Intervals.SECOND ? 'end' : 'start',
389
+ timestamp: subStepStampedAtEnd(stepMs) ? 'end' : 'start',
385
390
  });
386
391
  }
387
392
  export function sourceGranularReplaySubRows(rows, minMs, maxMs) {
@@ -400,16 +405,27 @@ export function replaySubSourceIntervalMs(buffer, chartIntervalMs) {
400
405
  : sourceIntervalMsForLabel(replayResolutionSourceLabel(buffer.tf, chartIntervalMs));
401
406
  return requestIntervalMs ?? replayResolutionMs(buffer.tf, chartIntervalMs);
402
407
  }
408
+ /**
409
+ * The newest sub-row stamp playable at `targetMs`: every sub row stamped at or before it may show, none after it.
410
+ * A tick row is a point-in-time event, playable at its own stamp. A bar-lane row is start-stamped and covers
411
+ * [stamp, stamp + source interval): it plays once its last millisecond (stamp + interval - 1, the stamp an irregular
412
+ * timeline steps on, see playableRowsForBuffer) is at or before the target. Played at its open, it showed a whole
413
+ * sub-bar of future price. The one rule for every sub-row reader: the forming candle a seek and the replay bar read,
414
+ * the candle coverage check, and the replay clock's fold.
415
+ */
416
+ export function latestPlayableSubRowMs(buffer, chartIntervalMs, targetMs) {
417
+ return buffer.tf.kind === 'tick' ? targetMs : targetMs - replaySubSourceIntervalMs(buffer, chartIntervalMs) + 1;
418
+ }
403
419
  /**
404
420
  * Whether the sub rows already hold what the forming candle shows at the
405
421
  * playhead: on the tick rail a row inside [this step, playhead] of the active
406
- * chart bucket, on a bar lane a source row whose interval closed inside it.
422
+ * chart bucket, on a bar lane a source row playable inside it (latestPlayableSubRowMs).
407
423
  * Runs every clock tick (the candle coverage check); sub rows stay sorted, so
408
424
  * the first row at or past the earliest qualifying stamp decides instead of a
409
425
  * scan of the whole rail, which on bar lanes is never shed and grows one batch
410
426
  * per autoload.
411
427
  */
412
- export function replaySubRowsHoldFormingRow(buffer, playheadMs, chartIntervalMs, stepMs, subSourceIntervalMs) {
428
+ export function replaySubRowsHoldFormingRow(buffer, playheadMs, chartIntervalMs, stepMs) {
413
429
  const subRows = buffer.subRows;
414
430
  if (!subRows?.length)
415
431
  return false;
@@ -422,6 +438,7 @@ export function replaySubRowsHoldFormingRow(buffer, playheadMs, chartIntervalMs,
422
438
  const formingFromMs = tickRail
423
439
  ? Math.max(activeBucketStartMs, Math.floor(playheadMs / stepMs) * stepMs)
424
440
  : activeBucketStartMs;
441
+ const playableToMs = latestPlayableSubRowMs(buffer, chartIntervalMs, playheadMs);
425
442
  // The first row the grid books to the active bar (a fall-back night interleaves other bars' rows).
426
443
  const barOf = replayBarKeyReader(chartIntervalMs, venue);
427
444
  for (let index = sortedLowerBound(subRows, formingFromMs, (row) => row[0]); index < subRows.length; index++) {
@@ -431,7 +448,7 @@ export function replaySubRowsHoldFormingRow(buffer, playheadMs, chartIntervalMs,
431
448
  const barMs = barOf(rowMs);
432
449
  if (barMs !== activeBarMs && barMs !== null)
433
450
  continue;
434
- return tickRail ? rowMs <= playheadMs : rowMs + subSourceIntervalMs <= playheadMs;
451
+ return rowMs <= playableToMs;
435
452
  }
436
453
  return false;
437
454
  }
@@ -448,11 +465,9 @@ export function formingChartRowFromSubRows(buffer, chartIntervalMs, targetMs) {
448
465
  if (bucketKeyMs === null)
449
466
  return null;
450
467
  const bucketOpenMs = replayBarOpenMs(bucketKeyMs, chartIntervalMs, venue);
451
- // Tick rows are point-in-time events and retain their existing inclusive reveal semantics.
452
- // Bar-lane source rows are start-stamped and become playable only after their source interval closes.
453
- const completionOffsetMs = buffer.tf.kind === 'tick' ? 0 : replaySubSourceIntervalMs(buffer, chartIntervalMs);
454
468
  const startIndex = sortedLowerBound(buffer.subRows, bucketOpenMs, (row) => row[0]);
455
- const endIndex = sortedPrefixEnd(buffer.subRows, targetMs - completionOffsetMs, (row) => row[0], true);
469
+ const playableToMs = latestPlayableSubRowMs(buffer, chartIntervalMs, targetMs);
470
+ const endIndex = sortedPrefixEnd(buffer.subRows, playableToMs, (row) => row[0], true);
456
471
  const barOf = replayBarKeyReader(chartIntervalMs, venue);
457
472
  return foldRowsIntoBar(buffer.subRows.slice(startIndex, endIndex), bucketKeyMs, targetMs, (rowMs) => {
458
473
  const barMs = barOf(rowMs);
@@ -527,7 +542,7 @@ export function playableRowsForBuffer(buffer, chartIntervalMs) {
527
542
  // replayUsesSubRowRail already requires subRows; the local read only lets the compiler see it.
528
543
  const subRows = buffer.subRows;
529
544
  if (subRows !== undefined && replayUsesSubRowRail(buffer, chartIntervalMs)) {
530
- const stepMs = buffer.subStepMs ?? replayResolutionMs(buffer.tf, chartIntervalMs);
545
+ const stepMs = replaySubStepMs(buffer, chartIntervalMs);
531
546
  const originMs = buffer.subOriginMs ?? chartBucketOriginMs(stepMs);
532
547
  const memo = playableSubRowsMemo.get(buffer);
533
548
  if (memo && memo.stepMs === stepMs && memo.originMs === originMs && replayRowsStampMatches(memo.source, subRows)) {
@@ -655,19 +670,20 @@ export function replayBarKeyMs(timestampMs, chartIntervalMs, venue) {
655
670
  });
656
671
  }
657
672
  /**
658
- * The OPEN of the bar keyed `barKeyMs`: its key, except a CME trade-date bar (1d, 3d, 1w) keyed
659
- * 00:00Z, which opens at the 17:00 Chicago open the evening before (`cmeSessionBarOpenMs`).
673
+ * The OPEN of the bar keyed `barKeyMs`: its key, except a session-lattice trade-date bar (1d, 3d,
674
+ * 1w) keyed 00:00Z, which opens at the session open the evening before (`venueSessionLatticeBarOpenMs`:
675
+ * 17:00 Chicago on the CME family, 17:00 New York on forex).
660
676
  */
661
677
  export function replayBarOpenMs(barKeyMs, chartIntervalMs, venue) {
662
- if (venue && cmeSessionLatticeBucketMs(barKeyMs, chartIntervalMs, venue) === barKeyMs) {
663
- return cmeSessionBarOpenMs(barKeyMs, chartIntervalMs) ?? barKeyMs;
678
+ if (venue && venueSessionLatticeBucketMs(barKeyMs, chartIntervalMs, venue) === barKeyMs) {
679
+ return venueSessionLatticeBarOpenMs(barKeyMs, chartIntervalMs, venue) ?? barKeyMs;
664
680
  }
665
681
  return barKeyMs;
666
682
  }
667
683
  /**
668
684
  * The END of the bar keyed `barKeyMs`, the instant it stops taking rows: its key plus the interval
669
- * on the plain grid; the CME lattice's own end (`cmeSessionBarEndMs`: a 1d bar runs to the next
670
- * 17:00 Chicago open, a fall-back Sunday's 4h bar an hour longer); a calendar bar's calendar end;
685
+ * on the plain grid; the session lattice's own end (`venueSessionLatticeBarEndMs`: a 1d bar runs to
686
+ * the next session open, a fall-back Sunday's 4h bar an hour longer); a calendar bar's calendar end;
671
687
  * and on a session grid the end of its last session (an RTH stub at the 20:15Z close, a stock's 3d
672
688
  * bar at its third session's 16:00 close), walked once per bar on the quarter-hour probe.
673
689
  */
@@ -675,8 +691,8 @@ export function replayBarEndMs(barKeyMs, chartIntervalMs, venue) {
675
691
  const nominalEndMs = barKeyMs + chartIntervalMs;
676
692
  if (!venue)
677
693
  return nominalEndMs;
678
- if (cmeSessionLatticeBucketMs(barKeyMs, chartIntervalMs, venue) === barKeyMs) {
679
- return cmeSessionBarEndMs(barKeyMs, chartIntervalMs) ?? nominalEndMs;
694
+ if (venueSessionLatticeBucketMs(barKeyMs, chartIntervalMs, venue) === barKeyMs) {
695
+ return venueSessionLatticeBarEndMs(barKeyMs, chartIntervalMs, venue) ?? nominalEndMs;
680
696
  }
681
697
  if (calendarMonthsOfMs(chartIntervalMs) !== null)
682
698
  return barEndMs(barKeyMs, chartIntervalMs);
@@ -818,12 +834,8 @@ export function loadedBarsForRows(buffer, chartIntervalMs) {
818
834
  return Math.min(rawLoadedBars, maxLoadedBars);
819
835
  }
820
836
  const tfMs = replayResolutionMs(buffer.tf, chartIntervalMs);
821
- const rows = playableRowsForBuffer(buffer, chartIntervalMs);
822
- const maxTs = rows.reduce((max, row) => {
823
- const ts = row[0];
824
- return typeof ts === 'number' && ts > max ? ts : max;
825
- }, buffer.anchorMs);
826
- const rawLoadedBars = Math.max(0, Math.floor((maxTs - buffer.anchorMs) / tfMs));
837
+ const playedMs = Math.max(buffer.anchorMs, playableRowsEndMs(buffer, chartIntervalMs));
838
+ const rawLoadedBars = Math.max(0, Math.floor((playedMs - buffer.anchorMs) / tfMs));
827
839
  return Math.min(rawLoadedBars, maxLoadedBars);
828
840
  }
829
841
  export function encodedHeatmapColumn(time, source) {
@@ -863,17 +875,35 @@ export function downsampleHeatmapColumns(columns, stepMs, minMs = -Infinity, max
863
875
  }
864
876
  return Array.from(byBucket.values()).sort((a, b) => a[1] - b[1]);
865
877
  }
866
- /** Newest playable stamp after the anchor (-Infinity when none), memoized per buffer like the rows it scans. */
878
+ /**
879
+ * The instant the newest playable row after the anchor has played (-Infinity when none), memoized per buffer like
880
+ * the rows it scans. A chart row and a tick-rail step play at their stamp. A bar-lane rail runs on whole steps of
881
+ * its source rows: the newest source row has played at its close (stamp + source interval, latestPlayableSubRowMs),
882
+ * and the runway ends at the last step that close covers whole. A step holding only some of its source rows (a 10m
883
+ * step whose second 5m row has not loaded) stays outside, so playback stops at its open and the forward load starts
884
+ * there and fills it.
885
+ */
867
886
  function playableRowsEndMs(buffer, chartIntervalMs) {
868
887
  const rows = playableRowsForBuffer(buffer, chartIntervalMs);
869
888
  const memo = playableEndMemo.get(buffer);
870
889
  if (memo && memo.anchorMs === buffer.anchorMs && replayRowsStampMatches(memo.source, rows)) {
871
890
  return memo.endMs;
872
891
  }
873
- const endMs = rows.reduce((max, row) => {
874
- const ts = row[0];
875
- return typeof ts === 'number' && ts > buffer.anchorMs && ts > max ? ts : max;
876
- }, Number.NEGATIVE_INFINITY);
892
+ let endMs;
893
+ const subRows = buffer.subRows;
894
+ if (subRows !== undefined && replayUsesSubRowRail(buffer, chartIntervalMs) && buffer.tf.kind !== 'tick') {
895
+ const newestSourceMs = subRows.reduce((max, row) => (Number.isFinite(row[0]) && row[0] > max ? row[0] : max), Number.NEGATIVE_INFINITY);
896
+ const stepMs = replaySubStepMs(buffer, chartIntervalMs);
897
+ const playedMs = newestSourceMs + replaySubSourceIntervalMs(buffer, chartIntervalMs);
898
+ const wholeSteps = Math.floor((playedMs - buffer.anchorMs) / stepMs);
899
+ endMs = wholeSteps > 0 ? buffer.anchorMs + wholeSteps * stepMs : Number.NEGATIVE_INFINITY;
900
+ }
901
+ else {
902
+ endMs = rows.reduce((max, row) => {
903
+ const ts = row[0];
904
+ return typeof ts === 'number' && ts > buffer.anchorMs && ts > max ? ts : max;
905
+ }, Number.NEGATIVE_INFINITY);
906
+ }
877
907
  playableEndMemo.set(buffer, { source: replayRowsStamp(rows), anchorMs: buffer.anchorMs, endMs });
878
908
  return endMs;
879
909
  }
@@ -30,15 +30,19 @@ type SlotSubscribeParams = 'brotliV2' | null;
30
30
  * keeps the liveness verdict and the token push; the worker only pings a
31
31
  * socket nothing has written to for a while, so the gateway's 60 s read
32
32
  * deadline (WEBSOCKET_READ_DEADLINE) never cuts an idle background tab.
33
+ * `feedIdlePing`: the crypto feed trio, whose main-thread loop (liveFeedService)
34
+ * keeps the liveness verdict; the worker only pings a socket nothing has
35
+ * written to for a while, so the feed's 60 s read deadline never cuts a tab
36
+ * whose page timers are throttled.
33
37
  */
34
- export type SlotWorkerKeepalive = 'alertPing' | 'gatePing' | 'readerIdlePing' | null;
38
+ export type SlotWorkerKeepalive = 'alertPing' | 'gatePing' | 'readerIdlePing' | 'feedIdlePing' | null;
35
39
  /**
36
40
  * Keepalive loops the MAIN THREAD owns, named by their service. The one property
37
41
  * with no runtime reader by design — the loops live in the services, so there is
38
42
  * nothing to look up; the table-shape spec asserts every connectable slot names
39
43
  * an owner instead.
40
44
  */
41
- type SlotMainThreadKeepalive = 'v2PingPong' | 'liveFeedService' | 'alertService' | null;
45
+ type SlotMainThreadKeepalive = 'v2PingPong' | 'liveFeedService' | null;
42
46
  /** The gate base URLs, two per plane (contract C1: tier is a path over these, not a new env var). */
43
47
  type SlotUrlKey = 'CME_V2_WEB_SOCKET' | 'CME_LIVE_FEED_URL' | 'OPRA_V2_WEB_SOCKET' | 'OPRA_LIVE_FEED_URL' | 'STOCKS_V2_WEB_SOCKET' | 'STOCKS_LIVE_FEED_URL' | 'BLK_V2_WEB_SOCKET' | 'BLK_LIVE_FEED_URL' | null;
44
48
  type SlotPathPrefix = '/live/' | '/delayed/' | '';
@@ -78,7 +82,7 @@ export declare const SOCKET_SLOTS: {
78
82
  readonly auth: "frame";
79
83
  readonly sendsTierFrame: false;
80
84
  readonly subscribeParams: "brotliV2";
81
- readonly workerKeepalive: null;
85
+ readonly workerKeepalive: "feedIdlePing";
82
86
  readonly mainThreadKeepalive: "liveFeedService";
83
87
  readonly parkingSlot: "pendingCloseLiveFeed";
84
88
  readonly urlKey: null;
@@ -93,7 +97,7 @@ export declare const SOCKET_SLOTS: {
93
97
  readonly auth: "frame";
94
98
  readonly sendsTierFrame: false;
95
99
  readonly subscribeParams: "brotliV2";
96
- readonly workerKeepalive: null;
100
+ readonly workerKeepalive: "feedIdlePing";
97
101
  readonly mainThreadKeepalive: "liveFeedService";
98
102
  readonly parkingSlot: "pendingCloseLiveFeedOrderbook";
99
103
  readonly urlKey: null;
@@ -108,7 +112,7 @@ export declare const SOCKET_SLOTS: {
108
112
  readonly auth: "frame";
109
113
  readonly sendsTierFrame: false;
110
114
  readonly subscribeParams: "brotliV2";
111
- readonly workerKeepalive: null;
115
+ readonly workerKeepalive: "feedIdlePing";
112
116
  readonly mainThreadKeepalive: "liveFeedService";
113
117
  readonly parkingSlot: "pendingCloseLiveFeedInCluster";
114
118
  readonly urlKey: null;
@@ -198,7 +202,7 @@ export declare const SOCKET_SLOTS: {
198
202
  readonly auth: "none";
199
203
  readonly sendsTierFrame: false;
200
204
  readonly subscribeParams: null;
201
- readonly workerKeepalive: null;
205
+ readonly workerKeepalive: "readerIdlePing";
202
206
  readonly mainThreadKeepalive: "v2PingPong";
203
207
  readonly parkingSlot: null;
204
208
  readonly urlKey: "BLK_V2_WEB_SOCKET";
@@ -454,7 +458,7 @@ export declare const SOCKET_SLOTS: {
454
458
  readonly sendsTierFrame: false;
455
459
  readonly subscribeParams: null;
456
460
  readonly workerKeepalive: "alertPing";
457
- readonly mainThreadKeepalive: "alertService";
461
+ readonly mainThreadKeepalive: null;
458
462
  readonly parkingSlot: null;
459
463
  readonly urlKey: null;
460
464
  readonly pathPrefix: "";
@@ -29,7 +29,7 @@ export const SOCKET_SLOTS = {
29
29
  auth: 'frame',
30
30
  sendsTierFrame: false,
31
31
  subscribeParams: 'brotliV2',
32
- workerKeepalive: null,
32
+ workerKeepalive: 'feedIdlePing',
33
33
  mainThreadKeepalive: 'liveFeedService',
34
34
  parkingSlot: 'pendingCloseLiveFeed',
35
35
  urlKey: null,
@@ -44,7 +44,7 @@ export const SOCKET_SLOTS = {
44
44
  auth: 'frame',
45
45
  sendsTierFrame: false,
46
46
  subscribeParams: 'brotliV2',
47
- workerKeepalive: null,
47
+ workerKeepalive: 'feedIdlePing',
48
48
  mainThreadKeepalive: 'liveFeedService',
49
49
  parkingSlot: 'pendingCloseLiveFeedOrderbook',
50
50
  urlKey: null,
@@ -59,7 +59,7 @@ export const SOCKET_SLOTS = {
59
59
  auth: 'frame',
60
60
  sendsTierFrame: false,
61
61
  subscribeParams: 'brotliV2',
62
- workerKeepalive: null,
62
+ workerKeepalive: 'feedIdlePing',
63
63
  mainThreadKeepalive: 'liveFeedService',
64
64
  parkingSlot: 'pendingCloseLiveFeedInCluster',
65
65
  urlKey: null,
@@ -155,7 +155,7 @@ export const SOCKET_SLOTS = {
155
155
  auth: 'none',
156
156
  sendsTierFrame: false,
157
157
  subscribeParams: null,
158
- workerKeepalive: null,
158
+ workerKeepalive: 'readerIdlePing',
159
159
  mainThreadKeepalive: 'v2PingPong',
160
160
  parkingSlot: null,
161
161
  urlKey: 'BLK_V2_WEB_SOCKET',
@@ -421,8 +421,9 @@ export const SOCKET_SLOTS = {
421
421
  auth: 'frame',
422
422
  sendsTierFrame: false,
423
423
  subscribeParams: null,
424
+ // The worker's alertPing is the socket's one ping and one liveness verdict (alerts-socket-4).
424
425
  workerKeepalive: 'alertPing',
425
- mainThreadKeepalive: 'alertService',
426
+ mainThreadKeepalive: null,
426
427
  parkingSlot: null,
427
428
  urlKey: null,
428
429
  pathPrefix: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangecharts/wrun-chart-host",
3
- "version": "0.11.1",
3
+ "version": "0.15.0",
4
4
  "description": "The wrun chart-host layer shared by the kiyotaka web app and the mobile app: the wrun result reader and painter model, cut from the web app (its reference implementation).",
5
5
  "type": "module",
6
6
  "files": [
@@ -28,14 +28,14 @@
28
28
  "typecheck": "tsc -p tsconfig.json --noEmit"
29
29
  },
30
30
  "peerDependencies": {
31
- "@orangecharts/indicator-kit": "0.106.5",
32
- "@orangecharts/orange-v2-pb-common": "12.79.0",
31
+ "@orangecharts/indicator-kit": "0.116.1",
32
+ "@orangecharts/orange-v2-pb-common": "12.82.0",
33
33
  "dayjs": "1.11.23",
34
34
  "lodash-es": "4.18.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@orangecharts/indicator-kit": "0.106.5",
38
- "@orangecharts/orange-v2-pb-common": "12.79.0",
37
+ "@orangecharts/indicator-kit": "0.116.1",
38
+ "@orangecharts/orange-v2-pb-common": "12.82.0",
39
39
  "@types/lodash-es": "4.17.12",
40
40
  "dayjs": "1.11.23",
41
41
  "lodash-es": "4.18.1",