@orangecharts/wrun-chart-host 0.11.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/feature-flags.constants.d.ts +3 -4
  3. package/dist/constants/feature-flags.constants.js +34 -52
  4. package/dist/constants/feature-limits.constants.d.ts +1 -1
  5. package/dist/constants/feature-limits.constants.js +5 -4
  6. package/dist/constants/interval.constants.d.ts +7 -0
  7. package/dist/constants/interval.constants.js +7 -0
  8. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +20 -149
  9. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +20 -309
  10. package/dist/constants/stocks-compliance.constants.d.ts +15 -0
  11. package/dist/constants/stocks-compliance.constants.js +15 -0
  12. package/dist/host-env.d.ts +55 -3
  13. package/dist/host-env.js +6 -0
  14. package/dist/host-ports.types.d.ts +36 -3
  15. package/dist/index.d.ts +18 -0
  16. package/dist/index.js +19 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +78 -15
  18. package/dist/indicators/controls/tpo-session.util.js +320 -242
  19. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +6 -0
  20. package/dist/instances/script-engine-worker-ohlcv-transfer.js +16 -0
  21. package/dist/interfaces/cme-realtime.interface.d.ts +8 -0
  22. package/dist/interfaces/cme-realtime.interface.js +2 -1
  23. package/dist/interfaces/feed.interface.d.ts +15 -1
  24. package/dist/interfaces/replay.interface.d.ts +5 -0
  25. package/dist/interfaces/stocks-realtime.interface.d.ts +4 -3
  26. package/dist/interfaces/stocks-realtime.interface.js +5 -4
  27. package/dist/interfaces/wrun-runtime.interface.d.ts +97 -19
  28. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +17 -0
  29. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +22 -0
  30. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +46 -40
  31. package/dist/kscript-data/controls/live-trades-merge.util.js +80 -107
  32. package/dist/market-data/billing.interface.d.ts +9 -1
  33. package/dist/market-data/venue.d.ts +1 -1
  34. package/dist/market-data/venues/index.d.ts +4 -4
  35. package/dist/market-data/venues/stocks.contract.copy.json +4 -4
  36. package/dist/market-data/venues/stocks.d.ts +4 -4
  37. package/dist/market-data/venues/stocks.js +15 -13
  38. package/dist/settings-templates/frvp-fields.d.ts +12 -1
  39. package/dist/settings-templates/frvp-fields.js +15 -4
  40. package/dist/settings-templates/index.js +12 -5
  41. package/dist/settings-templates/indicator-fields.js +28 -2
  42. package/dist/settings-templates/tool-rules.d.ts +17 -8
  43. package/dist/settings-templates/tool-rules.js +15 -8
  44. package/dist/settings-templates/tool-tables.generated.js +4 -2
  45. package/dist/utility/auth/server-clock.util.d.ts +3 -1
  46. package/dist/utility/auth/server-clock.util.js +3 -1
  47. package/dist/utility/chart/book-live-bucket.util.js +2 -2
  48. package/dist/utility/chart/cache-alignment.util.d.ts +15 -7
  49. package/dist/utility/chart/cache-alignment.util.js +14 -7
  50. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +2 -0
  51. package/dist/utility/chart/chart-data-fetch-generation.util.js +16 -0
  52. package/dist/utility/chart/cme-session-bucket.util.d.ts +18 -75
  53. package/dist/utility/chart/cme-session-bucket.util.js +25 -332
  54. package/dist/utility/chart/continuous-contracts.util.js +6 -5
  55. package/dist/utility/chart/display-offset.leaf.d.ts +24 -0
  56. package/dist/utility/chart/display-offset.leaf.js +41 -0
  57. package/dist/utility/chart/effective-chart-session.util.d.ts +2 -1
  58. package/dist/utility/chart/effective-chart-session.util.js +13 -5
  59. package/dist/utility/chart/feed-interval.util.d.ts +6 -20
  60. package/dist/utility/chart/feed-interval.util.js +13 -22
  61. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +27 -7
  62. package/dist/utility/chart/fetch-dedupe-policy.util.js +86 -11
  63. package/dist/utility/chart/host-bar-placement.util.d.ts +7 -4
  64. package/dist/utility/chart/host-bar-placement.util.js +8 -2
  65. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +32 -0
  66. package/dist/utility/chart/indicator-inflight-registry.util.js +52 -0
  67. package/dist/utility/chart/indicator-run-interval.util.d.ts +10 -4
  68. package/dist/utility/chart/indicator-run-interval.util.js +21 -12
  69. package/dist/utility/chart/interval-registry.util.d.ts +1 -1
  70. package/dist/utility/chart/interval-registry.util.js +1 -1
  71. package/dist/utility/chart/kscript-legend-entries.util.d.ts +12 -0
  72. package/dist/utility/chart/kscript-legend-entries.util.js +16 -0
  73. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +1 -1
  74. package/dist/utility/chart/kscript-run-interval-projection.util.js +4 -2
  75. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -62
  76. package/dist/utility/chart/kscript-venue-policy.util.js +85 -94
  77. package/dist/utility/chart/live-bucket.util.d.ts +39 -17
  78. package/dist/utility/chart/live-bucket.util.js +103 -57
  79. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +58 -20
  80. package/dist/utility/chart/local-kscript-source-revalidation.util.js +98 -23
  81. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +35 -11
  82. package/dist/utility/chart/local-kscript-warmup-depth.util.js +24 -3
  83. package/dist/utility/chart/market-session-schedule.util.d.ts +8 -0
  84. package/dist/utility/chart/market-session-schedule.util.js +39 -1
  85. package/dist/utility/chart/market-session.util.d.ts +136 -0
  86. package/dist/utility/chart/market-session.util.js +341 -0
  87. package/dist/utility/chart/market-sessions.util.d.ts +83 -0
  88. package/dist/utility/chart/market-sessions.util.js +220 -0
  89. package/dist/utility/chart/om-panel.util.d.ts +5 -3
  90. package/dist/utility/chart/om-panel.util.js +42 -7
  91. package/dist/utility/chart/om-target.util.d.ts +14 -1
  92. package/dist/utility/chart/om-target.util.js +22 -5
  93. package/dist/utility/chart/opra-read-access.leaf.d.ts +16 -1
  94. package/dist/utility/chart/opra-read-access.leaf.js +22 -0
  95. package/dist/utility/chart/profile-row-height.util.d.ts +49 -16
  96. package/dist/utility/chart/profile-row-height.util.js +74 -37
  97. package/dist/utility/chart/rth-session.util.d.ts +55 -20
  98. package/dist/utility/chart/rth-session.util.js +94 -46
  99. package/dist/utility/chart/session-interval.util.d.ts +2 -1
  100. package/dist/utility/chart/session-interval.util.js +1 -3
  101. package/dist/utility/chart/session-lattice.util.d.ts +150 -0
  102. package/dist/utility/chart/session-lattice.util.js +488 -0
  103. package/dist/utility/chart/trading-day.util.d.ts +40 -2
  104. package/dist/utility/chart/trading-day.util.js +84 -7
  105. package/dist/utility/chart/us-equities-session.util.d.ts +32 -11
  106. package/dist/utility/chart/us-equities-session.util.js +44 -15
  107. package/dist/utility/chart/window-geometry.leaf.d.ts +28 -7
  108. package/dist/utility/chart/window-geometry.leaf.js +57 -8
  109. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +21 -14
  110. package/dist/utility/chart/wrun-bar-session-facts.util.js +32 -38
  111. package/dist/utility/chart/wrun-run-result.util.d.ts +29 -12
  112. package/dist/utility/chart/wrun-run-result.util.js +89 -25
  113. package/dist/utility/common/time.util.js +5 -4
  114. package/dist/utility/market-events/earnings-scope.util.d.ts +10 -5
  115. package/dist/utility/market-events/earnings-scope.util.js +17 -9
  116. package/dist/utility/market-events/market-events.util.d.ts +14 -7
  117. package/dist/utility/market-events/market-events.util.js +30 -17
  118. package/dist/utility/number-format.util.d.ts +14 -21
  119. package/dist/utility/number-format.util.js +38 -24
  120. package/dist/utility/options/option-venue-disclosure.util.d.ts +40 -6
  121. package/dist/utility/options/option-venue-disclosure.util.js +71 -11
  122. package/dist/utility/options/option-venue.util.d.ts +1 -1
  123. package/dist/utility/options/option-venue.util.js +1 -1
  124. package/dist/utility/pool-symbol.leaf.d.ts +7 -0
  125. package/dist/utility/pool-symbol.leaf.js +50 -5
  126. package/dist/utility/stocks/stock-display.util.d.ts +15 -0
  127. package/dist/utility/stocks/stock-display.util.js +37 -0
  128. package/dist/utility/symbol-selection/contract-expiry.util.js +5 -4
  129. package/dist/utility/v2/gate-plane.util.d.ts +6 -0
  130. package/dist/utility/v2/gate-plane.util.js +11 -1
  131. package/dist/utility/v2/gate-session-latch.util.d.ts +1 -1
  132. package/dist/utility/v2/gate-session-latch.util.js +3 -3
  133. package/dist/utility/v2/governed-tier.leaf.d.ts +17 -16
  134. package/dist/utility/v2/governed-tier.leaf.js +17 -16
  135. package/dist/utility/v2/stocks-governed.util.d.ts +5 -0
  136. package/dist/utility/v2/stocks-governed.util.js +14 -0
  137. package/dist/utility/v2/v2-enums.leaf.d.ts +13 -0
  138. package/dist/utility/v2/v2-enums.leaf.js +458 -0
  139. package/dist/utility/wrun/derived-roots.leaf.d.ts +21 -1
  140. package/dist/utility/wrun/derived-roots.leaf.js +27 -1
  141. package/dist/utility/wrun/derived-roots.util.d.ts +44 -32
  142. package/dist/utility/wrun/derived-roots.util.js +97 -56
  143. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -3
  144. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -3
  145. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +2 -1
  146. package/dist/utility/wrun/sources/lanes/option_daily.js +2 -1
  147. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +3 -0
  148. package/dist/utility/wrun/sources/lanes/options_flow.js +23 -5
  149. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -4
  150. package/dist/utility/wrun/sources/row-lane-registry.js +9 -4
  151. package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +19 -0
  152. package/dist/utility/wrun/sources/row-lanes/dark_pool.js +104 -0
  153. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  154. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.d.ts +20 -0
  155. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.js +103 -0
  156. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -2
  157. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +15 -13
  158. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +49 -23
  159. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +14 -9
  160. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +75 -27
  161. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +139 -82
  162. package/dist/utility/wrun/wrun-app-layer.leaf.d.ts +78 -0
  163. package/dist/utility/wrun/wrun-app-layer.leaf.js +89 -0
  164. package/dist/utility/wrun/wrun-bar-count.util.d.ts +11 -7
  165. package/dist/utility/wrun/wrun-bar-count.util.js +12 -8
  166. package/dist/utility/wrun/wrun-batched-kinds.leaf.d.ts +13 -0
  167. package/dist/utility/wrun/wrun-batched-kinds.leaf.js +18 -0
  168. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +41 -22
  169. package/dist/utility/wrun/wrun-batched-marks.util.js +255 -59
  170. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +26 -19
  171. package/dist/utility/wrun/wrun-batched-readout.util.js +81 -27
  172. package/dist/utility/wrun/wrun-book-bands.leaf.d.ts +8 -0
  173. package/dist/utility/wrun/wrun-book-bands.leaf.js +7 -0
  174. package/dist/utility/wrun/wrun-candle-equal.leaf.d.ts +19 -0
  175. package/dist/utility/wrun/wrun-candle-equal.leaf.js +40 -0
  176. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -2
  177. package/dist/utility/wrun/wrun-canvases.util.js +7 -3
  178. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +6 -3
  179. package/dist/utility/wrun/wrun-chart-context-names.util.js +8 -4
  180. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +47 -29
  181. package/dist/utility/wrun/wrun-chart-market-facts.util.js +201 -201
  182. package/dist/utility/wrun/wrun-child-overlay-id.util.js +2 -1
  183. package/dist/utility/wrun/wrun-cme-legs-note.util.d.ts +15 -0
  184. package/dist/utility/wrun/wrun-cme-legs-note.util.js +49 -0
  185. package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +38 -0
  186. package/dist/utility/wrun/wrun-cme-root-specs.util.js +81 -0
  187. package/dist/utility/wrun/wrun-coin-lane-live.util.js +3 -0
  188. package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -1
  189. package/dist/utility/wrun/wrun-color-settings.util.js +32 -7
  190. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +50 -0
  191. package/dist/utility/wrun/wrun-dark-pool.util.js +127 -0
  192. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +67 -12
  193. package/dist/utility/wrun/wrun-declared-warmup.util.js +165 -13
  194. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +18 -8
  195. package/dist/utility/wrun/wrun-draft-legend-note.util.js +57 -11
  196. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +14 -10
  197. package/dist/utility/wrun/wrun-draft-overlay.util.js +26 -14
  198. package/dist/utility/wrun/wrun-earnings-facts.util.js +3 -2
  199. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +2 -0
  200. package/dist/utility/wrun/wrun-etf-funds.util.js +4 -0
  201. package/dist/utility/wrun/wrun-held-lanes.util.js +8 -2
  202. package/dist/utility/wrun/wrun-history-as-of.util.d.ts +77 -0
  203. package/dist/utility/wrun/wrun-history-as-of.util.js +108 -0
  204. package/dist/utility/wrun/wrun-host.service.d.ts +64 -14
  205. package/dist/utility/wrun/wrun-host.service.js +137 -27
  206. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +3 -3
  207. package/dist/utility/wrun/wrun-hosted-wire-caps.js +12 -2
  208. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +13 -0
  209. package/dist/utility/wrun/wrun-inert-legend.util.js +31 -3
  210. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +7 -5
  211. package/dist/utility/wrun/wrun-input-requirements.leaf.js +16 -6
  212. package/dist/utility/wrun/wrun-install-pacer.util.d.ts +26 -0
  213. package/dist/utility/wrun/wrun-install-pacer.util.js +145 -0
  214. package/dist/utility/wrun/wrun-kit-refusal-stages.types.d.ts +22 -0
  215. package/dist/utility/wrun/wrun-kit-refusal-stages.types.js +1 -0
  216. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +12 -5
  217. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +23 -5
  218. package/dist/utility/wrun/wrun-lane-warmup.util.js +22 -4
  219. package/dist/utility/wrun/wrun-leg-close.util.d.ts +6 -5
  220. package/dist/utility/wrun/wrun-leg-close.util.js +11 -9
  221. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +3 -1
  222. package/dist/utility/wrun/wrun-leg-fetch.util.js +9 -2
  223. package/dist/utility/wrun/wrun-levels-child.util.d.ts +2 -0
  224. package/dist/utility/wrun/wrun-levels-child.util.js +6 -0
  225. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -0
  226. package/dist/utility/wrun/wrun-live-intake.util.d.ts +15 -6
  227. package/dist/utility/wrun/wrun-live-intake.util.js +167 -47
  228. package/dist/utility/wrun/wrun-live-tick.util.d.ts +52 -8
  229. package/dist/utility/wrun/wrun-live-tick.util.js +648 -97
  230. package/dist/utility/wrun/wrun-market-facts.util.d.ts +16 -2
  231. package/dist/utility/wrun/wrun-market-facts.util.js +32 -3
  232. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +27 -27
  233. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +28 -16
  234. package/dist/utility/wrun/wrun-market-size-defaults.util.js +34 -5
  235. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +10 -7
  236. package/dist/utility/wrun/wrun-oi-lane.util.js +16 -10
  237. package/dist/utility/wrun/wrun-option-strike-flow.util.js +1 -1
  238. package/dist/utility/wrun/wrun-option-views.util.d.ts +2 -2
  239. package/dist/utility/wrun/wrun-option-views.util.js +5 -2
  240. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.d.ts +5 -0
  241. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.js +16 -0
  242. package/dist/utility/wrun/wrun-options-stop.util.d.ts +3 -2
  243. package/dist/utility/wrun/wrun-options-stop.util.js +6 -4
  244. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +75 -11
  245. package/dist/utility/wrun/wrun-overlay-drivers.util.js +176 -43
  246. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +20 -10
  247. package/dist/utility/wrun/wrun-overlay-park.util.d.ts +84 -0
  248. package/dist/utility/wrun/wrun-overlay-park.util.js +135 -0
  249. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +37 -4
  250. package/dist/utility/wrun/wrun-overlay-recovery.util.js +26 -14
  251. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +239 -24
  252. package/dist/utility/wrun/wrun-overlay-run.util.js +2204 -405
  253. package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
  254. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +2 -1
  255. package/dist/utility/wrun/wrun-panel-mount.util.js +20 -14
  256. package/dist/utility/wrun/wrun-panel-style.util.d.ts +4 -2
  257. package/dist/utility/wrun/wrun-panel-style.util.js +3 -2
  258. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +7 -0
  259. package/dist/utility/wrun/wrun-pin-spelling.util.js +18 -4
  260. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +26 -17
  261. package/dist/utility/wrun/wrun-pin-venues.util.js +43 -36
  262. package/dist/utility/wrun/wrun-pinned-lanes.util.d.ts +58 -0
  263. package/dist/utility/wrun/wrun-pinned-lanes.util.js +72 -0
  264. package/dist/utility/wrun/wrun-prefix-cohort.util.js +2 -1
  265. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +22 -9
  266. package/dist/utility/wrun/wrun-prefix-lanes.util.js +145 -26
  267. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +29 -0
  268. package/dist/utility/wrun/wrun-prefix-proof.util.js +23 -5
  269. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +9 -1
  270. package/dist/utility/wrun/wrun-refusal-surface.util.js +15 -1
  271. package/dist/utility/wrun/wrun-refusal.util.d.ts +19 -1
  272. package/dist/utility/wrun/wrun-refusal.util.js +103 -16
  273. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +20 -6
  274. package/dist/utility/wrun/wrun-registry-errors.util.js +20 -6
  275. package/dist/utility/wrun/wrun-replay-rows.util.js +6 -10
  276. package/dist/utility/wrun/wrun-run-health.util.d.ts +89 -2
  277. package/dist/utility/wrun/wrun-run-health.util.js +204 -1
  278. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +2 -2
  279. package/dist/utility/wrun/wrun-run-interval-session.util.js +2 -2
  280. package/dist/utility/wrun/wrun-run-interval.util.d.ts +9 -8
  281. package/dist/utility/wrun/wrun-run-interval.util.js +13 -11
  282. package/dist/utility/wrun/wrun-sandbox-row-source.js +5 -2
  283. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +13 -3
  284. package/dist/utility/wrun/wrun-script-inputs.util.js +51 -13
  285. package/dist/utility/wrun/wrun-session-composition.util.d.ts +81 -0
  286. package/dist/utility/wrun/wrun-session-composition.util.js +169 -0
  287. package/dist/utility/wrun/wrun-setting-words.util.d.ts +10 -7
  288. package/dist/utility/wrun/wrun-setting-words.util.js +25 -7
  289. package/dist/utility/wrun/wrun-source-rows.util.d.ts +94 -28
  290. package/dist/utility/wrun/wrun-source-rows.util.js +738 -93
  291. package/dist/utility/wrun/wrun-stream-clock.util.d.ts +45 -0
  292. package/dist/utility/wrun/wrun-stream-clock.util.js +108 -0
  293. package/dist/utility/wrun/wrun-tape-coins.util.d.ts +116 -0
  294. package/dist/utility/wrun/wrun-tape-coins.util.js +110 -0
  295. package/dist/utility/wrun/wrun-tape-source.util.d.ts +62 -32
  296. package/dist/utility/wrun/wrun-tape-source.util.js +72 -34
  297. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +13 -5
  298. package/dist/utility/wrun/wrun-tier-grid.util.js +23 -13
  299. package/dist/utility/wrun/wrun-tpo-rows.util.js +2 -1
  300. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +73 -0
  301. package/dist/utility/wrun/wrun-trades-lane.util.js +82 -0
  302. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +5 -0
  303. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +9 -2
  304. package/dist/utility/wrun/wrun-visibility-table.d.ts +13 -0
  305. package/dist/utility/wrun/wrun-visibility-table.js +9 -0
  306. package/dist/utility/wrun/wrun-volume-profile.util.js +44 -32
  307. package/dist/utils/replay/replay-buffer-math.d.ts +16 -6
  308. package/dist/utils/replay/replay-buffer-math.js +60 -30
  309. package/dist/workers/constants/socket-slots.d.ts +11 -7
  310. package/dist/workers/constants/socket-slots.js +6 -5
  311. package/package.json +11 -11
@@ -22,9 +22,10 @@
22
22
  * draws. Data-only outputs (sheet plot "", the wrun ABI's
23
23
  * color_by/width_by index sources) never mount, and neither do fully
24
24
  * transparent ones (opacity 0 with no color ladder, a range's edge
25
- * helper). Every mounted output, range and fill pair carries `labels`:
26
- * each output's declared `label`, else its name in words
27
- * (`wrunLegendName`, wrun-legend-name.util: `odds_by_price` -> "Odds by
25
+ * helper), except a fill side, which mounts as a stroke that paints
26
+ * nothing and answers no hover card. Every mounted output, range and fill
27
+ * pair carries `labels`: each output's declared `label`, else its name in
28
+ * words (`wrunLegendName`, wrun-legend-name.util: `odds_by_price` -> "Odds by
28
29
  * price", `gex_curve` -> "GEX curve"), the column the kScript engine fills
29
30
  * from plot(label=...) and the legend, the alert pickers and the
30
31
  * price-axis menu read, never the numbered "Plot N" fallback. The lower
@@ -488,17 +489,27 @@
488
489
  * each legend line in mount order instead of the control's amber
489
490
  * fallback. A malformed `legend_palette` refuses every run by name.
490
491
  * - Typed-inputs presentation keys (WRUN-INPUTS-PLAN 1.3, 1.4), all
491
- * optional, a sheet without them byte-identical:
492
+ * optional, a sheet without them byte-identical (but for the no-ink
493
+ * `hover_card: false` below):
492
494
  * - an output's `format` (one of the frozen words, wrun-pane-format.util)
493
495
  * rides the mounted output as `format`, an FE-only field the legend
494
496
  * reads off the run output (kScriptLegendLineFormat) to print that line;
495
497
  * `legend: false` rides as the `legend: false` kScriptLegendLines reads
496
498
  * (drawn all the same, never a legend line, nor in the derived palette);
497
- * `glow` (px, a line output) is the engine's plotOutput.glow and
498
- * `corner` (px, a bar output) the histogram corner radius the engine
499
- * lights on its next pin. A malformed key, `glow` off a line or `corner`
500
- * off a bar refuses by name; `visible` is validated here and applied
501
- * after integration (applyWrunOutputVisibility).
499
+ * `hover_card: false` rides as the `hover_card: false` the hover
500
+ * surfaces read (optsOutOfHover: drawn, listed and printed all the same,
501
+ * never a hover card, over the plot or the legend value); `glow` (px, a
502
+ * line output) is the engine's plotOutput.glow and `corner` (px, a bar
503
+ * output) the histogram corner radius the engine lights on its next pin.
504
+ * A malformed key, `glow` off a line or `corner` off a bar refuses by
505
+ * name; `visible` is validated here and applied after integration
506
+ * (applyWrunOutputVisibility). Every mount takes these words from one
507
+ * helper (wrunMountPresentationFields; a candle group from its four
508
+ * members), which also stamps `hover_card: false` on a mount that paints
509
+ * no ink (no ink, no card): a transparent fill side, any drawn output at
510
+ * opacity 0 (every colour it draws fades to nothing, OT30: a laddered
511
+ * line or mark, a bar sign palette), a candle group whose first output
512
+ * is at opacity 0.
502
513
  * - `legend_title` (top level, the kit's legend({ title })) is the legend
503
514
  * suffix with `{{param}}` placeholders, resolved against the run's param
504
515
  * values (a select as its label, a toggle as true / false) and emitted as
@@ -517,7 +528,10 @@
517
528
  * - `presentation` (legend entries, HUD cards) and an output's `hover`,
518
529
  * `tooltip`, `hint` and `badges` never reach the run result: the legend,
519
530
  * the HUD and the hover card read them off the sheet
520
- * (wrun-legend-hover, wrun-hover.util).
531
+ * (wrun-legend-hover, wrun-hover.util). Whether a mounted plot answers a
532
+ * card at all is the run output's `hover_card` (above), never the
533
+ * sheet's: the readers walk mounted plots, and only the mount knows
534
+ * whether it paints ink.
521
535
  * - WRUN-STYLE (FREEZE.md 3.5.4): this file is wiring only. The look of
522
536
  * every surface lives with its area util and reaches the result through
523
537
  * frozen seams: outputs through `wrunOutputLookPatch` and the guide,
@@ -834,6 +848,9 @@ export interface WrunRunResult {
834
848
  * `visible` is an output's own kit key). The sheet itself when no declaration carries the key.
835
849
  */
836
850
  export declare function wrunSelectionSheet(metadata: WrunIndicatorMetadata): WrunIndicatorMetadata;
851
+ /** The value bytes the build of `result` charged its render budget (wrunResultRenderBytes); undefined for a result
852
+ * this builder did not make (a refusal's empty result, a copy). */
853
+ export declare function wrunRunResultRenderBytes(result: WrunRunResult): number | undefined;
837
854
  export declare function buildWrunRunResult(options: WrunRunResultOptions): WrunRunResult;
838
855
  /** A run result's author-facing notices (every canvas child's, in child
839
856
  * order; a fresh array, empty when there are none). A run seam publishes
@@ -854,8 +871,8 @@ export declare function resolveWrunLegendTitle(template: string, params: Readonl
854
871
  * legend line i paints (titan's legend text colour, alpha stripped, so the
855
872
  * chip reads opaque like a kScript colour input). The lines are the
856
873
  * outputs the adapter mounts, in mount order, that the legend lists
857
- * (kScriptLegendLines: value plots, never a guide, mark, candle,
858
- * background, data-only output or a `legend: false` range). A result with
874
+ * (kScriptLegendLines: value plots and candle groups, never a guide, mark,
875
+ * background, data-only output or a `legend: false` output or range). A result with
859
876
  * no legend line gets the first visible colour it draws (its outputs, then
860
877
  * `renderers`, the sheet's declarations). Empty when nothing draws a
861
878
  * colour (the control's amber fallback). The lower pane (the `series`
@@ -22,9 +22,10 @@
22
22
  * draws. Data-only outputs (sheet plot "", the wrun ABI's
23
23
  * color_by/width_by index sources) never mount, and neither do fully
24
24
  * transparent ones (opacity 0 with no color ladder, a range's edge
25
- * helper). Every mounted output, range and fill pair carries `labels`:
26
- * each output's declared `label`, else its name in words
27
- * (`wrunLegendName`, wrun-legend-name.util: `odds_by_price` -> "Odds by
25
+ * helper), except a fill side, which mounts as a stroke that paints
26
+ * nothing and answers no hover card. Every mounted output, range and fill
27
+ * pair carries `labels`: each output's declared `label`, else its name in
28
+ * words (`wrunLegendName`, wrun-legend-name.util: `odds_by_price` -> "Odds by
28
29
  * price", `gex_curve` -> "GEX curve"), the column the kScript engine fills
29
30
  * from plot(label=...) and the legend, the alert pickers and the
30
31
  * price-axis menu read, never the numbered "Plot N" fallback. The lower
@@ -488,17 +489,27 @@
488
489
  * each legend line in mount order instead of the control's amber
489
490
  * fallback. A malformed `legend_palette` refuses every run by name.
490
491
  * - Typed-inputs presentation keys (WRUN-INPUTS-PLAN 1.3, 1.4), all
491
- * optional, a sheet without them byte-identical:
492
+ * optional, a sheet without them byte-identical (but for the no-ink
493
+ * `hover_card: false` below):
492
494
  * - an output's `format` (one of the frozen words, wrun-pane-format.util)
493
495
  * rides the mounted output as `format`, an FE-only field the legend
494
496
  * reads off the run output (kScriptLegendLineFormat) to print that line;
495
497
  * `legend: false` rides as the `legend: false` kScriptLegendLines reads
496
498
  * (drawn all the same, never a legend line, nor in the derived palette);
497
- * `glow` (px, a line output) is the engine's plotOutput.glow and
498
- * `corner` (px, a bar output) the histogram corner radius the engine
499
- * lights on its next pin. A malformed key, `glow` off a line or `corner`
500
- * off a bar refuses by name; `visible` is validated here and applied
501
- * after integration (applyWrunOutputVisibility).
499
+ * `hover_card: false` rides as the `hover_card: false` the hover
500
+ * surfaces read (optsOutOfHover: drawn, listed and printed all the same,
501
+ * never a hover card, over the plot or the legend value); `glow` (px, a
502
+ * line output) is the engine's plotOutput.glow and `corner` (px, a bar
503
+ * output) the histogram corner radius the engine lights on its next pin.
504
+ * A malformed key, `glow` off a line or `corner` off a bar refuses by
505
+ * name; `visible` is validated here and applied after integration
506
+ * (applyWrunOutputVisibility). Every mount takes these words from one
507
+ * helper (wrunMountPresentationFields; a candle group from its four
508
+ * members), which also stamps `hover_card: false` on a mount that paints
509
+ * no ink (no ink, no card): a transparent fill side, any drawn output at
510
+ * opacity 0 (every colour it draws fades to nothing, OT30: a laddered
511
+ * line or mark, a bar sign palette), a candle group whose first output
512
+ * is at opacity 0.
502
513
  * - `legend_title` (top level, the kit's legend({ title })) is the legend
503
514
  * suffix with `{{param}}` placeholders, resolved against the run's param
504
515
  * values (a select as its label, a toggle as true / false) and emitted as
@@ -517,7 +528,10 @@
517
528
  * - `presentation` (legend entries, HUD cards) and an output's `hover`,
518
529
  * `tooltip`, `hint` and `badges` never reach the run result: the legend,
519
530
  * the HUD and the hover card read them off the sheet
520
- * (wrun-legend-hover, wrun-hover.util).
531
+ * (wrun-legend-hover, wrun-hover.util). Whether a mounted plot answers a
532
+ * card at all is the run output's `hover_card` (above), never the
533
+ * sheet's: the readers walk mounted plots, and only the mount knows
534
+ * whether it paints ink.
521
535
  * - WRUN-STYLE (FREEZE.md 3.5.4): this file is wiring only. The look of
522
536
  * every surface lives with its area util and reaches the result through
523
537
  * frozen seams: outputs through `wrunOutputLookPatch` and the guide,
@@ -708,6 +722,14 @@ export function wrunSelectionSheet(metadata) {
708
722
  selectionSheets.set(metadata, selected);
709
723
  return selected;
710
724
  }
725
+ /** The value bytes each built result's render budget charged (the selection's rows, drawings, labels, tables and frame
726
+ * consumers, the handle set, the strategy): what a holder of the result keeps besides object overhead. */
727
+ const wrunResultRenderBytes = new WeakMap();
728
+ /** The value bytes the build of `result` charged its render budget (wrunResultRenderBytes); undefined for a result
729
+ * this builder did not make (a refusal's empty result, a copy). */
730
+ export function wrunRunResultRenderBytes(result) {
731
+ return wrunResultRenderBytes.get(result);
732
+ }
711
733
  export function buildWrunRunResult(options) {
712
734
  // A live tick's build memo (wrun-build-memo.util): the selection's renderers and the builder's units reuse what
713
735
  // the memo's last build did, keyed on every option they read beside the sheet and the rows.
@@ -752,6 +774,7 @@ export function buildWrunRunResult(options) {
752
774
  const headline = wrunHudHeadlineOf(options);
753
775
  if (headline !== undefined)
754
776
  result.headline = headline;
777
+ wrunResultRenderBytes.set(result, budget.spent);
755
778
  return result;
756
779
  }
757
780
  catch (error) {
@@ -967,8 +990,8 @@ function wrunColorIsVisible(color) {
967
990
  * legend line i paints (titan's legend text colour, alpha stripped, so the
968
991
  * chip reads opaque like a kScript colour input). The lines are the
969
992
  * outputs the adapter mounts, in mount order, that the legend lists
970
- * (kScriptLegendLines: value plots, never a guide, mark, candle,
971
- * background, data-only output or a `legend: false` range). A result with
993
+ * (kScriptLegendLines: value plots and candle groups, never a guide, mark,
994
+ * background, data-only output or a `legend: false` output or range). A result with
972
995
  * no legend line gets the first visible colour it draws (its outputs, then
973
996
  * `renderers`, the sheet's declarations). Empty when nothing draws a
974
997
  * colour (the control's amber fallback). The lower pane (the `series`
@@ -1221,7 +1244,7 @@ function readWrunOutputPresentation(sheetId, output, mount) {
1221
1244
  }
1222
1245
  presentation.format = format;
1223
1246
  }
1224
- for (const key of ['legend', 'visible']) {
1247
+ for (const key of ['legend', 'hover_card', 'visible']) {
1225
1248
  const flag = output[key];
1226
1249
  if (flag !== undefined && typeof flag !== 'boolean') {
1227
1250
  throw new Error(`WRUN ${sheetId}: ${subject} ${key} must be a boolean, got ${JSON.stringify(flag)}`);
@@ -1229,6 +1252,8 @@ function readWrunOutputPresentation(sheetId, output, mount) {
1229
1252
  }
1230
1253
  if (output.legend === false)
1231
1254
  presentation.legend = false;
1255
+ if (output.hover_card === false)
1256
+ presentation.hover_card = false;
1232
1257
  const px = (key, takers, taken) => {
1233
1258
  const value = output[key];
1234
1259
  if (value === undefined)
@@ -1252,6 +1277,36 @@ function readWrunOutputPresentation(sheetId, output, mount) {
1252
1277
  presentation.corner = corner;
1253
1278
  return presentation;
1254
1279
  }
1280
+ /** Whether a mount of `output` paints no ink: every colour an output draws fades with its opacity
1281
+ * (WRUN-STYLE OT30: the static colour, the sign pair, the ladders, the marks, a candle group's body,
1282
+ * border and wick pairs by its first member's), so at opacity 0 nothing it draws shows. A transparent
1283
+ * output (isWrunTransparentOutput: opacity 0 with no ladder or bar palette, a fill side that mounts as a
1284
+ * transparent stroke) is one such mount. */
1285
+ function wrunOutputPaintsNoInk(output) {
1286
+ return output.opacity === 0 || isWrunTransparentOutput(output);
1287
+ }
1288
+ /** The words every mounted output carries for the surfaces that read it off the run output
1289
+ * (`legend: false` for the legend, `hover_card: false` for the hover card, `format` for both), read
1290
+ * off the presentation of the outputs it draws: one output for a line, a bar, a shape or a guide, all
1291
+ * four members for a candle group (ONE legend entry reading O H L C, ONE hover card). A member's
1292
+ * `legend: false` keeps the entry out of the legend, a member's `hover_card: false` keeps the mount
1293
+ * off every hover card, and the first declared `format` prints its values, so no member's word is
1294
+ * dropped because it sits off the group's first output. `paints` is the output whose colours the
1295
+ * mount draws (the output itself, a candle group's first member): a mount that paints no ink
1296
+ * (wrunOutputPaintsNoInk) answers no hover card either, whatever its sheet says, since a card over
1297
+ * nothing drawn answers for a line the user cannot see. Every mount takes these words from here: a
1298
+ * mount that built them by hand dropped them (the candle group's legend: false printed the close on
1299
+ * the pane's legend row, 2026-11-02; the transparent fill side, a literal `legend: false`, opened a
1300
+ * card over the empty price pane where it sits, 2026-11-03). */
1301
+ function wrunMountPresentationFields(presentations, paints) {
1302
+ const format = presentations.find((presentation) => presentation.format !== undefined)?.format;
1303
+ const noCard = wrunOutputPaintsNoInk(paints) || presentations.some((presentation) => presentation.hover_card === false);
1304
+ return {
1305
+ ...(presentations.some((presentation) => presentation.legend === false) ? { legend: false } : {}),
1306
+ ...(noCard ? { hover_card: false } : {}),
1307
+ ...(format !== undefined ? { format } : {}),
1308
+ };
1309
+ }
1255
1310
  /** Whether any ready row carries a finite value in every named column: what
1256
1311
  * an `omit_if_empty` declaration needs to mount. */
1257
1312
  function wrunRowsCarryValue(rows, columns) {
@@ -1755,13 +1810,15 @@ function buildWrunRunResultWithSelection(options, memo) {
1755
1810
  const mount = wrunOutputMount(output, candleMembers, candleGroupByOpen);
1756
1811
  const chrome = readWrunOutputChrome(metadata.id, output, mount);
1757
1812
  // The presentation keys that ride the mounted output: `format`, `legend:
1758
- // false`, `glow`, `corner` (plan 1.3), read up front like the chrome so
1759
- // a malformed key refuses on every run.
1813
+ // false`, `hover_card: false`, `glow`, `corner` (plan 1.3), read up front
1814
+ // like the chrome so a malformed key refuses on every run.
1760
1815
  const presentation = readWrunOutputPresentation(metadata.id, output, mount);
1761
1816
  if (hiddenOutputs.has(output.name))
1762
1817
  return;
1763
- const legendFields = presentation.legend === false ? { legend: false } : {};
1764
- const formatFields = presentation.format !== undefined ? { format: presentation.format } : {};
1818
+ // The words every mount carries for its readers (`legend: false`, `hover_card: false`, `format`), the
1819
+ // hover's also when the mount paints no ink; a candle group reads its four members'
1820
+ // (wrunMountPresentationFields).
1821
+ const mountFields = wrunMountPresentationFields([presentation], output);
1765
1822
  const styled = output;
1766
1823
  // Every colour the output draws fades with its opacity (WRUN-STYLE
1767
1824
  // OT30): the static colour, the sign pair, the ladders, the marks.
@@ -1846,9 +1903,16 @@ function buildWrunRunResultWithSelection(options, memo) {
1846
1903
  if (group === undefined)
1847
1904
  refusePackedOn('only the first output of a candle group takes the group colours');
1848
1905
  else {
1849
- // The first output's glow lights the whole group (OT16).
1906
+ // The group is one legend entry and one hover card: its words are its four members'
1907
+ // (a member's `legend: false` keeps it out of the legend, a member's `hover_card: false`
1908
+ // off the card, the first `format` prints it), and it paints with its first output's
1909
+ // colours (every one faded by that output's opacity), so that output's ink decides the
1910
+ // card too. The first output's glow lights the whole group (OT16).
1850
1911
  const candle = {
1851
1912
  ...sheetCandleOutput(group),
1913
+ ...wrunMountPresentationFields(group.map((member) => member === output
1914
+ ? presentation
1915
+ : readWrunOutputPresentation(metadata.id, member, wrunOutputMount(member, candleMembers, candleGroupByOpen))), group[0]),
1852
1916
  ...(presentation.glow !== undefined ? { glow: presentation.glow } : {}),
1853
1917
  };
1854
1918
  // `omit_if_empty`: a candle group that never drew a bar (no row with
@@ -1884,12 +1948,15 @@ function buildWrunRunResultWithSelection(options, memo) {
1884
1948
  // legend slot or price tag; ranges read its values off the rows. A fill
1885
1949
  // resolves its sides as sibling plots, so a transparent fill side is drawn
1886
1950
  // (the om reference's rule, the cloud shaper's own): it mounts as a series
1887
- // that paints nothing (a transparent stroke, no legend line, no tag).
1951
+ // that paints nothing (a transparent stroke, no legend line, no tag, and
1952
+ // no hover card: the mount words carry `hover_card: false`, since it
1953
+ // paints no ink, and the series hover passes over it).
1888
1954
  if (isWrunTransparentOutput(output)) {
1889
1955
  if (fillSides.has(output.name)) {
1890
1956
  outputs[output.name] = {
1891
1957
  plotType: 'spline',
1892
1958
  labels: [labelOf(output.name)],
1959
+ ...mountFields,
1893
1960
  legend: false,
1894
1961
  priceMarkers: false,
1895
1962
  showPriceDisplay: false,
@@ -2002,8 +2069,7 @@ function buildWrunRunResultWithSelection(options, memo) {
2002
2069
  // Off per_output there is no marker role to keep its NaN row.
2003
2070
  ...(perOutputPriceDisplay ? {} : { markerSkeleton: true }),
2004
2071
  labels: [labelOf(output.name)],
2005
- ...legendFields,
2006
- ...formatFields,
2072
+ ...mountFields,
2007
2073
  ...(presentation.glow !== undefined ? { glow: presentation.glow } : {}),
2008
2074
  colors: [staticColor],
2009
2075
  ...(sized !== undefined ? sized.width : output.width !== undefined ? { width: output.width } : {}),
@@ -2088,8 +2154,7 @@ function buildWrunRunResultWithSelection(options, memo) {
2088
2154
  lineStyle: output.line_style ?? 'solid',
2089
2155
  ...lineage('guide'),
2090
2156
  labels: [labelOf(output.name)],
2091
- ...legendFields,
2092
- ...formatFields,
2157
+ ...mountFields,
2093
2158
  ...(onPricePane ? { forceOnChart: true } : {}),
2094
2159
  data: fillSides.has(output.name) ? rows.map((row) => [row.ts, value]) : [],
2095
2160
  ...wrunOutputLookPatch(output, 'line', lookContext(baseColor, guideTag)),
@@ -2210,8 +2275,7 @@ function buildWrunRunResultWithSelection(options, memo) {
2210
2275
  // is no marker role, so it keeps its NaN row through markerSkeleton.
2211
2276
  ...(kind === 'point' ? { ...wrunMarkTag(valueTag), markerSkeleton: true } : valueTag),
2212
2277
  labels: [labelOf(output.name)],
2213
- ...legendFields,
2214
- ...formatFields,
2278
+ ...mountFields,
2215
2279
  // `glow` (px) is the engine's plotOutput.glow; `corner` (px) the
2216
2280
  // histogram corner radius, lit by the engine's next pin.
2217
2281
  ...(presentation.glow !== undefined ? { glow: presentation.glow } : {}),
@@ -6,6 +6,7 @@ import IsoWeek from 'dayjs/plugin/isoWeek.js';
6
6
  import QuarterOfYear from 'dayjs/plugin/quarterOfYear.js';
7
7
  import { Intervals } from '../../constants/interval.constants.js';
8
8
  import { nyMarketPhaseAt } from '../chart/ny-calendar.util.js';
9
+ import { serverNowMs } from '../auth/server-clock.util.js';
9
10
  dayjs.extend(Utc);
10
11
  dayjs.extend(Timezone);
11
12
  dayjs.extend(IsoWeek);
@@ -297,7 +298,7 @@ const WEEKDAY_INDEX = {
297
298
  * (not dayjs) because consumers want discrete year/month/day/weekday fields
298
299
  * for slug building and arithmetic, not a formatted string.
299
300
  */
300
- export function getETParts(now = new Date()) {
301
+ export function getETParts(now = new Date(serverNowMs())) {
301
302
  const parts = new Intl.DateTimeFormat('en-US', {
302
303
  timeZone: ET_TIMEZONE,
303
304
  year: 'numeric',
@@ -335,17 +336,17 @@ export function shiftETDay(base, deltaDays) {
335
336
  * Stable "ET day" key. Two instants in the same ET calendar day produce the
336
337
  * same string across any local timezone — use for rollover detection.
337
338
  */
338
- export function getETDayKey(now = new Date()) {
339
+ export function getETDayKey(now = new Date(serverNowMs())) {
339
340
  const { year, month, day } = getETParts(now);
340
341
  return `${year}-${month}-${day}`;
341
342
  }
342
343
  /** Stable ET-month key (e.g. "2026-3" for April). */
343
- export function getETMonthKey(now = new Date()) {
344
+ export function getETMonthKey(now = new Date(serverNowMs())) {
344
345
  const { year, month } = getETParts(now);
345
346
  return `${year}-${month}`;
346
347
  }
347
348
  /** Stable ET-week key anchored on Monday (matches PM weekly slug windows). */
348
- export function getETWeekKey(now = new Date()) {
349
+ export function getETWeekKey(now = new Date(serverNowMs())) {
349
350
  const parts = getETParts(now);
350
351
  const diffToMonday = parts.weekday === 0 ? -6 : 1 - parts.weekday;
351
352
  const monday = shiftETDay(parts, diffToMonday);
@@ -1,4 +1,5 @@
1
1
  import type { EarningsEventKind, MarketEventsCoverage } from '../../interfaces/market-event.interface.js';
2
+ import { type DisplayOffset } from '../chart/display-offset.leaf.js';
2
3
  export declare const DAY_MS: number;
3
4
  /** What one slice holds: one kind, one ticker or every ticker, the major companies (impact >= 2) or all of them. */
4
5
  export interface EarningsScope {
@@ -37,15 +38,19 @@ export declare function earningsKeyKind(key: string): EarningsEventKind | null;
37
38
  * The list: the week behind today and the two ahead as days of the chart's
38
39
  * zone, [today − 7 d, today + 14 d), rounded out to whole UTC days so no zone
39
40
  * day is cut at either edge. In UTC that is exactly [today − 7 d, today + 14 d).
41
+ * Each edge is a zone midnight on its own offset (`offset`: a fixed shift, or
42
+ * the shift at each instant), so a clock change inside the three weeks never
43
+ * cuts the hour after an edge's midnight.
40
44
  */
41
- export declare function listWindow(now: number, offsetMs?: number): EarningsWindow;
45
+ export declare function listWindow(now: number, offset?: DisplayOffset): EarningsWindow;
42
46
  /**
43
47
  * One calendar month of the chart's zone (`month` 0 to 11 as
44
- * `Date#getUTCMonth()` reads it), rounded out to whole UTC days. A zone east
45
- * of UTC starts its month before UTC midnight: a US after-close print on the
46
- * zone's 1st would otherwise fall out of both months.
48
+ * `Date#getUTCMonth()` reads it), rounded out to whole UTC days, each edge a
49
+ * zone midnight on its own offset. A zone east of UTC starts its month before
50
+ * UTC midnight: a US after-close print on the zone's 1st would otherwise fall
51
+ * out of both months.
47
52
  */
48
- export declare function monthWindow(year: number, month: number, offsetMs?: number): EarningsWindow;
53
+ export declare function monthWindow(year: number, month: number, offset?: DisplayOffset): EarningsWindow;
49
54
  /**
50
55
  * One ticker's whole stored horizon, [today − 400 d, today + 90 d): 490 days,
51
56
  * allowed because a ticker query is not held to the 92-day span of a broad one.
@@ -1,3 +1,4 @@
1
+ import { displayWallMs, displayWallToUtcMs } from '../chart/display-offset.leaf.js';
1
2
  export const DAY_MS = 24 * 60 * 60 * 1000;
2
3
  /** The ticker filter the backend accepts (`^[A-Z][A-Z0-9.\-]{0,9}$`, upper case). */
3
4
  export const EARNINGS_TICKER_PATTERN = /^[A-Z][A-Z0-9.-]{0,9}$/;
@@ -56,21 +57,28 @@ export function earningsKeyKind(key) {
56
57
  * The list: the week behind today and the two ahead as days of the chart's
57
58
  * zone, [today − 7 d, today + 14 d), rounded out to whole UTC days so no zone
58
59
  * day is cut at either edge. In UTC that is exactly [today − 7 d, today + 14 d).
60
+ * Each edge is a zone midnight on its own offset (`offset`: a fixed shift, or
61
+ * the shift at each instant), so a clock change inside the three weeks never
62
+ * cuts the hour after an edge's midnight.
59
63
  */
60
- export function listWindow(now, offsetMs = 0) {
61
- const today = Math.floor((now + offsetMs) / DAY_MS) * DAY_MS - offsetMs;
62
- return { from: floorUtcDay(today - 7 * DAY_MS), to: ceilUtcDay(today + 14 * DAY_MS) };
64
+ export function listWindow(now, offset = 0) {
65
+ const today = Math.floor(displayWallMs(offset, now) / DAY_MS) * DAY_MS;
66
+ return {
67
+ from: floorUtcDay(displayWallToUtcMs(offset, today - 7 * DAY_MS)),
68
+ to: ceilUtcDay(displayWallToUtcMs(offset, today + 14 * DAY_MS)),
69
+ };
63
70
  }
64
71
  /**
65
72
  * One calendar month of the chart's zone (`month` 0 to 11 as
66
- * `Date#getUTCMonth()` reads it), rounded out to whole UTC days. A zone east
67
- * of UTC starts its month before UTC midnight: a US after-close print on the
68
- * zone's 1st would otherwise fall out of both months.
73
+ * `Date#getUTCMonth()` reads it), rounded out to whole UTC days, each edge a
74
+ * zone midnight on its own offset. A zone east of UTC starts its month before
75
+ * UTC midnight: a US after-close print on the zone's 1st would otherwise fall
76
+ * out of both months.
69
77
  */
70
- export function monthWindow(year, month, offsetMs = 0) {
78
+ export function monthWindow(year, month, offset = 0) {
71
79
  return {
72
- from: floorUtcDay(Date.UTC(year, month, 1) - offsetMs),
73
- to: ceilUtcDay(Date.UTC(year, month + 1, 1) - offsetMs),
80
+ from: floorUtcDay(displayWallToUtcMs(offset, Date.UTC(year, month, 1))),
81
+ to: ceilUtcDay(displayWallToUtcMs(offset, Date.UTC(year, month + 1, 1))),
74
82
  };
75
83
  }
76
84
  /**
@@ -1,4 +1,5 @@
1
1
  import type { EarningsSlot, MarketAssetClass, MarketEvent, MarketEventImpact, MarketEventSeriesLink } from '../../interfaces/market-event.interface.js';
2
+ import { type DisplayOffset } from '../chart/display-offset.leaf.js';
2
3
  import { type VenueMarketKind } from '../chart/marketKind.util.js';
3
4
  /** Chart-side market kind → the server's relevance bucket. */
4
5
  export declare function assetClassForMarketKind(kind: VenueMarketKind): MarketAssetClass;
@@ -94,8 +95,11 @@ export declare function surpriseGlyph(event: MarketEvent): string;
94
95
  /** Escape vendor text before it rides an HTML-capable tooltip. */
95
96
  export declare function escapeHtml(text: string): string;
96
97
  export declare function isSourceFresh(lastSyncAt: number | null | undefined, now: number): boolean;
97
- /** Day bucket in a fixed UTC-offset zone (the chart's time zone), for list headers. */
98
- export declare function dayKey(at: number, offsetMs: number): string;
98
+ /**
99
+ * Day bucket in the chart's time zone, for list headers: the instant's own wall date, `offset` read at the instant
100
+ * (a fixed shift, or the shift at each instant for a zone that moves its clock).
101
+ */
102
+ export declare function dayKey(at: number, offset: DisplayOffset): string;
99
103
  /**
100
104
  * The calendar day a row belongs to in the zone. A date-only row (every
101
105
  * dividend, a report with no announced time) carries a 09:30 Eastern
@@ -104,7 +108,7 @@ export declare function dayKey(at: number, offsetMs: number): string;
104
108
  */
105
109
  export declare function rowDayKey(event: Pick<MarketEvent, 'at'> & {
106
110
  timing?: MarketEvent['timing'];
107
- }, offsetMs: number): string;
111
+ }, offset: DisplayOffset): string;
108
112
  /** Where a day sits relative to today; the panels localize it ("Today", "Tomorrow", else the date). */
109
113
  export type DayGroupKey = 'today' | 'tomorrow' | 'date';
110
114
  export interface DayGroup<T extends Pick<MarketEvent, 'at'> = MarketEvent> {
@@ -117,13 +121,16 @@ export interface DayGroup<T extends Pick<MarketEvent, 'at'> = MarketEvent> {
117
121
  events: T[];
118
122
  }
119
123
  /**
120
- * Rows by calendar day in a fixed UTC-offset zone (the chart's time zone), in
121
- * order of first appearance (pass rows sorted by time). Raw keys only: the
122
- * panels word them.
124
+ * Rows by calendar day in the chart's time zone, in order of first
125
+ * appearance (pass rows sorted by time). Each row reads its own day at its
126
+ * own instant's offset (a zone moves its clock: one offset read now puts a
127
+ * row across a clock change an hour off its day), and tomorrow is the
128
+ * calendar's next date, never now plus 24 hours (a zone day around a change
129
+ * is 23 or 25 hours long). Raw keys only: the panels word them.
123
130
  */
124
131
  export declare function dayGroups<T extends Pick<MarketEvent, 'at'> & {
125
132
  timing?: MarketEvent['timing'];
126
- } = MarketEvent>(events: readonly T[], nowMs: number, offsetMs: number): DayGroup<T>[];
133
+ } = MarketEvent>(events: readonly T[], nowMs: number, offset: DisplayOffset): DayGroup<T>[];
127
134
  /** Whether an exact print is close enough that surfaces should poll fast; earnings and dividends never count. */
128
135
  export declare function isNearRelease(events: MarketEvent[], now: number, beforeMs: number, afterMs: number): boolean;
129
136
  export interface ChartReach {
@@ -1,3 +1,4 @@
1
+ import { displayWallMs, displayWallToUtcMs } from '../chart/display-offset.leaf.js';
1
2
  import { checkIsPolygon, getMarketKind } from '../chart/marketKind.util.js';
2
3
  import { EARNINGS_TICKER_PATTERN } from './earnings-scope.util.js';
3
4
  import { easternTime } from './zoned-clock.util.js';
@@ -299,10 +300,17 @@ const MARKET_EVENTS_STALE_AFTER_MS = 2 * 60 * 60 * 1000;
299
300
  export function isSourceFresh(lastSyncAt, now) {
300
301
  return typeof lastSyncAt === 'number' && now - lastSyncAt <= MARKET_EVENTS_STALE_AFTER_MS;
301
302
  }
302
- /** Day bucket in a fixed UTC-offset zone (the chart's time zone), for list headers. */
303
- export function dayKey(at, offsetMs) {
304
- const shifted = new Date(at + offsetMs);
305
- return `${shifted.getUTCFullYear()}-${String(shifted.getUTCMonth() + 1).padStart(2, '0')}-${String(shifted.getUTCDate()).padStart(2, '0')}`;
303
+ /** `YYYY-MM-DD` of a UTC-shaped wall clock epoch. */
304
+ const wallDateKey = (wallMs) => {
305
+ const wall = new Date(wallMs);
306
+ return `${wall.getUTCFullYear()}-${String(wall.getUTCMonth() + 1).padStart(2, '0')}-${String(wall.getUTCDate()).padStart(2, '0')}`;
307
+ };
308
+ /**
309
+ * Day bucket in the chart's time zone, for list headers: the instant's own wall date, `offset` read at the instant
310
+ * (a fixed shift, or the shift at each instant for a zone that moves its clock).
311
+ */
312
+ export function dayKey(at, offset) {
313
+ return wallDateKey(displayWallMs(offset, at));
306
314
  }
307
315
  const DAY_MS = 24 * 60 * 60 * 1000;
308
316
  const easternDate = new Intl.DateTimeFormat('en-CA', {
@@ -317,29 +325,34 @@ const easternDate = new Intl.DateTimeFormat('en-CA', {
317
325
  * placeholder instant that only orders the day: it keeps its US date in every
318
326
  * zone, instead of sliding to the next day east of UTC+10.
319
327
  */
320
- export function rowDayKey(event, offsetMs) {
321
- return event.timing === 'date_only' ? easternDate.format(new Date(event.at)) : dayKey(event.at, offsetMs);
328
+ export function rowDayKey(event, offset) {
329
+ return event.timing === 'date_only' ? easternDate.format(new Date(event.at)) : dayKey(event.at, offset);
322
330
  }
323
- /** The instant a `YYYY-MM-DD` day starts in the zone, epoch ms. */
324
- const zoneDayStartOf = (dateKey, offsetMs) => {
331
+ /** A `YYYY-MM-DD` as its UTC midnight (the day's wall midnight as a UTC-shaped epoch). */
332
+ const dateKeyWallMs = (dateKey) => {
325
333
  const [year, month, day] = dateKey.split('-').map(Number);
326
- return Date.UTC(year, month - 1, day) - offsetMs;
334
+ return Date.UTC(year, month - 1, day);
327
335
  };
336
+ /** The instant a `YYYY-MM-DD` day starts in the zone, epoch ms: its wall midnight on that midnight's own offset. */
337
+ const zoneDayStartOf = (dateKey, offset) => displayWallToUtcMs(offset, dateKeyWallMs(dateKey));
328
338
  /**
329
- * Rows by calendar day in a fixed UTC-offset zone (the chart's time zone), in
330
- * order of first appearance (pass rows sorted by time). Raw keys only: the
331
- * panels word them.
339
+ * Rows by calendar day in the chart's time zone, in order of first
340
+ * appearance (pass rows sorted by time). Each row reads its own day at its
341
+ * own instant's offset (a zone moves its clock: one offset read now puts a
342
+ * row across a clock change an hour off its day), and tomorrow is the
343
+ * calendar's next date, never now plus 24 hours (a zone day around a change
344
+ * is 23 or 25 hours long). Raw keys only: the panels word them.
332
345
  */
333
- export function dayGroups(events, nowMs, offsetMs) {
334
- const todayKey = dayKey(nowMs, offsetMs);
335
- const tomorrowKey = dayKey(nowMs + DAY_MS, offsetMs);
346
+ export function dayGroups(events, nowMs, offset) {
347
+ const todayKey = dayKey(nowMs, offset);
348
+ const tomorrowKey = wallDateKey(dateKeyWallMs(todayKey) + DAY_MS);
336
349
  const groups = new Map();
337
350
  for (const event of events) {
338
- const dateKey = rowDayKey(event, offsetMs);
351
+ const dateKey = rowDayKey(event, offset);
339
352
  let group = groups.get(dateKey);
340
353
  if (!group) {
341
354
  const key = dateKey === todayKey ? 'today' : dateKey === tomorrowKey ? 'tomorrow' : 'date';
342
- const dayStartMs = zoneDayStartOf(dateKey, offsetMs);
355
+ const dayStartMs = zoneDayStartOf(dateKey, offset);
343
356
  group = { key, dateKey, dayStartMs, events: [] };
344
357
  groups.set(dateKey, group);
345
358
  }
@@ -56,20 +56,15 @@ export declare function changeNumberFormat(value: number, precision: number): st
56
56
  */
57
57
  export declare function formatAdaptiveVolume(value: number): string;
58
58
  export declare function safeDivide(a: number, b: number): number;
59
- /**
60
- * The ticker's digits for a trade price, so one symbol reads the same number on
61
- * every ticker surface. The decimals come from the price's own magnitude,
62
- * because the FE holds no per-symbol tick size and the chart's axis precision
63
- * moves with every zoom. `reference` is the price a difference belongs to: a
64
- * 24h change prints at its price's resolution.
65
- *
66
- * Venue-blind: every value reads as a trade price. A surface that prints a
67
- * market's figure asks the web's market-aware text
68
- * (`src/utility/chart/market-price-text.util.ts`), which falls back to this for
69
- * a plain price; through this ladder a crypto index market cap printed all
70
- * thirteen digits.
71
- */
72
- export declare function formatPriceByMagnitude(value: number, reference?: number): string;
59
+ /** A market's price convention while its tick is unknown, named by market-price-text.util (no venue imports here). */
60
+ export type PriceConvention = 'usEquity' | 'ladder';
61
+ /** The one price-decimals rule: a known tick decides, else a US stock prints 2 from $1 and 4 below, else null. */
62
+ export declare function conventionPriceDecimals(magnitude: number, convention: PriceConvention, tick: number | null | undefined): number | null;
63
+ /** The ticker's digits: the market's decimals, else the magnitude ladder; surfaces ask market-price-text.util. */
64
+ export declare function formatPriceByMagnitude(value: number, convention: PriceConvention, opts?: {
65
+ reference?: number;
66
+ tick?: number | null;
67
+ }): string;
73
68
  export declare function titlePriceDirection(curr: unknown, prev: unknown, lastGlyph?: string): string;
74
69
  /**
75
70
  * The tab title's price: the ticker bar's text (formatPriceByMagnitude) with
@@ -78,14 +73,12 @@ export declare function titlePriceDirection(curr: unknown, prev: unknown, lastGl
78
73
  * (0.9992810927390368), and an axis stretched by one stray value cut the same
79
74
  * ratio to "1.00". Negative values (spread formulas) keep the magnitude rule.
80
75
  */
81
- export declare function formatTitlePrice(price: number): string;
82
- /**
83
- * The tab title's price and its direction glyph, kept per chart and per market. `formatPrice` prints the price
84
- * (default `formatTitlePrice`, venue-blind): the web passes its market-aware text
85
- * (`src/utility/chart/market-price-text.util.ts`), so a crypto index reads in its own unit (`$1.08T ▲`).
86
- */
76
+ export declare function formatTitlePrice(price: number, convention: PriceConvention, opts?: {
77
+ tick?: number | null;
78
+ }): string;
79
+ /** The tab title's price and glyph per chart and market; `formatPrice` prints the market's text (no blind default). */
87
80
  export declare function formatChartTitlePrice(price: number, tc: TitleChart, context: {
88
81
  symbolKey: string;
89
82
  previousPrice?: number;
90
- }, formatPrice?: (price: number) => string): string;
83
+ }, formatPrice: (price: number) => string): string;
91
84
  export {};