@orangecharts/wrun-chart-host 0.4.0 → 0.5.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 (322) hide show
  1. package/README.md +15 -4
  2. package/dist/constants/exchange-names.leaf.d.ts +8 -0
  3. package/dist/constants/exchange-names.leaf.js +101 -0
  4. package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
  5. package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
  6. package/dist/constants/opra-compliance.constants.d.ts +19 -0
  7. package/dist/constants/opra-compliance.constants.js +19 -0
  8. package/dist/constants/replay-ladder.leaf.d.ts +30 -0
  9. package/dist/constants/replay-ladder.leaf.js +99 -0
  10. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
  11. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
  12. package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
  13. package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
  14. package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
  15. package/dist/constants/scriptEditor/execution.constants.js +14 -0
  16. package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
  17. package/dist/constants/wrun-prefix-safe.constants.js +26 -0
  18. package/dist/host-env.d.ts +313 -18
  19. package/dist/host-env.js +15 -0
  20. package/dist/host-ports.types.d.ts +853 -16
  21. package/dist/index.d.ts +139 -2
  22. package/dist/index.js +139 -2
  23. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
  24. package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
  25. package/dist/interfaces/market-event.interface.d.ts +231 -0
  26. package/dist/interfaces/market-event.interface.js +15 -0
  27. package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
  28. package/dist/interfaces/opra-realtime.interface.js +34 -59
  29. package/dist/interfaces/replay.interface.d.ts +285 -0
  30. package/dist/interfaces/replay.interface.js +1 -0
  31. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
  32. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
  33. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
  34. package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
  35. package/dist/market-data/billing.interface.d.ts +219 -0
  36. package/dist/market-data/billing.interface.js +58 -0
  37. package/dist/market-data/venue-governed.util.d.ts +2 -0
  38. package/dist/market-data/venue-governed.util.js +10 -0
  39. package/dist/market-data/venue.d.ts +122 -0
  40. package/dist/market-data/venue.js +1 -0
  41. package/dist/market-data/venues/index.d.ts +97 -0
  42. package/dist/market-data/venues/index.js +33 -0
  43. package/dist/market-data/venues/opra.contract.copy.json +35 -0
  44. package/dist/market-data/venues/opra.d.ts +70 -0
  45. package/dist/market-data/venues/opra.js +74 -0
  46. package/dist/replay/replayIndicatorRows.d.ts +31 -0
  47. package/dist/replay/replayIndicatorRows.js +117 -0
  48. package/dist/replay/replayLadder.d.ts +85 -0
  49. package/dist/replay/replayLadder.js +388 -0
  50. package/dist/utility/auth/server-clock.util.d.ts +81 -0
  51. package/dist/utility/auth/server-clock.util.js +238 -0
  52. package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
  53. package/dist/utility/chart/builtin-identity.util.js +51 -0
  54. package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
  55. package/dist/utility/chart/cache-alignment.util.js +926 -0
  56. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
  57. package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
  58. package/dist/utility/chart/chart-mount-epoch.util.d.ts +5 -0
  59. package/dist/utility/chart/chart-mount-epoch.util.js +29 -0
  60. package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
  61. package/dist/utility/chart/chart-time-domain.util.js +23 -0
  62. package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
  63. package/dist/utility/chart/color-customization.leaf.js +16 -0
  64. package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
  65. package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
  66. package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
  67. package/dist/utility/chart/gesture-timing.leaf.js +29 -0
  68. package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
  69. package/dist/utility/chart/governed-contract-coin.util.js +39 -0
  70. package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
  71. package/dist/utility/chart/host-bar-placement.util.js +447 -0
  72. package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
  73. package/dist/utility/chart/index-host-tier.util.js +118 -0
  74. package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
  75. package/dist/utility/chart/index-mode-admission.util.js +67 -0
  76. package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
  77. package/dist/utility/chart/indicator-error-message.util.js +44 -0
  78. package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
  79. package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
  80. package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
  81. package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
  82. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
  83. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
  84. package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
  85. package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
  86. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
  87. package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
  88. package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
  89. package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
  90. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
  91. package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
  92. package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
  93. package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
  94. package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
  95. package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
  96. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
  97. package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
  98. package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
  99. package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
  100. package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
  101. package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
  102. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
  103. package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
  104. package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
  105. package/dist/utility/chart/kscript-source-retention.util.js +218 -0
  106. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
  107. package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
  108. package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
  109. package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
  110. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
  111. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
  112. package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
  113. package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
  114. package/dist/utility/chart/live-cadence.util.d.ts +38 -0
  115. package/dist/utility/chart/live-cadence.util.js +37 -0
  116. package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
  117. package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
  118. package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
  119. package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
  120. package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
  121. package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
  122. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
  123. package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
  124. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
  125. package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
  126. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
  127. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
  128. package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
  129. package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
  130. package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
  131. package/dist/utility/chart/mixed-mode.util.js +139 -0
  132. package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
  133. package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
  134. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
  135. package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
  136. package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
  137. package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
  138. package/dist/utility/chart/price-precision.util.d.ts +40 -0
  139. package/dist/utility/chart/price-precision.util.js +70 -0
  140. package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
  141. package/dist/utility/chart/profile-block-size.util.js +141 -0
  142. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
  143. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
  144. package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
  145. package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
  146. package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
  147. package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
  148. package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
  149. package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
  150. package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
  151. package/dist/utility/chart/titan-constants.pin.js +18 -5
  152. package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
  153. package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
  154. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
  155. package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
  156. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
  157. package/dist/utility/chart/wrun-run-result.util.js +20 -14
  158. package/dist/utility/common/data-processing.util.d.ts +138 -0
  159. package/dist/utility/common/data-processing.util.js +346 -0
  160. package/dist/utility/common/visible-timeout.util.d.ts +13 -4
  161. package/dist/utility/common/visible-timeout.util.js +23 -8
  162. package/dist/utility/exchange-format.leaf.d.ts +1 -0
  163. package/dist/utility/exchange-format.leaf.js +47 -0
  164. package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
  165. package/dist/utility/market-events/earnings-scope.util.js +92 -0
  166. package/dist/utility/market-events/market-events.util.d.ts +147 -0
  167. package/dist/utility/market-events/market-events.util.js +392 -0
  168. package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
  169. package/dist/utility/market-events/zoned-clock.util.js +11 -0
  170. package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
  171. package/dist/utility/options/option-venue-disclosure.util.js +56 -0
  172. package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
  173. package/dist/utility/scriptEditor/package-semver.util.js +120 -0
  174. package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
  175. package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
  176. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
  177. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
  178. package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
  179. package/dist/utility/v2/governed-tier.leaf.js +113 -0
  180. package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
  181. package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
  182. package/dist/utility/wrun/sources/lanes/series.js +2 -2
  183. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +4 -4
  184. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +5 -6
  185. package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
  186. package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
  187. package/dist/utility/wrun/wrun-bar-count.util.d.ts +83 -0
  188. package/dist/utility/wrun/wrun-bar-count.util.js +259 -0
  189. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
  190. package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
  191. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
  192. package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
  193. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
  194. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
  195. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
  196. package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
  197. package/dist/utility/wrun/wrun-deadline.util.js +2 -1
  198. package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
  199. package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
  200. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
  201. package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
  202. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
  203. package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
  204. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
  205. package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
  206. package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
  207. package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
  208. package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
  209. package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
  210. package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
  211. package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
  212. package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
  213. package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
  214. package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
  215. package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
  216. package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
  217. package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
  218. package/dist/utility/wrun/wrun-host.service.d.ts +266 -0
  219. package/dist/utility/wrun/wrun-host.service.js +655 -0
  220. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
  221. package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
  222. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
  223. package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
  224. package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
  225. package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
  226. package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
  227. package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
  228. package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
  229. package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
  230. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
  231. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
  232. package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
  233. package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
  234. package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
  235. package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
  236. package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
  237. package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
  238. package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
  239. package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
  240. package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
  241. package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
  242. package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
  243. package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
  244. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
  245. package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
  246. package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
  247. package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
  248. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
  249. package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
  250. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
  251. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
  252. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
  253. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
  254. package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
  255. package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
  256. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
  257. package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
  258. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
  259. package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
  260. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +24 -9
  261. package/dist/utility/wrun/wrun-panel-mount.util.js +138 -43
  262. package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
  263. package/dist/utility/wrun/wrun-param-map.util.js +40 -47
  264. package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
  265. package/dist/utility/wrun/wrun-param-values.util.js +5 -5
  266. package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
  267. package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
  268. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
  269. package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
  270. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
  271. package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
  272. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
  273. package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
  274. package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
  275. package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
  276. package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
  277. package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
  278. package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
  279. package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
  280. package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
  281. package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
  282. package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
  283. package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
  284. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
  285. package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
  286. package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
  287. package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
  288. package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
  289. package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
  290. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
  291. package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
  292. package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
  293. package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
  294. package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
  295. package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
  296. package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
  297. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
  298. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
  299. package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
  300. package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
  301. package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
  302. package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
  303. package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
  304. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
  305. package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
  306. package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
  307. package/dist/utility/wrun/wrun-text-params.util.js +19 -30
  308. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
  309. package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
  310. package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
  311. package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
  312. package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
  313. package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
  314. package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
  315. package/dist/utility/wrun-alert-params.leaf.js +24 -0
  316. package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
  317. package/dist/utils/replay/replay-buffer-math.js +684 -0
  318. package/dist/workers/wrun/wrun-abi-host.d.ts +190 -0
  319. package/dist/workers/wrun/wrun-abi-host.js +1201 -0
  320. package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
  321. package/dist/workers/wrun/wrun-engine-handler.js +211 -0
  322. package/package.json +3 -3
@@ -1,55 +1,53 @@
1
- /** Every OPRA-governed exchange code (one consolidated venue by design). */
2
- export const OPRA_GOVERNED_EXCHANGES = ['OPRA'];
1
+ import { OPRA_VENUE } from '../market-data/venues/opra.js';
2
+ import { MarketDataBillingError, isMarketDataAgreementCurrent, isMarketDataAttestationCurrent, isMarketDataAttestationLive, isMarketDataNonProfessional, isMarketDataProfessionalDeclaration, marketDataAttestationRenewBy, } from '../market-data/billing.interface.js';
3
+ /** Every OPRA-governed exchange code (one consolidated venue by design): the OPRA card's product groups. */
4
+ export const OPRA_GOVERNED_EXCHANGES = OPRA_VENUE.productGroups;
3
5
  /** OPRA defines delayed data as at least 15 minutes old; the gate's delayed window matches. */
4
- export const OPRA_DELAY_MINUTES = 15;
6
+ export const OPRA_DELAY_MINUTES = OPRA_VENUE.delayMinutes;
5
7
  // ---------------------------------------------------------------------------
6
- // Billing wire proposal for the `/opra/*` twin of `/cme/*` (the backend does
7
- // not exist yet; this is the schema the frontend builds against and the
8
- // backend must implement or renegotiate). Differences from CME are deliberate:
9
- // one product, no depth, non-professional only, and EXPLICIT agreement
10
- // acceptance (never inferred from a grant or a subscription).
8
+ // The frozen billing contract of `/opra/*`, the OPRA twin of `/cme/*` (orange's OPRA routes implement it; the service
9
+ // speaks it in one place, src/services/opra-realtime.service.ts, through the venue-generic market-data service).
10
+ // Differences from CME are deliberate: one product, no depth, non-professional only, EXPLICIT agreement acceptance
11
+ // (never inferred from a grant or a subscription), and pay first: the declaration and the agreement bind real-time
12
+ // ACCESS, not the payment, so checkout needs neither and the server serves real-time only once the account is both
13
+ // paid and qualified (delayed otherwise).
11
14
  // ---------------------------------------------------------------------------
12
15
  /** The one OPRA plan: real-time top of book, billed monthly. */
13
- export const OPRA_REALTIME_MONTHLY_USD = 4.95;
14
- export const OPRA_ATTESTATION_FORM_VERSION = 'opra-v1';
16
+ export const OPRA_REALTIME_MONTHLY_USD = OPRA_VENUE.products[0].priceUsd;
15
17
  /**
16
- * POST /opra/attestation request body (201 for both classifications). The server derives the classification
17
- * from `answers` and refuses a body whose `classification` disagrees, so the client sends the one
18
- * `isOpraNonProfessional` reads from the same answers.
18
+ * v2 asks questions 3 to 5 as one group ("Do any of these apply to you?") and adds the subscriber's country and
19
+ * address. A record of any other version reads as no declaration: the subscriber declares again.
19
20
  */
21
+ export const OPRA_ATTESTATION_FORM_VERSION = OPRA_VENUE.questionnaire.formVersion;
20
22
  /** The server's bound on each identity field (`legalName`, `employer`, `occupation`), trimmed. */
21
- export const OPRA_IDENTITY_FIELD_MAX_LENGTH = 200;
23
+ export const OPRA_IDENTITY_FIELD_MAX_LENGTH = OPRA_VENUE.questionnaire.identityLimits.legalName;
24
+ /** The server's bound on the one-line `address`, trimmed. */
25
+ export const OPRA_ADDRESS_FIELD_MAX_LENGTH = OPRA_VENUE.questionnaire.identityLimits.address;
22
26
  /**
23
27
  * The OPRA subscriber agreement version this build presents and posts. Bump on ANY change to the
24
28
  * agreement text the dialog shows or links: a new version is a new acceptance, and the store reads a
25
29
  * record of any other version as not accepted. RELEASE BLOCKER (named, do not bury): the agreement
26
30
  * text, this version id and the link below need the compliance sign-off before the flag is lit.
27
31
  */
28
- export const OPRA_SUBSCRIBER_AGREEMENT_VERSION = 'opra-subscriber-2026-10';
32
+ export const OPRA_SUBSCRIBER_AGREEMENT_VERSION = OPRA_VENUE.agreement.version;
29
33
  /** Where the agreement step links for OPRA's own subscriber terms (see the release blocker above). */
30
- export const OPRA_SUBSCRIBER_AGREEMENT_URL = 'https://www.opraplan.com/';
34
+ export const OPRA_SUBSCRIBER_AGREEMENT_URL = OPRA_VENUE.agreement.url;
31
35
  /**
32
36
  * OPRA's non-professional qualification, one stable machine id per question: these ids key the
33
37
  * submitted `answers` record and are never swapped for translated question text. `qualifying` is the
34
38
  * answer a non-professional gives. Every answer must match it; anything else is a professional
35
- * declaration, which v1 does not sell: it is submitted (the server records it and withdraws eligibility)
36
- * and then ends in "not available". Bump OPRA_ATTESTATION_FORM_VERSION on any change to this set, its
37
- * order or its wording.
39
+ * declaration, which is not sold: it is submitted (the server records it and withdraws eligibility)
40
+ * and then ends in "not available". The form asks the three whose qualifying answer is No as one group
41
+ * question; the record still carries all five. Bump OPRA_ATTESTATION_FORM_VERSION on any change to this
42
+ * set, its order or its wording.
38
43
  */
39
- export const OPRA_QUALIFICATION_QUESTIONS = [
40
- { id: 'natural_person', qualifying: true },
41
- { id: 'personal_use_only', qualifying: true },
42
- { id: 'securities_registered', qualifying: false },
43
- { id: 'investment_adviser', qualifying: false },
44
- { id: 'exempt_institution_role', qualifying: false },
45
- ];
44
+ export const OPRA_QUALIFICATION_QUESTIONS = OPRA_VENUE.questionnaire.questions;
46
45
  /** Every question answered with its qualifying answer. A missing answer never qualifies. */
47
46
  export function isOpraNonProfessional(answers) {
48
- return OPRA_QUALIFICATION_QUESTIONS.every((question) => answers[question.id] === question.qualifying);
47
+ return isMarketDataNonProfessional(OPRA_VENUE, answers);
49
48
  }
50
49
  /** How long before a declaration's expiry the management page asks the subscriber to renew it. */
51
- export const OPRA_ATTESTATION_RENEW_WINDOW_DAYS = 30;
52
- const DAY_MS = 86_400_000;
50
+ export const OPRA_ATTESTATION_RENEW_WINDOW_DAYS = OPRA_VENUE.questionnaire.renewalWindowDays;
53
51
  /**
54
52
  * A declaration on the current form (a new question set means a new declaration) whose validity has not
55
53
  * ended at `now`, either classification. The client owns expiry: `now` is the caller's clock (the store's
@@ -57,49 +55,26 @@ const DAY_MS = 86_400_000;
57
55
  * `expiresAt` does not parse reads expired (ask again rather than trust it).
58
56
  */
59
57
  export function isOpraAttestationLive(attestation, now) {
60
- if (!attestation || attestation.formVersion !== OPRA_ATTESTATION_FORM_VERSION)
61
- return false;
62
- if (attestation.expiresAt === undefined)
63
- return true;
64
- const ends = Date.parse(attestation.expiresAt);
65
- return Number.isFinite(ends) && now < ends;
58
+ return isMarketDataAttestationLive(OPRA_VENUE, attestation, now);
66
59
  }
67
60
  /** A non-professional declaration on the current form, still valid at `now`: the account may buy real-time. */
68
61
  export function isOpraAttestationCurrent(attestation, now) {
69
- return attestation?.classification === 'non_professional' && isOpraAttestationLive(attestation, now);
62
+ return isMarketDataAttestationCurrent(OPRA_VENUE, attestation, now);
70
63
  }
71
64
  /** A professional declaration on the current form, still valid at `now`: real-time is not sold to the account. */
72
65
  export function isOpraProfessionalDeclaration(attestation, now) {
73
- return attestation?.classification === 'professional' && isOpraAttestationLive(attestation, now);
66
+ return isMarketDataProfessionalDeclaration(OPRA_VENUE, attestation, now);
74
67
  }
75
68
  /**
76
69
  * The expiry (ISO, as served) a still-current non-professional declaration must be renewed by, once `now` is
77
70
  * inside the renewal window before it; null otherwise (no expiry named, further off, or already lapsed).
78
71
  */
79
72
  export function opraAttestationRenewBy(attestation, now) {
80
- if (!isOpraAttestationCurrent(attestation, now) || attestation?.expiresAt === undefined)
81
- return null;
82
- return Date.parse(attestation.expiresAt) - now <= OPRA_ATTESTATION_RENEW_WINDOW_DAYS * DAY_MS
83
- ? attestation.expiresAt
84
- : null;
73
+ return marketDataAttestationRenewBy(OPRA_VENUE, attestation, now);
85
74
  }
86
75
  /** An acceptance counts only for the version this build presents, never for an older text. */
87
76
  export function isOpraAgreementCurrent(agreement) {
88
- return agreement?.accepted === true && agreement.agreementVersion === OPRA_SUBSCRIBER_AGREEMENT_VERSION;
89
- }
90
- export class OpraBillingError extends Error {
91
- kind;
92
- status;
93
- /** Raw backend message: diagnostic content only, never primary UI copy. */
94
- diagnosticMessage;
95
- /** Stripe's hosted invoice on an 'invoice_owed' refusal; null otherwise. */
96
- invoiceUrl;
97
- constructor(kind, options) {
98
- super(`opra billing error: ${kind}`);
99
- this.name = 'OpraBillingError';
100
- this.kind = kind;
101
- this.status = options?.status ?? null;
102
- this.diagnosticMessage = options?.diagnosticMessage ?? null;
103
- this.invoiceUrl = options?.invoiceUrl ?? null;
104
- }
77
+ return isMarketDataAgreementCurrent(OPRA_VENUE, agreement);
105
78
  }
79
+ /** The venue-generic billing error (market-data/billing.interface.ts): one class for every venue's calls. */
80
+ export const OpraBillingError = MarketDataBillingError;
@@ -0,0 +1,285 @@
1
+ export type RailTf = '1m' | '5m' | '15m' | '1h' | '1d';
2
+ export type ReplayStepTf = '1m' | '5m' | '10m' | '15m' | '30m' | '1h' | '2h' | '3h' | '4h' | '1d';
3
+ type ReplayTimestampMode = 'uniform' | 'irregular';
4
+ export interface ReplayRailDomain {
5
+ nowSec: number;
6
+ fromSec: number;
7
+ toSec?: number;
8
+ }
9
+ export interface ReplayLane {
10
+ kind: 'tick' | 'bars';
11
+ tf: 'tick' | RailTf;
12
+ bucketMs: number;
13
+ hasBook: boolean;
14
+ }
15
+ export interface ReplayDisplayLane {
16
+ mode: 'tick' | 'coarse';
17
+ tf: 'tick' | RailTf;
18
+ tfMs: number;
19
+ hasBook: boolean;
20
+ bookTf?: RailTf;
21
+ }
22
+ export type ReplayResolution = {
23
+ kind: 'tick';
24
+ } | {
25
+ kind: 'bar';
26
+ tf: ReplayStepTf;
27
+ };
28
+ export type ReplayResolutionPick = 'auto' | ReplayResolution;
29
+ export interface ReplayBuffer {
30
+ anchorMs: number;
31
+ generation?: number;
32
+ tf: ReplayResolution;
33
+ timestampMode?: ReplayTimestampMode;
34
+ chartIntervalMs?: number;
35
+ availableResolutions?: ReplayResolution[];
36
+ abortController: AbortController;
37
+ /** Total visible X span used by replay follow range syncs. */
38
+ viewBehindMs: number;
39
+ /**
40
+ * Span implied by the last follow range replay itself applied, in both
41
+ * denominations (key span x chart interval when the range carried keys, and
42
+ * the raw ts span). The user-zoom detector's echo baseline: a viewport span
43
+ * matching it is replay's own write coming back, not a user zoom, and must
44
+ * not be re-adopted into viewBehindMs. On a sparse grid (thin market:
45
+ * interval buckets with no bar) the applied window holds fewer keys than
46
+ * span / interval, so re-adopting the echo every sync ratcheted the follow
47
+ * zoom down (300 -> 2 bars).
48
+ */
49
+ followAppliedSpan?: {
50
+ tsSpanMs: number;
51
+ keySpanMs?: number;
52
+ };
53
+ loadedBars: number;
54
+ loading: boolean;
55
+ heatmapLoading: boolean;
56
+ heatmapFollowLoading?: boolean;
57
+ heatmapFollowCooldown?: number;
58
+ heatmapGapFillLoading?: boolean;
59
+ heatmapGapFillCooldown?: number;
60
+ heatmapGapFillRangeKey?: string;
61
+ heatmapOverlayLoadCount?: number;
62
+ /** Forward book coverage claimed on wire evidence (both lanes); the follow loops heal from here. */
63
+ heatmapCoverageEndMs?: number;
64
+ subRows?: number[][];
65
+ subCoverageEndMs?: number;
66
+ subOriginMs?: number;
67
+ subRequestInterval?: string;
68
+ subStepMs?: number;
69
+ subFollowLoading?: boolean;
70
+ subFollowCooldown?: number;
71
+ /**
72
+ * Set by the anchor load: the replay step's own rail answered servedEmpty on
73
+ * the wire over the whole anchor window while the chart's own rows sit inside
74
+ * it, so the step's retained history ends before this depth. Committed as is,
75
+ * the window would end on the start bar (no step, silent Play); the session
76
+ * restarts on whole chart bars instead.
77
+ */
78
+ stepRailEmptyAtAnchor?: boolean;
79
+ /**
80
+ * Sub-row window a wire-complete reply answered servedEmpty while coverage
81
+ * already reached it: the active chart bucket is TRADELESS, not unfetched,
82
+ * so the covered-window refetch must not re-ask it once per cooldown lapse.
83
+ * Mirrors the forward frontier's proof discipline: TTL-bounded via atMs
84
+ * (read through provenReplaySubServedEmptyFloor) and falsified the moment
85
+ * later sub rows land inside the span, so delayed ingestion is never
86
+ * blocked for the buffer's lifetime.
87
+ */
88
+ subServedEmptyFloor?: {
89
+ startMs: number;
90
+ endMs: number;
91
+ atMs: number;
92
+ };
93
+ /**
94
+ * Forward frontier PROVEN empty on the wire by the proven-empty forward
95
+ * walk (session-bound venues, and uniform period-fetch venues since the
96
+ * sparse-grid round): every candle window between the last
97
+ * loaded row and this timestamp completed a round trip whose completion
98
+ * carried the worker's authoritative servedEmpty verdict, so the span is a
99
+ * calendar hole (weekend/holiday/maintenance halt), not unfetched data.
100
+ * The clock latches its terminal finished state once this reaches the
101
+ * forward limit and probes again only after the limit advances past it.
102
+ * NOT permanent knowledge: consumers read it through
103
+ * `provenForwardScannedToMs` (TTL-bounded via forwardScannedAtMs, so
104
+ * delayed gateway ingestion near the live edge is re-asked), and any batch
105
+ * rows later landing inside the span falsify and clear it.
106
+ */
107
+ forwardScannedToMs?: number;
108
+ /** When the frontier above was last raised; the TTL clock for its proof. */
109
+ forwardScannedAtMs?: number;
110
+ fullRows: number[][];
111
+ heatmapColumns: Float64Array[];
112
+ /**
113
+ * Last pan-back gap-fill outcome, keyed to stable evidence (column count and
114
+ * deepest captured column) rather than window bounds: the window's floor
115
+ * widens with every candle prepend, and an exact-bounds key would never
116
+ * latch while the book edge stays put.
117
+ */
118
+ panBackGapFill?: {
119
+ maxMs: number;
120
+ queriedMinMs: number;
121
+ columnCount: number;
122
+ deepestColumnMs: number;
123
+ };
124
+ }
125
+ export interface ReplayFollowRange {
126
+ startTs: number;
127
+ endTs: number;
128
+ startKey?: number;
129
+ endKey?: number;
130
+ }
131
+ export type ReplayClockState = 'paused' | 'playing' | 'loading';
132
+ interface ReplayClockIndicators {
133
+ extendForwardTo?(endMs: number): void;
134
+ markNextReplayTickAsReseed?(): void;
135
+ revealTo(playheadMs: number): void;
136
+ seekTo(playheadMs: number, options?: {
137
+ incremental?: boolean;
138
+ relocateFoldedFootprintFine?: boolean;
139
+ }): void;
140
+ }
141
+ export interface ReplayClockSnapshot {
142
+ playheadMs: number;
143
+ state: ReplayClockState;
144
+ speed: number;
145
+ endMs: number;
146
+ finished: boolean;
147
+ }
148
+ export interface ReplayClockOptions {
149
+ chartIndex: number;
150
+ intervalMs: number;
151
+ tfMs: number;
152
+ stepMs?: number;
153
+ playheadMs: number;
154
+ speed?: number;
155
+ indicators: ReplayClockIndicators;
156
+ getForwardLimitMs: () => number;
157
+ shouldFollow?: () => boolean;
158
+ onUpdate?: (snapshot: ReplayClockSnapshot) => void;
159
+ /**
160
+ * Group boundary barrier: while true, ticks reschedule without advancing
161
+ * (state stays 'playing', so the transport never flip-flops). Used by the
162
+ * multichart master to hold for a member's forward load.
163
+ */
164
+ shouldHold?: () => boolean;
165
+ /**
166
+ * Mixed-timeline group: walk continuous wall time even on an irregular
167
+ * (session-gap) buffer, so uniform co-members keep playing through this
168
+ * chart's closed hours and this pane simply reveals nothing until its
169
+ * market reopens. Solo irregular replay keeps native bar-stepping.
170
+ */
171
+ forceUniformTimeline?: () => boolean;
172
+ /**
173
+ * Frame scheduler of the damped follow camera. The app leaves it unset
174
+ * (window.requestAnimationFrame); specs inject a fake rAF to drive the
175
+ * camera frame by frame between ticks.
176
+ */
177
+ motion?: {
178
+ raf?: ((callback: FrameRequestCallback) => number) | null;
179
+ caf?: ((handle: number) => void) | null;
180
+ now?: () => number;
181
+ reducedMotion?: boolean;
182
+ };
183
+ }
184
+ export interface ReplayIndicatorsResult {
185
+ replayed: string[];
186
+ hidden: string[];
187
+ /**
188
+ * Workspace overlays that were skipped only because they had not mounted in
189
+ * the chart yet when prepare enumerated (fresh-boot replay entries race
190
+ * indicator mounting). The start flow re-dispatches these through
191
+ * loadOverlayDuringReplay, which waits for the mount and lanes them; without
192
+ * that they silently stay live production overlays for the whole session.
193
+ */
194
+ deferredMountIds: string[];
195
+ }
196
+ export type ReplayZoomWindowMs = number | null;
197
+ export interface ReplayWindowBounds {
198
+ startMs: number;
199
+ endMs: number;
200
+ spanMs: number;
201
+ }
202
+ type ReplayRailCoverageRanges = Array<[number, number]>;
203
+ export interface RailsCoverage {
204
+ bars: Partial<Record<RailTf, ReplayRailCoverageRanges>>;
205
+ columns: Partial<Record<RailTf, ReplayRailCoverageRanges>>;
206
+ oldestBars: Partial<Record<RailTf, number>>;
207
+ done: boolean;
208
+ }
209
+ export type ReplayLaneEvent = {
210
+ mode: 'tick';
211
+ tf: 'tick';
212
+ tfMs: number;
213
+ tfLabel: string;
214
+ hasBook: boolean;
215
+ tickSource: 'live' | 'rails';
216
+ } | {
217
+ mode: 'coarse';
218
+ tf: ReplayStepTf;
219
+ tfMs: number;
220
+ tfLabel: string;
221
+ hasBook: boolean;
222
+ };
223
+ /** The wall that binds a replay reach decision (replayLadder.clampReplayReach). */
224
+ export type ReplayReachLimitedBy = 'retention' | 'plan' | 'gateway';
225
+ export interface ReplayUiState {
226
+ active: boolean;
227
+ loading: boolean;
228
+ state: string;
229
+ playheadMs: number;
230
+ lastRevealedOpen: number | null;
231
+ lastRevealedClose: number | null;
232
+ lastRevealedCloseMs: number | null;
233
+ speed: number;
234
+ finished: boolean;
235
+ follow: boolean;
236
+ buffered: Array<[number, number]>;
237
+ fidelity: {
238
+ level: 'approx' | 'exact';
239
+ };
240
+ status: string;
241
+ indicators: {
242
+ replayed: string[];
243
+ hidden: string[];
244
+ } | null;
245
+ pickArmed: boolean;
246
+ jumpPickTimeMs: number | null;
247
+ catchupPct: number | null;
248
+ resolutionAnchorMs: number | null;
249
+ resolutionAvailable: ReplayResolution[];
250
+ replayTimestampMode: ReplayTimestampMode;
251
+ replayV3Timestamps: number[];
252
+ domainStartMs: number;
253
+ domainEndMs: number;
254
+ reachWallMs: number | null;
255
+ reachLimited: boolean;
256
+ /** What binds `reachWallMs`; null when no reach decision stands. */
257
+ reachLimitedBy: ReplayReachLimitedBy | null;
258
+ reachClampNotice: number;
259
+ reachClampSource: 'anchor' | 'scrub' | null;
260
+ bookLayersAllowed: boolean;
261
+ /** Why book layers are off: plan gate vs the concurrent-session memory cap. */
262
+ bookLayersDeniedReason?: 'plan' | 'concurrency';
263
+ /** Multichart replay: arm the next anchor pick to enter a synced group. */
264
+ groupArmed: boolean;
265
+ /** Entry two-choice (this chart / all charts) is showing; anchor pick waits. */
266
+ groupChoicePending: boolean;
267
+ groupRole: 'master' | 'follower' | null;
268
+ groupMasterIndex: number | null;
269
+ bookLayersRequested: boolean;
270
+ zoomWindowMs: ReplayZoomWindowMs;
271
+ lane: ReplayLaneEvent;
272
+ railsCoverage: RailsCoverage;
273
+ replayV3Window: {
274
+ startMs: number;
275
+ endMs: number;
276
+ } | null;
277
+ replayVersion: 'v3' | null;
278
+ rebuilding: boolean;
279
+ /** Playback effects (user-toggleable via the transport FX menu). */
280
+ /** Bumped when a blocked gesture should pulse the Follow control. */
281
+ followHintPulse: number;
282
+ /** Increments each time a user gesture auto-releases Follow (drives the transient "Follow off" chip). */
283
+ followReleasePulse: number;
284
+ }
285
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function mergeLiveOhlcvDataPoint(lastData: any[], data: any, normalizedTime: number): any[];
@@ -0,0 +1,93 @@
1
+ const LIVE_OHLC_EXTREME_RATIO = 0.05;
2
+ const LIVE_OHLC_RANGE_MULTIPLIER = 3;
3
+ function finiteNumber(value) {
4
+ if (typeof value === 'string' && value.trim() === '')
5
+ return undefined;
6
+ const n = Number(value);
7
+ return Number.isFinite(n) ? n : undefined;
8
+ }
9
+ function positiveFiniteNumber(value) {
10
+ const n = finiteNumber(value);
11
+ return n !== undefined && n > 0 ? n : 0;
12
+ }
13
+ function referencePrice(rows, targetIndex, close) {
14
+ const target = targetIndex >= 0 ? rows[targetIndex] : undefined;
15
+ const previous = targetIndex >= 0 ? rows[targetIndex - 1] : rows[rows.length - 1];
16
+ return finiteNumber(target?.[4]) ?? finiteNumber(previous?.[4]) ?? close;
17
+ }
18
+ function liveOhlcTolerance(basePrice, bodyRange, existingRange) {
19
+ const priceBand = Math.abs(basePrice) * LIVE_OHLC_EXTREME_RATIO;
20
+ return Math.max(priceBand, Math.abs(bodyRange) * LIVE_OHLC_RANGE_MULTIPLIER, Math.abs(existingRange) * LIVE_OHLC_RANGE_MULTIPLIER);
21
+ }
22
+ function shouldUseLiveExtreme(value, boundary, tolerance, side) {
23
+ if (value === undefined)
24
+ return false;
25
+ if (side === 'high')
26
+ return value <= boundary + tolerance;
27
+ return value >= boundary - tolerance;
28
+ }
29
+ function maybeLogSanitizedLiveOhlc(reason, raw, sanitized) {
30
+ if (typeof window === 'undefined' || !window.__KS_DIAG)
31
+ return;
32
+ console.warn('[K_OHLCV] sanitized live OHLCV point', { reason, raw, sanitized });
33
+ }
34
+ export function mergeLiveOhlcvDataPoint(lastData, data, normalizedTime) {
35
+ const close = finiteNumber(data?.close);
36
+ if (!data || close === undefined || !Number.isFinite(normalizedTime)) {
37
+ return lastData;
38
+ }
39
+ const targetIndex = lastData.findIndex((point) => Array.isArray(point) && point[0] === normalizedTime);
40
+ const existingPoint = targetIndex >= 0 ? lastData[targetIndex] : undefined;
41
+ const refPrice = referencePrice(lastData, targetIndex, close);
42
+ const rawOpen = finiteNumber(data.open);
43
+ const rawHigh = finiteNumber(data.high);
44
+ const rawLow = finiteNumber(data.low);
45
+ const newVolume = positiveFiniteNumber(data.volume);
46
+ const refTolerance = liveOhlcTolerance(refPrice, Math.abs(close - refPrice), 0);
47
+ const newOpen = rawOpen !== undefined &&
48
+ rawOpen >= Math.min(close, refPrice) - refTolerance &&
49
+ rawOpen <= Math.max(close, refPrice) + refTolerance
50
+ ? rawOpen
51
+ : close;
52
+ const existingHigh = finiteNumber(existingPoint?.[2]);
53
+ const existingLow = finiteNumber(existingPoint?.[3]);
54
+ const baseHigh = Math.max(existingHigh ?? -Infinity, newOpen, close);
55
+ const baseLow = Math.min(existingLow ?? Infinity, newOpen, close);
56
+ const existingRange = existingHigh !== undefined && existingLow !== undefined ? Math.max(0, existingHigh - existingLow) : 0;
57
+ const tolerance = liveOhlcTolerance(close, Math.abs(close - newOpen), existingRange);
58
+ const newHigh = rawHigh !== undefined && shouldUseLiveExtreme(rawHigh, baseHigh, tolerance, 'high')
59
+ ? Math.max(rawHigh, baseHigh)
60
+ : baseHigh;
61
+ const newLow = rawLow !== undefined && shouldUseLiveExtreme(rawLow, baseLow, tolerance, 'low')
62
+ ? Math.min(rawLow, baseLow)
63
+ : baseLow;
64
+ if (rawOpen !== newOpen || rawHigh !== newHigh || rawLow !== newLow) {
65
+ maybeLogSanitizedLiveOhlc('implausible live OHLC field', data, [
66
+ normalizedTime,
67
+ newOpen,
68
+ newHigh,
69
+ newLow,
70
+ close,
71
+ newVolume,
72
+ ]);
73
+ }
74
+ // Pure like the buy-sell-volume / liquidations merges: never write into the
75
+ // caller's container. Live folds seed from the engine proxy's CACHED rows by
76
+ // reference; an in-place write leaks folded increments into the cache, and a
77
+ // re-fold of the same batch (multi-variant fallback re-apply) then counts
78
+ // them twice — the forming bar's volume overshot the candle until the next
79
+ // authoritative run.
80
+ if (targetIndex === -1) {
81
+ return [...lastData, [normalizedTime, newOpen, newHigh, newLow, close, newVolume]];
82
+ }
83
+ const next = [...lastData];
84
+ next[targetIndex] = [
85
+ normalizedTime,
86
+ existingPoint[1],
87
+ Math.max(existingHigh ?? newHigh, newHigh),
88
+ Math.min(existingLow ?? newLow, newLow),
89
+ close,
90
+ positiveFiniteNumber(existingPoint[5]) + newVolume,
91
+ ];
92
+ return next;
93
+ }
@@ -69,6 +69,10 @@ export interface LiveTradesMergeOptions {
69
69
  /** Called when the fold trimmed the live bar to the cap (the oldest prints dropped), so the
70
70
  * caller can warn once (the kScript lane) or refuse the bar by name (the wrun lane). */
71
71
  onCapped?: (cap: number) => void;
72
+ /** The bar the print folds into, when the caller names one (a dispatcher's host bar: an index-mode chart's own
73
+ * bar holding the print, `kScriptLiveHintedBucketMs`) in place of the bar the print keys on the lane's own grid
74
+ * (`tradesBarStartMs`); the cell's offset is measured from its open. Absent: the lane's own bar. */
75
+ barTs?: number;
72
76
  }
73
77
  /** One raw TRADE print as the fold reads it. */
74
78
  export interface LiveTradePrint {
@@ -181,5 +185,5 @@ export declare function tradesLargeHistoryAnswers(market: TradesLargeMarket): bo
181
185
  export declare function tradesBelowLargeFloor(print: LiveTradePrint, market?: TradesLargeMarket): boolean;
182
186
  /** Fold one raw TRADE point onto the tape rows: the NEW rows array (the touched row a new array,
183
187
  * every other row shared by reference), or null when the point is rejected (the caller keeps
184
- * its rows). */
188
+ * its rows). The print lands in the bar `options.barTs` names, else in its own bar on the lane's grid. */
185
189
  export declare function mergeLiveTradesDataPoint(lastDataPoint: ReadonlyArray<ArrayLike<unknown>>, newPoint: unknown, intervalMs: number, options?: LiveTradesMergeOptions): LiveTradesRow[] | null;
@@ -325,7 +325,7 @@ export function tradesBelowLargeFloor(print, market) {
325
325
  }
326
326
  /** Fold one raw TRADE point onto the tape rows: the NEW rows array (the touched row a new array,
327
327
  * every other row shared by reference), or null when the point is rejected (the caller keeps
328
- * its rows). */
328
+ * its rows). The print lands in the bar `options.barTs` names, else in its own bar on the lane's grid. */
329
329
  export function mergeLiveTradesDataPoint(lastDataPoint, newPoint, intervalMs, options = {}) {
330
330
  if (!Number.isFinite(intervalMs) || intervalMs <= 0)
331
331
  return null;
@@ -337,7 +337,7 @@ export function mergeLiveTradesDataPoint(lastDataPoint, newPoint, intervalMs, op
337
337
  return null;
338
338
  if (options.largeFloor !== undefined && tradesBelowLargeFloor(print, options.largeFloor))
339
339
  return null;
340
- const barTs = tradesBarStartMs(print.tsMs, intervalMs, print.exchange);
340
+ const barTs = options.barTs ?? tradesBarStartMs(print.tsMs, intervalMs, print.exchange);
341
341
  const rows = lastDataPoint;
342
342
  const last = rows.length > 0 ? rows[rows.length - 1] : undefined;
343
343
  // A delayed closed-bar print must not append an out-of-order row.