@orangecharts/wrun-chart-host 0.11.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/feature-flags.constants.d.ts +4 -4
  3. package/dist/constants/feature-flags.constants.js +38 -52
  4. package/dist/constants/feature-limits.constants.d.ts +1 -1
  5. package/dist/constants/feature-limits.constants.js +5 -4
  6. package/dist/constants/interval.constants.d.ts +7 -0
  7. package/dist/constants/interval.constants.js +7 -0
  8. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +20 -149
  9. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +20 -309
  10. package/dist/constants/stocks-compliance.constants.d.ts +15 -0
  11. package/dist/constants/stocks-compliance.constants.js +15 -0
  12. package/dist/host-env.d.ts +69 -3
  13. package/dist/host-env.js +21 -0
  14. package/dist/host-ports.types.d.ts +36 -3
  15. package/dist/index.d.ts +18 -0
  16. package/dist/index.js +19 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +52 -12
  18. package/dist/indicators/controls/tpo-session.util.js +113 -16
  19. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +6 -0
  20. package/dist/instances/script-engine-worker-ohlcv-transfer.js +16 -0
  21. package/dist/interfaces/cme-realtime.interface.d.ts +8 -0
  22. package/dist/interfaces/cme-realtime.interface.js +2 -1
  23. package/dist/interfaces/feed.interface.d.ts +15 -1
  24. package/dist/interfaces/replay.interface.d.ts +5 -0
  25. package/dist/interfaces/stocks-realtime.interface.d.ts +4 -3
  26. package/dist/interfaces/stocks-realtime.interface.js +5 -4
  27. package/dist/interfaces/wrun-runtime.interface.d.ts +141 -20
  28. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +17 -0
  29. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +22 -0
  30. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +46 -40
  31. package/dist/kscript-data/controls/live-trades-merge.util.js +80 -107
  32. package/dist/market-data/billing.interface.d.ts +9 -1
  33. package/dist/market-data/venue.d.ts +1 -1
  34. package/dist/market-data/venues/index.d.ts +5 -5
  35. package/dist/market-data/venues/opra.js +3 -3
  36. package/dist/market-data/venues/stocks.contract.copy.json +6 -5
  37. package/dist/market-data/venues/stocks.d.ts +5 -5
  38. package/dist/market-data/venues/stocks.js +21 -18
  39. package/dist/settings-templates/frvp-fields.d.ts +12 -1
  40. package/dist/settings-templates/frvp-fields.js +15 -4
  41. package/dist/settings-templates/index.js +12 -5
  42. package/dist/settings-templates/indicator-fields.js +43 -2
  43. package/dist/settings-templates/tool-rules.d.ts +17 -8
  44. package/dist/settings-templates/tool-rules.js +15 -8
  45. package/dist/settings-templates/tool-tables.generated.js +4 -2
  46. package/dist/utility/auth/server-clock.util.d.ts +3 -1
  47. package/dist/utility/auth/server-clock.util.js +3 -1
  48. package/dist/utility/chart/book-live-bucket.util.js +2 -2
  49. package/dist/utility/chart/cache-alignment.util.d.ts +38 -7
  50. package/dist/utility/chart/cache-alignment.util.js +50 -13
  51. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +2 -0
  52. package/dist/utility/chart/chart-data-fetch-generation.util.js +16 -0
  53. package/dist/utility/chart/cme-session-bucket.util.d.ts +18 -75
  54. package/dist/utility/chart/cme-session-bucket.util.js +25 -332
  55. package/dist/utility/chart/continuous-contracts.util.js +6 -5
  56. package/dist/utility/chart/display-offset.leaf.d.ts +24 -0
  57. package/dist/utility/chart/display-offset.leaf.js +41 -0
  58. package/dist/utility/chart/effective-chart-session.util.d.ts +2 -1
  59. package/dist/utility/chart/effective-chart-session.util.js +13 -5
  60. package/dist/utility/chart/feed-interval.util.d.ts +6 -20
  61. package/dist/utility/chart/feed-interval.util.js +13 -22
  62. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +27 -7
  63. package/dist/utility/chart/fetch-dedupe-policy.util.js +86 -11
  64. package/dist/utility/chart/footprint-band.util.d.ts +21 -5
  65. package/dist/utility/chart/footprint-band.util.js +53 -14
  66. package/dist/utility/chart/host-bar-placement.util.d.ts +7 -4
  67. package/dist/utility/chart/host-bar-placement.util.js +8 -2
  68. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +32 -0
  69. package/dist/utility/chart/indicator-inflight-registry.util.js +52 -0
  70. package/dist/utility/chart/indicator-run-interval.util.d.ts +10 -4
  71. package/dist/utility/chart/indicator-run-interval.util.js +21 -12
  72. package/dist/utility/chart/interval-registry.util.d.ts +1 -1
  73. package/dist/utility/chart/interval-registry.util.js +1 -1
  74. package/dist/utility/chart/kscript-legend-entries.util.d.ts +12 -0
  75. package/dist/utility/chart/kscript-legend-entries.util.js +16 -0
  76. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +1 -1
  77. package/dist/utility/chart/kscript-run-interval-projection.util.js +4 -2
  78. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -62
  79. package/dist/utility/chart/kscript-venue-policy.util.js +85 -94
  80. package/dist/utility/chart/live-bucket.util.d.ts +39 -17
  81. package/dist/utility/chart/live-bucket.util.js +103 -57
  82. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +58 -20
  83. package/dist/utility/chart/local-kscript-source-revalidation.util.js +98 -23
  84. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +35 -11
  85. package/dist/utility/chart/local-kscript-warmup-depth.util.js +24 -3
  86. package/dist/utility/chart/market-session-schedule.util.d.ts +8 -0
  87. package/dist/utility/chart/market-session-schedule.util.js +39 -1
  88. package/dist/utility/chart/market-session.util.d.ts +136 -0
  89. package/dist/utility/chart/market-session.util.js +341 -0
  90. package/dist/utility/chart/om-panel.util.d.ts +5 -3
  91. package/dist/utility/chart/om-panel.util.js +42 -7
  92. package/dist/utility/chart/om-target.util.d.ts +14 -1
  93. package/dist/utility/chart/om-target.util.js +22 -5
  94. package/dist/utility/chart/opra-read-access.leaf.d.ts +16 -1
  95. package/dist/utility/chart/opra-read-access.leaf.js +22 -0
  96. package/dist/utility/chart/profile-row-height.util.d.ts +49 -16
  97. package/dist/utility/chart/profile-row-height.util.js +74 -37
  98. package/dist/utility/chart/rth-session.util.d.ts +55 -20
  99. package/dist/utility/chart/rth-session.util.js +94 -46
  100. package/dist/utility/chart/session-lattice.util.d.ts +150 -0
  101. package/dist/utility/chart/session-lattice.util.js +488 -0
  102. package/dist/utility/chart/trading-day.util.d.ts +40 -2
  103. package/dist/utility/chart/trading-day.util.js +84 -7
  104. package/dist/utility/chart/us-equities-session.util.d.ts +32 -11
  105. package/dist/utility/chart/us-equities-session.util.js +44 -15
  106. package/dist/utility/chart/window-geometry.leaf.d.ts +28 -7
  107. package/dist/utility/chart/window-geometry.leaf.js +57 -8
  108. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +21 -14
  109. package/dist/utility/chart/wrun-bar-session-facts.util.js +32 -38
  110. package/dist/utility/chart/wrun-run-result.util.d.ts +38 -13
  111. package/dist/utility/chart/wrun-run-result.util.js +97 -27
  112. package/dist/utility/common/time.util.js +5 -4
  113. package/dist/utility/market-events/earnings-scope.util.d.ts +10 -5
  114. package/dist/utility/market-events/earnings-scope.util.js +17 -9
  115. package/dist/utility/market-events/market-events.util.d.ts +14 -7
  116. package/dist/utility/market-events/market-events.util.js +30 -17
  117. package/dist/utility/number-format.util.d.ts +14 -21
  118. package/dist/utility/number-format.util.js +38 -24
  119. package/dist/utility/options/option-venue-disclosure.util.d.ts +40 -6
  120. package/dist/utility/options/option-venue-disclosure.util.js +71 -11
  121. package/dist/utility/options/option-venue.util.d.ts +1 -1
  122. package/dist/utility/options/option-venue.util.js +1 -1
  123. package/dist/utility/pool-symbol.leaf.d.ts +7 -0
  124. package/dist/utility/pool-symbol.leaf.js +50 -5
  125. package/dist/utility/stocks/stock-display.util.d.ts +15 -0
  126. package/dist/utility/stocks/stock-display.util.js +37 -0
  127. package/dist/utility/symbol-selection/contract-expiry.util.js +5 -4
  128. package/dist/utility/v2/gate-plane.util.d.ts +6 -0
  129. package/dist/utility/v2/gate-plane.util.js +11 -1
  130. package/dist/utility/v2/gate-session-latch.util.d.ts +1 -1
  131. package/dist/utility/v2/gate-session-latch.util.js +3 -3
  132. package/dist/utility/v2/governed-tier.leaf.d.ts +17 -16
  133. package/dist/utility/v2/governed-tier.leaf.js +17 -16
  134. package/dist/utility/v2/stocks-governed.util.d.ts +5 -0
  135. package/dist/utility/v2/stocks-governed.util.js +14 -0
  136. package/dist/utility/v2/v2-enums.leaf.d.ts +13 -0
  137. package/dist/utility/v2/v2-enums.leaf.js +458 -0
  138. package/dist/utility/wrun/derived-roots.leaf.d.ts +21 -1
  139. package/dist/utility/wrun/derived-roots.leaf.js +27 -1
  140. package/dist/utility/wrun/derived-roots.util.d.ts +44 -32
  141. package/dist/utility/wrun/derived-roots.util.js +97 -56
  142. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -3
  143. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -3
  144. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +2 -1
  145. package/dist/utility/wrun/sources/lanes/option_daily.js +2 -1
  146. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +3 -0
  147. package/dist/utility/wrun/sources/lanes/options_flow.js +23 -5
  148. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -4
  149. package/dist/utility/wrun/sources/row-lane-registry.js +9 -4
  150. package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +19 -0
  151. package/dist/utility/wrun/sources/row-lanes/dark_pool.js +104 -0
  152. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  153. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.d.ts +20 -0
  154. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.js +103 -0
  155. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -2
  156. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +15 -13
  157. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +49 -23
  158. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +14 -9
  159. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +75 -27
  160. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +139 -82
  161. package/dist/utility/wrun/wrun-app-layer.leaf.d.ts +78 -0
  162. package/dist/utility/wrun/wrun-app-layer.leaf.js +89 -0
  163. package/dist/utility/wrun/wrun-bar-count.util.d.ts +11 -7
  164. package/dist/utility/wrun/wrun-bar-count.util.js +12 -8
  165. package/dist/utility/wrun/wrun-batched-kinds.leaf.d.ts +13 -0
  166. package/dist/utility/wrun/wrun-batched-kinds.leaf.js +18 -0
  167. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +46 -23
  168. package/dist/utility/wrun/wrun-batched-marks.util.js +260 -62
  169. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +26 -19
  170. package/dist/utility/wrun/wrun-batched-readout.util.js +81 -27
  171. package/dist/utility/wrun/wrun-book-bands.leaf.d.ts +8 -0
  172. package/dist/utility/wrun/wrun-book-bands.leaf.js +7 -0
  173. package/dist/utility/wrun/wrun-candle-equal.leaf.d.ts +19 -0
  174. package/dist/utility/wrun/wrun-candle-equal.leaf.js +40 -0
  175. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -2
  176. package/dist/utility/wrun/wrun-canvases.util.d.ts +24 -7
  177. package/dist/utility/wrun/wrun-canvases.util.js +99 -30
  178. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +6 -3
  179. package/dist/utility/wrun/wrun-chart-context-names.util.js +8 -4
  180. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +47 -29
  181. package/dist/utility/wrun/wrun-chart-market-facts.util.js +201 -201
  182. package/dist/utility/wrun/wrun-child-overlay-id.util.js +2 -1
  183. package/dist/utility/wrun/wrun-cme-legs-note.util.d.ts +15 -0
  184. package/dist/utility/wrun/wrun-cme-legs-note.util.js +49 -0
  185. package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +38 -0
  186. package/dist/utility/wrun/wrun-cme-root-specs.util.js +81 -0
  187. package/dist/utility/wrun/wrun-coin-lane-live.util.js +3 -0
  188. package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -1
  189. package/dist/utility/wrun/wrun-color-settings.util.js +32 -7
  190. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +50 -0
  191. package/dist/utility/wrun/wrun-dark-pool.util.js +127 -0
  192. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +67 -12
  193. package/dist/utility/wrun/wrun-declared-warmup.util.js +165 -13
  194. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +18 -8
  195. package/dist/utility/wrun/wrun-draft-legend-note.util.js +57 -11
  196. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +14 -10
  197. package/dist/utility/wrun/wrun-draft-overlay.util.js +26 -14
  198. package/dist/utility/wrun/wrun-earnings-facts.util.js +3 -2
  199. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +2 -0
  200. package/dist/utility/wrun/wrun-etf-funds.util.js +4 -0
  201. package/dist/utility/wrun/wrun-held-lanes.util.js +8 -2
  202. package/dist/utility/wrun/wrun-history-as-of.util.d.ts +77 -0
  203. package/dist/utility/wrun/wrun-history-as-of.util.js +108 -0
  204. package/dist/utility/wrun/wrun-host.service.d.ts +64 -14
  205. package/dist/utility/wrun/wrun-host.service.js +137 -27
  206. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +3 -3
  207. package/dist/utility/wrun/wrun-hosted-wire-caps.js +12 -2
  208. package/dist/utility/wrun/wrun-hover.util.d.ts +8 -2
  209. package/dist/utility/wrun/wrun-hover.util.js +24 -13
  210. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +13 -0
  211. package/dist/utility/wrun/wrun-inert-legend.util.js +31 -3
  212. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +7 -5
  213. package/dist/utility/wrun/wrun-input-requirements.leaf.js +16 -6
  214. package/dist/utility/wrun/wrun-install-pacer.util.d.ts +26 -0
  215. package/dist/utility/wrun/wrun-install-pacer.util.js +145 -0
  216. package/dist/utility/wrun/wrun-kit-refusal-stages.types.d.ts +22 -0
  217. package/dist/utility/wrun/wrun-kit-refusal-stages.types.js +1 -0
  218. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +12 -5
  219. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +23 -5
  220. package/dist/utility/wrun/wrun-lane-warmup.util.js +22 -4
  221. package/dist/utility/wrun/wrun-leg-close.util.d.ts +6 -5
  222. package/dist/utility/wrun/wrun-leg-close.util.js +11 -9
  223. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +3 -1
  224. package/dist/utility/wrun/wrun-leg-fetch.util.js +9 -2
  225. package/dist/utility/wrun/wrun-levels-child.util.d.ts +2 -0
  226. package/dist/utility/wrun/wrun-levels-child.util.js +6 -0
  227. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -0
  228. package/dist/utility/wrun/wrun-live-intake.util.d.ts +15 -6
  229. package/dist/utility/wrun/wrun-live-intake.util.js +167 -47
  230. package/dist/utility/wrun/wrun-live-tick.util.d.ts +52 -8
  231. package/dist/utility/wrun/wrun-live-tick.util.js +655 -97
  232. package/dist/utility/wrun/wrun-market-facts.util.d.ts +16 -2
  233. package/dist/utility/wrun/wrun-market-facts.util.js +32 -3
  234. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +27 -27
  235. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +28 -16
  236. package/dist/utility/wrun/wrun-market-size-defaults.util.js +34 -5
  237. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +10 -7
  238. package/dist/utility/wrun/wrun-oi-lane.util.js +16 -10
  239. package/dist/utility/wrun/wrun-option-strike-flow.util.js +1 -1
  240. package/dist/utility/wrun/wrun-option-views.util.d.ts +2 -2
  241. package/dist/utility/wrun/wrun-option-views.util.js +5 -2
  242. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.d.ts +5 -0
  243. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.js +16 -0
  244. package/dist/utility/wrun/wrun-options-stop.util.d.ts +3 -2
  245. package/dist/utility/wrun/wrun-options-stop.util.js +6 -4
  246. package/dist/utility/wrun/wrun-output-words.util.d.ts +14 -0
  247. package/dist/utility/wrun/wrun-output-words.util.js +51 -0
  248. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +116 -11
  249. package/dist/utility/wrun/wrun-overlay-drivers.util.js +208 -43
  250. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +20 -10
  251. package/dist/utility/wrun/wrun-overlay-park.util.d.ts +84 -0
  252. package/dist/utility/wrun/wrun-overlay-park.util.js +135 -0
  253. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +37 -4
  254. package/dist/utility/wrun/wrun-overlay-recovery.util.js +26 -14
  255. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +6 -1
  256. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  257. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +247 -26
  258. package/dist/utility/wrun/wrun-overlay-run.util.js +2234 -408
  259. package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
  260. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +11 -2
  261. package/dist/utility/wrun/wrun-panel-mount.util.js +122 -19
  262. package/dist/utility/wrun/wrun-panel-style.util.d.ts +4 -2
  263. package/dist/utility/wrun/wrun-panel-style.util.js +3 -2
  264. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +7 -0
  265. package/dist/utility/wrun/wrun-pin-spelling.util.js +18 -4
  266. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +26 -17
  267. package/dist/utility/wrun/wrun-pin-venues.util.js +43 -36
  268. package/dist/utility/wrun/wrun-pinned-lanes.util.d.ts +58 -0
  269. package/dist/utility/wrun/wrun-pinned-lanes.util.js +72 -0
  270. package/dist/utility/wrun/wrun-prefix-cohort.util.js +2 -1
  271. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +22 -9
  272. package/dist/utility/wrun/wrun-prefix-lanes.util.js +145 -26
  273. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +29 -0
  274. package/dist/utility/wrun/wrun-prefix-proof.util.js +23 -5
  275. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +9 -1
  276. package/dist/utility/wrun/wrun-refusal-surface.util.js +15 -1
  277. package/dist/utility/wrun/wrun-refusal.util.d.ts +19 -1
  278. package/dist/utility/wrun/wrun-refusal.util.js +103 -16
  279. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +20 -6
  280. package/dist/utility/wrun/wrun-registry-errors.util.js +20 -6
  281. package/dist/utility/wrun/wrun-replay-rows.util.js +6 -10
  282. package/dist/utility/wrun/wrun-run-health.util.d.ts +95 -5
  283. package/dist/utility/wrun/wrun-run-health.util.js +209 -3
  284. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +2 -2
  285. package/dist/utility/wrun/wrun-run-interval-session.util.js +2 -2
  286. package/dist/utility/wrun/wrun-run-interval.util.d.ts +9 -8
  287. package/dist/utility/wrun/wrun-run-interval.util.js +13 -11
  288. package/dist/utility/wrun/wrun-sandbox-row-source.js +5 -2
  289. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +38 -11
  290. package/dist/utility/wrun/wrun-script-inputs.util.js +194 -56
  291. package/dist/utility/wrun/wrun-session-composition.util.d.ts +81 -0
  292. package/dist/utility/wrun/wrun-session-composition.util.js +169 -0
  293. package/dist/utility/wrun/wrun-setting-words.util.d.ts +10 -7
  294. package/dist/utility/wrun/wrun-setting-words.util.js +25 -7
  295. package/dist/utility/wrun/wrun-source-rows.util.d.ts +94 -28
  296. package/dist/utility/wrun/wrun-source-rows.util.js +738 -93
  297. package/dist/utility/wrun/wrun-stream-clock.util.d.ts +45 -0
  298. package/dist/utility/wrun/wrun-stream-clock.util.js +108 -0
  299. package/dist/utility/wrun/wrun-style-names.util.d.ts +23 -0
  300. package/dist/utility/wrun/wrun-style-names.util.js +74 -0
  301. package/dist/utility/wrun/wrun-tape-coins.util.d.ts +116 -0
  302. package/dist/utility/wrun/wrun-tape-coins.util.js +110 -0
  303. package/dist/utility/wrun/wrun-tape-source.util.d.ts +62 -32
  304. package/dist/utility/wrun/wrun-tape-source.util.js +72 -34
  305. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +13 -5
  306. package/dist/utility/wrun/wrun-tier-grid.util.js +23 -13
  307. package/dist/utility/wrun/wrun-tpo-rows.util.js +2 -1
  308. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +73 -0
  309. package/dist/utility/wrun/wrun-trades-lane.util.js +82 -0
  310. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +5 -0
  311. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +9 -2
  312. package/dist/utility/wrun/wrun-visibility-table.d.ts +13 -0
  313. package/dist/utility/wrun/wrun-visibility-table.js +9 -0
  314. package/dist/utility/wrun/wrun-volume-profile.util.js +7 -3
  315. package/dist/utils/replay/replay-buffer-math.d.ts +16 -6
  316. package/dist/utils/replay/replay-buffer-math.js +60 -30
  317. package/dist/workers/constants/socket-slots.d.ts +11 -7
  318. package/dist/workers/constants/socket-slots.js +6 -5
  319. package/package.json +5 -5
@@ -63,6 +63,7 @@
63
63
  * only (the directory read goes through the markets service); the hosted lanes
64
64
  * carry the numbers to the worker inside `wrunHostFill`.
65
65
  */
66
+ import { serverNowS } from '../auth/server-clock.util.js';
66
67
  import { AssetClass, Category, Exchange } from '@orangecharts/orange-v2-pb-common';
67
68
  import { wrunChartHostEnv } from '../../host-env.js';
68
69
  import { isCmeGoverned } from '../chart/cme-realtime.util.js';
@@ -72,11 +73,13 @@ import { checkIsEconomic, getMarketKind } from '../chart/marketKind.util.js';
72
73
  import { optionsMarketUnderlyingVenue, optionVenueForExchange } from '../options/option-venue.util.js';
73
74
  import { isPlainOptionContract } from '../options/option-trade-units.util.js';
74
75
  import { isOpraGoverned } from '../v2/opra-governed.util.js';
75
- import { WRUN_LANE_CURRENCY_AUTO, WRUN_MARKET_FACT_FILLS, WRUN_MARKET_KINDS, WRUN_MARKET_QUOTE_IS_USD, WRUN_MARKET_SESSION_OPEN_CME, WRUN_MARKET_SESSION_OPEN_FOREX, wrunLaneCurrency, wrunMarketSizeUnit, wrunMarketZoneCode, wrunCoinLegSource, wrunFollowsCoin, wrunRowVisibleHere, wrunVisibleByNeedsKind, } from './wrun-market-facts.util.js';
76
+ import { WRUN_LANE_CURRENCY_AUTO, WRUN_MARKET_FACT_FILLS, WRUN_MARKET_KINDS, WRUN_MARKET_QUOTE_IS_USD, WRUN_MARKET_SESSION_OPEN_CME, WRUN_MARKET_SESSION_OPEN_FOREX, wrunLaneCurrency, wrunMarketSizeUnit, wrunMarketZoneCode, wrunCoinLegSource, wrunFollowsCoin, wrunRowVisibleHere, wrunVisibleByNeedsKind, wrunVisibleBySettingKeys, } from './wrun-market-facts.util.js';
77
+ import { wrunParamValuesFromSettings } from './wrun-param-values.util.js';
76
78
  import { isWrunLegStreamClass } from './wrun-leg-stream-classes.js';
77
79
  import { isTradesDollarQuoteAsset } from '../../kscript-data/controls/live-trades-merge.util.js';
78
80
  import { getExchangeFromSymbol } from '../../helpers/data.helpers.js';
79
81
  import { bindWrunDollarUnitReader } from './wrun-dollar-unit-port.leaf.js';
82
+ import { CME_ROOT_SPECS, wrunCmeRootDollarPointValue } from './wrun-cme-root-specs.util.js';
80
83
  // ---------------------------------------------------------------------------
81
84
  // om's venue tables, mirrored (each names its om source): the chart must
82
85
  // answer every market om knows the way om does.
@@ -180,57 +183,8 @@ const ASSET_CLASS_KINDS = {
180
183
  const COMMODITY_ASSET_CLASS = 'ASSET_CLASS_COMMODITY';
181
184
  /** Venues that list contracts whose multipliers the chart does not hold. */
182
185
  const UNKNOWN_MULTIPLIER_EXCHANGES = new Set(['ICE', 'PLATTS']);
183
- /** Read-only outside this module: the paper venue reads each contract's point value from it. */
184
- export const CME_ROOT_SPECS = {
185
- // Equity index futures, quoted in index points: the dollar multiplier.
186
- ES: { kind: 'index', pointValue: 50, quote: 'usd', exchange: 'CME' }, // $50 x S&P 500: equities/sp/e-mini-sandp500
187
- MES: { kind: 'index', pointValue: 5, quote: 'usd', exchange: 'CME' }, // $5 x S&P 500: equities/sp/micro-e-mini-sandp-500
188
- NQ: { kind: 'index', pointValue: 20, quote: 'usd', exchange: 'CME' }, // $20 x Nasdaq-100: equities/nasdaq/e-mini-nasdaq-100
189
- MNQ: { kind: 'index', pointValue: 2, quote: 'usd', exchange: 'CME' }, // $2 x Nasdaq-100: equities/nasdaq/micro-e-mini-nasdaq-100
190
- RTY: { kind: 'index', pointValue: 50, quote: 'usd', exchange: 'CME' }, // $50 x Russell 2000: equities/russell/e-mini-russell-2000
191
- M2K: { kind: 'index', pointValue: 5, quote: 'usd', exchange: 'CME' }, // $5 x Russell 2000: equities/russell/micro-e-mini-russell-2000
192
- YM: { kind: 'index', pointValue: 5, quote: 'usd', exchange: 'CBOT' }, // $5 x DJIA: equities/dow-jones/e-mini-dow
193
- MYM: { kind: 'index', pointValue: 0.5, quote: 'usd', exchange: 'CBOT' }, // $0.50 x DJIA: equities/dow-jones/micro-e-mini-dow
194
- // FX futures, quoted in US dollars per unit of the foreign currency (6J per yen, 0.00xxxx).
195
- '6E': { kind: 'forex', pointValue: 125_000, quote: 'usd', exchange: 'CME' }, // 125,000 euro: fx/g10/euro-fx
196
- '6B': { kind: 'forex', pointValue: 62_500, quote: 'usd', exchange: 'CME' }, // 62,500 pounds: fx/g10/british-pound
197
- '6J': { kind: 'forex', pointValue: 12_500_000, quote: 'usd', exchange: 'CME' }, // 12,500,000 yen: fx/g10/japanese-yen
198
- '6C': { kind: 'forex', pointValue: 100_000, quote: 'usd', exchange: 'CME' }, // 100,000 CAD: fx/g10/canadian-dollar
199
- // US Treasury futures, quoted in points of par (100): the face value / 100 per point.
200
- ZT: { kind: 'unknown', pointValue: 2_000, quote: 'usd', exchange: 'CBOT' }, // $200,000 face: interest-rates/us-treasury/2-year-us-treasury-note
201
- ZF: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/5-year-us-treasury-note
202
- ZN: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/10-year-us-treasury-note
203
- TN: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/ultra-10-year-us-treasury-note
204
- ZB: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/30-year-us-treasury-bond
205
- UB: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/ultra-t-bond
206
- // Energy (NYMEX), quoted in US dollars per unit of the commodity.
207
- CL: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'NYMEX' }, // 1,000 barrels: energy/crude-oil/light-sweet-crude
208
- MCL: { kind: 'unknown', pointValue: 100, quote: 'usd', exchange: 'NYMEX' }, // 100 barrels: energy/crude-oil/micro-wti-crude-oil
209
- NG: { kind: 'unknown', pointValue: 10_000, quote: 'usd', exchange: 'NYMEX' }, // 10,000 MMBtu: energy/natural-gas/natural-gas
210
- RB: { kind: 'unknown', pointValue: 42_000, quote: 'usd', exchange: 'NYMEX' }, // 42,000 gallons: energy/refined-products/rbob-gasoline
211
- HO: { kind: 'unknown', pointValue: 42_000, quote: 'usd', exchange: 'NYMEX' }, // 42,000 gallons: energy/refined-products/heating-oil
212
- BZ: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'NYMEX' }, // 1,000 barrels: energy/crude-oil/brent-crude-oil-last-day
213
- // Metals (COMEX), quoted in US dollars per troy ounce (copper per pound).
214
- GC: { kind: 'metal', pointValue: 100, quote: 'usd', exchange: 'COMEX' }, // 100 troy ounces: metals/precious/gold
215
- MGC: { kind: 'metal', pointValue: 10, quote: 'usd', exchange: 'COMEX' }, // 10 troy ounces: metals/precious/e-micro-gold
216
- SI: { kind: 'metal', pointValue: 5_000, quote: 'usd', exchange: 'COMEX' }, // 5,000 troy ounces: metals/precious/silver
217
- SIL: { kind: 'metal', pointValue: 1_000, quote: 'usd', exchange: 'COMEX' }, // 1,000 troy ounces: metals/precious/1000-oz-silver
218
- HG: { kind: 'metal', pointValue: 25_000, quote: 'usd', exchange: 'COMEX' }, // 25,000 pounds: metals/base/copper
219
- MHG: { kind: 'metal', pointValue: 2_500, quote: 'usd', exchange: 'COMEX' }, // 2,500 pounds: metals/base/micro-copper
220
- // Grains (CBOT), quoted in US cents per bushel (soybean oil per pound), the unit the chart
221
- // draws (corn near 460): a whole point is one cent, worth the contract size in cents, and
222
- // the quote is US cents, not dollars (Pine reads `syminfo.currency` "USX" there).
223
- ZC: { kind: 'unknown', pointValue: 5_000, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels: agriculture/grains/corn
224
- ZW: { kind: 'unknown', pointValue: 5_000, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels: agriculture/grains/wheat
225
- KE: { kind: 'unknown', pointValue: 5_000, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels: agriculture/grains/kc-wheat
226
- ZS: { kind: 'unknown', pointValue: 5_000, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels: agriculture/oilseeds/soybean
227
- ZL: { kind: 'unknown', pointValue: 60_000, quote: 'other', exchange: 'CBOT' }, // 60,000 pounds: agriculture/oilseeds/soybean-oil
228
- // Cryptocurrency futures (CME), quoted in US dollars per coin.
229
- BTC: { kind: 'crypto', pointValue: 5, quote: 'usd', exchange: 'CME' }, // 5 bitcoin: cryptocurrencies/bitcoin/bitcoin
230
- MBT: { kind: 'crypto', pointValue: 0.1, quote: 'usd', exchange: 'CME' }, // 0.1 bitcoin: cryptocurrencies/bitcoin/micro-bitcoin
231
- ETH: { kind: 'crypto', pointValue: 50, quote: 'usd', exchange: 'CME' }, // 50 ether: cryptocurrencies/ether/ether
232
- MET: { kind: 'crypto', pointValue: 0.1, quote: 'usd', exchange: 'CME' }, // 0.1 ether: cryptocurrencies/ether/micro-ether
233
- };
186
+ // The CME roots the chart serves (CME_ROOT_SPECS) live in wrun-cme-root-specs.util, re-exported for every reader here.
187
+ export { CME_ROOT_SPECS } from './wrun-cme-root-specs.util.js';
234
188
  /** The CME Group exchange a futures root lists on (`CME_ROOT_SPECS`), or undefined for a root off the table. */
235
189
  export function wrunCmeRootExchange(root) {
236
190
  const key = root.trim().toUpperCase();
@@ -387,12 +341,11 @@ function isCryptoChartVenue(venue) {
387
341
  return false;
388
342
  return !TRADFI_EXCHANGES.has(venue) && CRYPTO_CHART_KINDS.has(getMarketKind(venue));
389
343
  }
390
- /** The CME root spec of the chart's options chain: the chart's own contract's root (`ES1!`, `ESZ6`), or an option
391
- * contract's underlying future's (`ESZ6 C6000`: the chain lists under its future); undefined off the table. */
392
- function cmeChainRootSpec(market) {
344
+ /** The CME root of the chart's options chain: the chart's own contract's root (`ES1!`, `ESZ6`), or an option
345
+ * contract's underlying future's (`ESZ6 C6000`: the chain lists under its future); null when none parses. */
346
+ function cmeChainRoot(market) {
393
347
  const [contract] = typeof market.symbol === 'string' ? market.symbol.trim().split(/\s+/) : [];
394
- const root = governedContractCoin(contract);
395
- return root === null ? undefined : CME_ROOT_SPECS[root.toUpperCase()];
348
+ return governedContractCoin(contract);
396
349
  }
397
350
  /**
398
351
  * `market.option_multiplier()` of the chart market `market` (kit 0.87.0): the US dollars one price unit times one
@@ -424,8 +377,7 @@ export function wrunChartOptionMultiplier(market) {
424
377
  if (market === undefined || venue === undefined)
425
378
  return 0;
426
379
  if (isCmeGoverned(venue)) {
427
- const spec = cmeChainRootSpec(market);
428
- return spec?.quote === 'usd' ? spec.pointValue : 0;
380
+ return wrunCmeRootDollarPointValue(cmeChainRoot(market)) ?? 0;
429
381
  }
430
382
  // The family of the chain the chart reads: the options seam's market's (a stock twin's US stock) when the host named
431
383
  // it, else the chart's own.
@@ -521,9 +473,16 @@ export function wrunMarketFactsNeedDirectory(metadata) {
521
473
  * (wrunVisibleByNeedsKind: it names some but not all of 0, 1 and 2): the sheet's lane demand on a
522
474
  * market (wrunSheetWithLaneDemand) then waits on the directory row, so a crypto venue's coin is
523
475
  * never read as unit 0 before the row answers. A list deciding on contracts alone (`[0, 1, 2]`,
524
- * `[3]`) needs only the point value and the zone and waits on nothing. */
476
+ * `[3]`) needs only the point value and the zone and waits on nothing. A setting key (C-COINS item
477
+ * 1) reads its select's default where the market hides the select's row, so a select only the kind
478
+ * shows decides the demand too. */
525
479
  export function wrunLaneDemandNeedsDirectory(sheet) {
526
- return Object.values(sheet?.inputSources ?? {}).some((source) => wrunVisibleByNeedsKind(source?.needed_by));
480
+ const sources = Object.values(sheet?.inputSources ?? {});
481
+ if (sources.some((source) => wrunVisibleByNeedsKind(source?.needed_by)))
482
+ return true;
483
+ const keyed = new Set(sources.flatMap((source) => wrunVisibleBySettingKeys(source?.needed_by).map((key) => key.name)));
484
+ return (keyed.size > 0 &&
485
+ (sheet?.params ?? []).some((param) => keyed.has(param.name) && wrunVisibleByNeedsKind(param.visible_by)));
527
486
  }
528
487
  /** The hidden params the kit generates for the directory facts (`market_<word>`). */
529
488
  const WRUN_DIRECTORY_MARKET_FACT_PARAM_NAMES = new Set([...WRUN_DIRECTORY_MARKET_FACTS].map((fill) => `market_${fill}`));
@@ -567,19 +526,55 @@ export function wrunSheetWithLaneCurrencies(sheet, sizeUnit) {
567
526
  }
568
527
  return resolved === undefined ? sheet : { ...sheet, inputSources: resolved };
569
528
  }
529
+ /**
530
+ * The value a setting key reads on a market of size unit `sizeUnit` (contract C-COINS item 1), the run's side of the
531
+ * dialog's `wrunRowsOnMarket`, read only to decide whether a row shows or an input is asked: the run value of the
532
+ * select it names (`wrunParamValuesFromSettings` over `settings`), or its declared default where the select's own row
533
+ * is hidden on the market (its `visible_by` size-unit list alone: a select a key names is keyed by the size unit only),
534
+ * so a stock or CME chart that saved Coins decides as Dollars. init() and the paint still read the saved value.
535
+ * Undefined for a name the sheet declares no param under (the key then never hides).
536
+ */
537
+ export function wrunSheetSettingReader(sheet, settings, sizeUnit) {
538
+ return (name) => {
539
+ const param = (sheet.params ?? []).find((candidate) => candidate.name === name);
540
+ if (param === undefined)
541
+ return undefined;
542
+ const read = wrunRowVisibleHere(param.visible_by, sizeUnit) ? settings : undefined;
543
+ return wrunParamValuesFromSettings({ params: [param] }, read)[name];
544
+ };
545
+ }
546
+ /** `sheet` with the inputs the sheet a session ran on its market left unasked (`ran`, the live context's) marked
547
+ * `undemanded` again, by name: a paint-only save swaps the session's sheet for the overlay's own sheet repainted, and
548
+ * without the marks the session's ticks would ask and fill a lane its run never asked (0.9.0's dollar tape on CME).
549
+ * The sheet itself when `ran` marks none it lacks. */
550
+ export function wrunSheetKeepingRunMarksOf(sheet, ran) {
551
+ const unasked = Object.entries(ran?.inputSources ?? {})
552
+ .filter(([name, source]) => source?.undemanded === true && sheet.inputSources?.[name] !== undefined)
553
+ .map(([name]) => name)
554
+ .filter((name) => sheet.inputSources[name].undemanded !== true);
555
+ if (unasked.length === 0)
556
+ return sheet;
557
+ const inputSources = { ...sheet.inputSources };
558
+ for (const name of unasked)
559
+ inputSources[name] = { ...inputSources[name], undemanded: true };
560
+ return { ...sheet, inputSources };
561
+ }
570
562
  /**
571
563
  * The sheet a run plans its lanes from on a market of size unit `sizeUnit`: every input source whose
572
564
  * `needed_by` (kit 0.72.0) leaves that size unit out, read by the predicate a row's `visible_by` is
573
565
  * (wrunRowVisibleHere), is marked `undemanded`, so no reader past this seam asks, subscribes, folds
574
566
  * or re-asks its lane (wrunSourceLane answers none for it), and the row builder reads the input's
575
- * fill on every bar (NaN, 0 under `missing: "zero"`) without ever holding the run. An input without
576
- * the word is needed on every market. The sheet itself when every input is needed here; else a copy
577
- * with its own `inputSources`.
567
+ * fill on every bar (NaN, 0 under `missing: "zero"`) without ever holding the run. A setting key
568
+ * beside the size unit (contract C-COINS item 1) must list the value its select reads under
569
+ * `settings` (wrunSheetSettingReader: its default without settings, or where the market hides the
570
+ * select's own row). An input without the word is needed on every market. The sheet itself when
571
+ * every input is needed here; else a copy with its own `inputSources`.
578
572
  */
579
- export function wrunSheetWithLaneDemand(sheet, sizeUnit) {
573
+ export function wrunSheetWithLaneDemand(sheet, sizeUnit, settings) {
574
+ const read = wrunSheetSettingReader(sheet, settings, sizeUnit);
580
575
  let marked;
581
576
  for (const [name, source] of Object.entries(sheet.inputSources ?? {})) {
582
- if (source === undefined || wrunRowVisibleHere(source.needed_by, sizeUnit))
577
+ if (source === undefined || wrunRowVisibleHere(source.needed_by, sizeUnit, read))
583
578
  continue;
584
579
  marked ??= { ...sheet.inputSources };
585
580
  marked[name] = { ...source, undemanded: true };
@@ -682,22 +677,71 @@ export function wrunHostedLaneFills(market) {
682
677
  return { kind: facts.kind, point_value: facts.pointValue, zone: facts.zone };
683
678
  }
684
679
  // ---------------------------------------------------------------------------
680
+ // The market reads' memo: every read below rests the same way, so one forget reaches each of them
681
+ // ---------------------------------------------------------------------------
682
+ /** The chart's own reruns ask a failed read at most once in this window. */
683
+ const MARKET_READ_REST_MS = 60_000;
684
+ /** Every memo registers here: a rest kept outside this list is one a person's Retry could never end. */
685
+ const marketReadMemos = [];
686
+ let marketReadFailures = 0;
687
+ function marketReadMemo() {
688
+ const memo = { settled: new Map(), pending: new Map(), resting: new Map() };
689
+ marketReadMemos.push(memo);
690
+ return memo;
691
+ }
692
+ function restOf(memo, key) {
693
+ const rest = memo.resting.get(key);
694
+ return rest !== undefined && Date.now() < rest.until ? rest : undefined;
695
+ }
696
+ /** A resting read counts as settled: a caller that waits on the facts never waits on a read the rest holds back. */
697
+ function marketReadSettled(memo, key) {
698
+ return memo.settled.has(key) || restOf(memo, key) !== undefined;
699
+ }
700
+ /** One read per market for the session, shared by concurrent callers; a failure rests (never rejects), so an
701
+ * automatic wave cannot ask a failing read on every run. */
702
+ function warmMarketRead(memo, key, read, failureOf = () => 'read-failed') {
703
+ if (marketReadSettled(memo, key))
704
+ return Promise.resolve();
705
+ let pending = memo.pending.get(key);
706
+ if (pending === undefined) {
707
+ pending = read()
708
+ .then((answer) => {
709
+ memo.settled.set(key, answer);
710
+ memo.resting.delete(key);
711
+ }, (error) => {
712
+ marketReadFailures += 1;
713
+ const failure = failureOf(error);
714
+ memo.resting.set(key, { until: Date.now() + MARKET_READ_REST_MS, failure, serial: marketReadFailures });
715
+ })
716
+ .finally(() => memo.pending.delete(key));
717
+ memo.pending.set(key, pending);
718
+ }
719
+ return pending;
720
+ }
721
+ /** A person's own rerun ends every rest of the market's failed reads, or the Retry a refusal offers would read
722
+ * nothing for a minute; a definite answer and a read in flight stay. */
723
+ export function forgetWrunMarketReadFailures(market) {
724
+ const parts = marketKeyParts(market);
725
+ if (parts === undefined)
726
+ return;
727
+ const key = directoryKey(parts.venue, parts.symbol);
728
+ for (const memo of marketReadMemos)
729
+ memo.resting.delete(key);
730
+ }
731
+ /** A run head's mark: its own re-asks (wrun-overlay-run.util) reach only reads that failed after it. */
732
+ export function wrunMarketReadMark() {
733
+ return marketReadFailures;
734
+ }
735
+ // ---------------------------------------------------------------------------
685
736
  // The directory read (main thread): om's rules for when and how
686
737
  // ---------------------------------------------------------------------------
687
738
  /** Rows one directory search reads per page, and the pages it reads before
688
739
  * it gives up on a definite answer (om's MARKET_FACTS_* budget). */
689
740
  const DIRECTORY_PAGE_SIZE = 50;
690
741
  const DIRECTORY_MAX_PAGES = 4;
691
- /** How long a market whose search failed answers without its row before a
692
- * run asks the directory again. */
693
- const DIRECTORY_RETRY_MS = 60_000;
694
742
  const DIRECTORY_TIMEOUT_MS = 15_000;
695
- /** Definite answers by market for the session: the row, or null (not listed). */
696
- const settledRows = new Map();
697
- /** Searches in flight by market: concurrent runs on one market share one. */
698
- const pendingRows = new Map();
699
- /** When a market whose search failed may be asked again (epoch ms). */
700
- const retryAfter = new Map();
743
+ /** The directory's definite answers by market: the row, or null (not listed). */
744
+ const directoryRows = marketReadMemo();
701
745
  function directoryKey(venue, symbol) {
702
746
  return `${venue}\u0000${symbol.trim().toUpperCase()}`;
703
747
  }
@@ -755,7 +799,7 @@ function marketKeyParts(market) {
755
799
  /**
756
800
  * Ask the directory for `market`'s row (om's read): once per market for the
757
801
  * session, a definite answer (the row, or not listed) kept; concurrent callers
758
- * share one search; a failure is asked again a minute later and meanwhile the
802
+ * share one search; a failure rests a minute (`warmMarketRead`) and meanwhile the
759
803
  * facts read as the chart knows them without the row. Never rejects. A venue
760
804
  * whose listings om never reads asks nothing.
761
805
  */
@@ -763,25 +807,7 @@ export function warmWrunMarketFacts(market) {
763
807
  const parts = marketKeyParts(market);
764
808
  if (parts === undefined || !directoryAnswers(parts.venue))
765
809
  return Promise.resolve();
766
- const key = directoryKey(parts.venue, parts.symbol);
767
- if (settledRows.has(key))
768
- return Promise.resolve();
769
- if (Date.now() < (retryAfter.get(key) ?? 0))
770
- return Promise.resolve();
771
- let search = pendingRows.get(key);
772
- if (search === undefined) {
773
- search = findDirectoryRow(parts.venue, parts.symbol)
774
- .then((row) => {
775
- settledRows.set(key, row);
776
- retryAfter.delete(key);
777
- })
778
- .catch(() => {
779
- retryAfter.set(key, Date.now() + DIRECTORY_RETRY_MS);
780
- })
781
- .finally(() => pendingRows.delete(key));
782
- pendingRows.set(key, search);
783
- }
784
- return search;
810
+ return warmMarketRead(directoryRows, directoryKey(parts.venue, parts.symbol), () => findDirectoryRow(parts.venue, parts.symbol));
785
811
  }
786
812
  /** True when a read of `market`'s facts now would wait on nothing: the
787
813
  * directory answered, failed recently, or is never asked for its venue. */
@@ -789,8 +815,7 @@ export function wrunMarketFactsSettled(market) {
789
815
  const parts = marketKeyParts(market);
790
816
  if (parts === undefined || !directoryAnswers(parts.venue))
791
817
  return true;
792
- const key = directoryKey(parts.venue, parts.symbol);
793
- return settledRows.has(key) || Date.now() < (retryAfter.get(key) ?? 0);
818
+ return marketReadSettled(directoryRows, directoryKey(parts.venue, parts.symbol));
794
819
  }
795
820
  /** The facts the chart fills for `market` now (synchronous): the five over the
796
821
  * directory row once warmWrunMarketFacts settled it, else without one, the
@@ -802,7 +827,7 @@ export function wrunMarketFactsSettled(market) {
802
827
  * written on every market, 0 included, so the block keeps one shape. */
803
828
  export function wrunMarketFactsFor(market) {
804
829
  const parts = marketKeyParts(market);
805
- const row = parts === undefined ? undefined : settledRows.get(directoryKey(parts.venue, parts.symbol));
830
+ const row = parts === undefined ? undefined : directoryRows.settled.get(directoryKey(parts.venue, parts.symbol));
806
831
  const dollars = wrunMarketDollarUnit(market);
807
832
  return {
808
833
  ...wrunChartMarketFacts(market, row ?? undefined),
@@ -829,19 +854,14 @@ export function wrunMarketTradeUnitsOf(record) {
829
854
  function isRecordLike(value) {
830
855
  return value !== null && typeof value === 'object' && !Array.isArray(value);
831
856
  }
832
- /** The registry's units by market (the chart market's `venue\0SYMBOL`) for the session: a record's units, or null
833
- * for a market the registry holds no record of (or a host that reads none). */
834
- const settledUnits = new Map();
835
- /** Registry reads in flight by market. */
836
- const pendingUnits = new Map();
837
- /** When a market whose read failed (or whose continuous lead was not known yet) may be asked again (epoch ms). */
838
- const unitsRetryAfter = new Map();
839
- /** A read that cannot settle yet: retried after the window (a failed read, a continuous chart's lead not known). */
840
- class TradeUnitsUnsettled extends Error {
857
+ /** The registry's units by market for the session: a record's units, or null for a market it holds no record of. */
858
+ const tradeUnits = marketReadMemo();
859
+ /** A continuous chart whose lead is not known yet rests as `contract-unknown`, never as a failed read. */
860
+ class LeadContractUnknown extends Error {
841
861
  }
842
862
  /** The instrument a market's prints are of: the chart's own symbol, or a continuous CME chart's lead contract (the
843
863
  * chart's stamp, else the continuous contracts service's answer). Throws when a continuous chart's lead is not known
844
- * yet (retried). */
864
+ * yet (the read rests as `contract-unknown`). */
845
865
  async function wrunTradeUnitsInstrument(venue, symbol, resolvedContract) {
846
866
  if (!isCmeFamily(venue) || !isContinuousSymbol(symbol))
847
867
  return symbol;
@@ -851,55 +871,37 @@ async function wrunTradeUnitsInstrument(venue, symbol, resolvedContract) {
851
871
  const { default: contracts } = await wrunChartHostEnv().market.loadContinuousContracts();
852
872
  const lead = await contracts.getResolvedLead(venue, symbol);
853
873
  if (lead === null || typeof lead.symbol !== 'string' || lead.symbol === '') {
854
- throw new TradeUnitsUnsettled(`${venue}:${symbol}`);
874
+ throw new LeadContractUnknown(`${venue}:${symbol}`);
855
875
  }
856
876
  return lead.symbol;
857
877
  }
858
878
  /**
859
879
  * Ask the instrument registry for `market`'s trade units: once per market for the session, a definite answer (the
860
880
  * record's units, or none) kept; concurrent callers share one read; a failed read, or a continuous chart whose lead is
861
- * not known yet, is asked again a minute later. A host whose metadata service reads no registry record
862
- * (`getSymbolMetadata` unbound) settles none. Never rejects. The read is fresh (`{ fresh: true }`, as the option units
863
- * read is): a cached record can predate the registry's point value fill.
881
+ * not known yet, rests a minute (`warmMarketRead`, ended by a person's rerun). A host whose metadata service reads no
882
+ * registry record (`getSymbolMetadata` unbound) settles none. Never rejects. The read is fresh (`{ fresh: true }`, as
883
+ * the option units read is): a cached record can predate the registry's point value fill.
864
884
  */
865
885
  export function warmWrunMarketTradeUnits(market) {
866
886
  const parts = marketKeyParts(market);
867
887
  if (parts === undefined)
868
888
  return Promise.resolve();
869
- const key = directoryKey(parts.venue, parts.symbol);
870
- if (settledUnits.has(key))
871
- return Promise.resolve();
872
- if (Date.now() < (unitsRetryAfter.get(key) ?? 0))
873
- return Promise.resolve();
874
- let read = pendingUnits.get(key);
875
- if (read === undefined) {
876
- read = (async () => {
877
- const instrument = await wrunTradeUnitsInstrument(parts.venue, parts.symbol, market?.resolvedContract);
878
- const { default: metadataService } = await wrunChartHostEnv().market.loadMetadataService();
879
- if (typeof metadataService.getSymbolMetadata !== 'function')
880
- return null;
881
- return wrunMarketTradeUnitsOf(await metadataService.getSymbolMetadata(parts.venue, instrument, { fresh: true }));
882
- })()
883
- .then((units) => {
884
- settledUnits.set(key, units);
885
- unitsRetryAfter.delete(key);
886
- })
887
- .catch(() => {
888
- unitsRetryAfter.set(key, Date.now() + DIRECTORY_RETRY_MS);
889
- })
890
- .finally(() => pendingUnits.delete(key));
891
- pendingUnits.set(key, read);
892
- }
893
- return read;
889
+ return warmMarketRead(tradeUnits, directoryKey(parts.venue, parts.symbol), async () => {
890
+ const instrument = await wrunTradeUnitsInstrument(parts.venue, parts.symbol, market?.resolvedContract);
891
+ const { default: metadataService } = await wrunChartHostEnv().market.loadMetadataService();
892
+ if (typeof metadataService.getSymbolMetadata !== 'function')
893
+ return null;
894
+ return wrunMarketTradeUnitsOf(await metadataService.getSymbolMetadata(parts.venue, instrument, { fresh: true }));
895
+ }, (error) => (error instanceof LeadContractUnknown ? 'contract-unknown' : 'read-failed'));
894
896
  }
895
897
  /** The registry's units of `market` once a read settled them: the units, null for no record, undefined while the
896
- * registry can still answer (not asked yet, in flight, or a failed read that is retried). Synchronous. */
898
+ * registry can still answer (not asked yet, in flight, or a failed read that rests). Synchronous. */
897
899
  export function wrunMarketTradeUnitsNow(market) {
898
900
  const parts = marketKeyParts(market);
899
901
  if (parts === undefined)
900
902
  return null;
901
903
  const key = directoryKey(parts.venue, parts.symbol);
902
- return settledUnits.has(key) ? (settledUnits.get(key) ?? null) : undefined;
904
+ return tradeUnits.settled.has(key) ? (tradeUnits.settled.get(key) ?? null) : undefined;
903
905
  }
904
906
  /** Warm everything a market's dollar unit and stored unit read (C-DOLLAR): the directory row (a crypto market's quote)
905
907
  * and the instrument registry's units. Never rejects. */
@@ -914,8 +916,21 @@ export function wrunMarketDollarFactsSettled(market) {
914
916
  const parts = marketKeyParts(market);
915
917
  if (parts === undefined)
916
918
  return true;
919
+ return marketReadSettled(tradeUnits, directoryKey(parts.venue, parts.symbol));
920
+ }
921
+ /** The rest the dollar unit's reads wait out now (the registry's units first, then the directory row). */
922
+ function dollarReadRest(market) {
923
+ const parts = marketKeyParts(market);
924
+ if (parts === undefined)
925
+ return undefined;
917
926
  const key = directoryKey(parts.venue, parts.symbol);
918
- return settledUnits.has(key) || Date.now() < (unitsRetryAfter.get(key) ?? 0);
927
+ return restOf(tradeUnits, key) ?? restOf(directoryRows, key);
928
+ }
929
+ /** The refusal words tell a failed read from a lead contract not known yet; `failedAfter` (a `wrunMarketReadMark`)
930
+ * keeps a run head from asking again a rest an earlier run left. */
931
+ export function wrunMarketDollarReadFailure(market, failedAfter = Number.NEGATIVE_INFINITY) {
932
+ const rest = dollarReadRest(market);
933
+ return rest !== undefined && rest.serial > failedAfter ? rest.failure : undefined;
919
934
  }
920
935
  /** The quote asset a crypto venue's raw symbol spells after its separator (`BTC_USDT`, `BTC-USDT-SWAP`): positive
921
936
  * evidence only (a tail that is no dollar asset, `BTC-PERPETUAL`, proves nothing). */
@@ -975,7 +990,7 @@ export function wrunMarketDollarUnit(market) {
975
990
  ? { kind: 'dollars', unit: units.pointValue }
976
991
  : { kind: 'unproven', reason: 'point-value', transient: false };
977
992
  }
978
- const row = settledRows.get(key) ?? undefined;
993
+ const row = directoryRows.settled.get(key) ?? undefined;
979
994
  const { pointValue } = wrunChartMarketFacts(market, row);
980
995
  if (!(Number.isFinite(pointValue) && pointValue > 0)) {
981
996
  return { kind: 'unproven', reason: 'point-value', transient: false };
@@ -984,22 +999,21 @@ export function wrunMarketDollarUnit(market) {
984
999
  if (dollars === true)
985
1000
  return { kind: 'dollars', unit: pointValue };
986
1001
  // Unknown while a read can still answer the quote (the registry record or the directory row: not asked yet, or a
987
- // failed read that is retried); a quote an answer or the market's own spelling names is no dollar quote for good.
988
- const answered = units !== undefined && (!directoryAnswers(parts.venue) || settledRows.has(key));
1002
+ // failed read that rests); a quote an answer or the market's own spelling names is no dollar quote for good.
1003
+ const answered = units !== undefined && (!directoryAnswers(parts.venue) || directoryRows.settled.has(key));
989
1004
  return { kind: 'unproven', reason: 'quote', transient: dollars === undefined && !answered };
990
1005
  }
991
1006
  /** The writer's dollars per stored unit by market for the session: a number, or null for a market with no large print
992
1007
  * in any window (or a host that reads no series). */
993
- const settledStoredUnits = new Map();
994
- /** Stored unit reads in flight by market. */
995
- const pendingStoredUnits = new Map();
996
- /** When a market whose stored unit read failed may be asked again (epoch ms). */
997
- const storedUnitsRetryAfter = new Map();
998
- /** How far back the newest large print is looked for: the large table's own retention (a week). The read asks one
999
- * row, newest first, so a busy market answers one print, not a week of them (measured 2026-10-22: one row on
1008
+ const storedUnitDollars = marketReadMemo();
1009
+ /** How far back the newest large print is looked for: the large table's own retention (a week). Each read asks one
1010
+ * row, newest first, so a busy market answers a print a read, not a week of them (measured 2026-10-22: one row on
1000
1011
  * BINANCE_FUTURES BTCUSDT, gate.io futures BTC_USDT and CME ESZ6 and ES1!). */
1001
1012
  const STORED_UNIT_WINDOW_SEC = 7 * 86_400;
1002
1013
  const STORED_UNIT_TIMEOUT_MS = 20_000;
1014
+ /** The reads that find the newest large print: tsdb-gateway orders a raw read by side before time (UNKNOWN, SELL,
1015
+ * BUY), so an unfiltered read's one row is the lowest side's newest, and each taker side is asked for its own. */
1016
+ const STORED_UNIT_SIDES = [undefined, 'BUY', 'SELL'];
1003
1017
  /**
1004
1018
  * The large-print writer's dollars per STORED unit off a TRADE_LARGE answer (decoded series frames, the TRADES
1005
1019
  * columns): `quoteAmount / amount` of the newest row whose both are finite and above zero, undefined when no row is.
@@ -1032,51 +1046,39 @@ export function wrunStoredUnitDollarsOfRows(frames) {
1032
1046
  }
1033
1047
  /**
1034
1048
  * Read what one STORED unit of `market` is worth in dollars off the large-print writer's own rows: the market's newest
1035
- * TRADE_LARGE print (`wrunStoredUnitDollarsOfRows`), through the host's series read on the K_TRADES history's own wire
1036
- * (the chart's market, its wire venue as the K_TRADES worker spells it; TRADE_LARGE is a v2-only read, never the /v3
1037
- * catalog, whose crypto rows carry no unit): one row, newest first, over the table's week. Once per market for the
1038
- * session; concurrent callers share one read; a failed read is asked again a minute later. A host whose v2 service
1039
- * reads no series (`sendSeriesOneShot` unbound) settles none. Never rejects. Only a run head with a raw floor to carry
1040
- * asks it (wrun-market-size-defaults.util).
1049
+ * TRADE_LARGE print (`wrunStoredUnitDollarsOfRows`, the newest row of every answer), through the host's series read on
1050
+ * the K_TRADES history's own wire (the chart's market, its wire venue as the K_TRADES worker spells it; TRADE_LARGE is
1051
+ * a v2-only read, never the /v3 catalog, whose crypto rows carry no unit): one row a side, newest first, over the
1052
+ * table's week (`STORED_UNIT_SIDES`: one row of a read whose limit binds is no newest by time, and on a linear market
1053
+ * an older print's ratio is an older price). Once per market for the session; concurrent callers share one read; a
1054
+ * failed read rests a minute (`warmMarketRead`). A host whose v2 service reads no series (`sendSeriesOneShot` unbound)
1055
+ * settles none. Never rejects. Only a run head with a raw floor to carry asks it (wrun-market-size-defaults.util).
1041
1056
  */
1042
1057
  export function warmWrunMarketStoredUnit(market) {
1043
1058
  const parts = marketKeyParts(market);
1044
1059
  if (parts === undefined)
1045
1060
  return Promise.resolve();
1046
- const key = directoryKey(parts.venue, parts.symbol);
1047
- if (settledStoredUnits.has(key))
1048
- return Promise.resolve();
1049
- if (Date.now() < (storedUnitsRetryAfter.get(key) ?? 0))
1050
- return Promise.resolve();
1051
- let read = pendingStoredUnits.get(key);
1052
- if (read === undefined) {
1053
- read = (async () => {
1054
- const { default: v2 } = await wrunChartHostEnv().transport.loadV2Service();
1055
- if (typeof v2.sendSeriesOneShot !== 'function')
1056
- return null;
1057
- const toUnixS = Math.floor(Date.now() / 1000);
1058
- const descriptor = {
1059
- domain: 'CRYPTO',
1060
- metric: 'TRADES',
1061
- ref: { exchange: getExchangeFromSymbol(parts.venue, parts.symbol), symbol: parts.symbol },
1062
- window: { fromUnixS: toUnixS - STORED_UNIT_WINDOW_SEC, toUnixS },
1063
- paging: { limit: 1, direction: 'DESC' },
1064
- v2Only: { type: 'TRADE_LARGE' },
1065
- };
1066
- const frames = await v2.sendSeriesOneShot(descriptor, { timeoutMs: STORED_UNIT_TIMEOUT_MS });
1067
- return wrunStoredUnitDollarsOfRows(frames) ?? null;
1068
- })()
1069
- .then((perUnit) => {
1070
- settledStoredUnits.set(key, perUnit);
1071
- storedUnitsRetryAfter.delete(key);
1072
- })
1073
- .catch(() => {
1074
- storedUnitsRetryAfter.set(key, Date.now() + DIRECTORY_RETRY_MS);
1075
- })
1076
- .finally(() => pendingStoredUnits.delete(key));
1077
- pendingStoredUnits.set(key, read);
1078
- }
1079
- return read;
1061
+ return warmMarketRead(storedUnitDollars, directoryKey(parts.venue, parts.symbol), async () => {
1062
+ const { default: v2 } = await wrunChartHostEnv().transport.loadV2Service();
1063
+ if (typeof v2.sendSeriesOneShot !== 'function')
1064
+ return null;
1065
+ // Bound once: the narrowing above does not reach the side reads' callback.
1066
+ const readSeries = v2.sendSeriesOneShot.bind(v2);
1067
+ const toUnixS = serverNowS();
1068
+ const descriptor = {
1069
+ domain: 'CRYPTO',
1070
+ metric: 'TRADES',
1071
+ ref: { exchange: getExchangeFromSymbol(parts.venue, parts.symbol), symbol: parts.symbol },
1072
+ window: { fromUnixS: toUnixS - STORED_UNIT_WINDOW_SEC, toUnixS },
1073
+ paging: { limit: 1, direction: 'DESC' },
1074
+ v2Only: { type: 'TRADE_LARGE' },
1075
+ };
1076
+ // Every side's answer or none: a side that failed may hold the newest print.
1077
+ const answers = await Promise.all(STORED_UNIT_SIDES.map((side) => readSeries((side === undefined ? descriptor : { ...descriptor, side }), {
1078
+ timeoutMs: STORED_UNIT_TIMEOUT_MS,
1079
+ })));
1080
+ return wrunStoredUnitDollarsOfRows(answers.flat()) ?? null;
1081
+ });
1080
1082
  }
1081
1083
  /**
1082
1084
  * The US dollars one unit of `market`'s STORED trade amount is worth (the large-print table's `amount`, the unit a
@@ -1093,24 +1095,22 @@ export function wrunMarketStoredUnitDollars(market) {
1093
1095
  return unit;
1094
1096
  const parts = marketKeyParts(market);
1095
1097
  const key = parts === undefined ? undefined : directoryKey(parts.venue, parts.symbol);
1096
- if (key === undefined || !settledStoredUnits.has(key))
1098
+ if (key === undefined || !storedUnitDollars.settled.has(key)) {
1097
1099
  return { kind: 'unproven', reason: 'rows', transient: true };
1098
- const perUnit = settledStoredUnits.get(key);
1100
+ }
1101
+ const perUnit = storedUnitDollars.settled.get(key);
1099
1102
  return perUnit === null || perUnit === undefined
1100
1103
  ? { kind: 'unproven', reason: 'rows', transient: false }
1101
1104
  : { kind: 'dollars', perUnit };
1102
1105
  }
1103
1106
  /** Forget every kept answer (spec isolation). */
1104
1107
  export function clearWrunMarketFactsMemo() {
1105
- settledRows.clear();
1106
- pendingRows.clear();
1107
- retryAfter.clear();
1108
- settledUnits.clear();
1109
- pendingUnits.clear();
1110
- unitsRetryAfter.clear();
1111
- settledStoredUnits.clear();
1112
- pendingStoredUnits.clear();
1113
- storedUnitsRetryAfter.clear();
1108
+ for (const memo of marketReadMemos) {
1109
+ memo.settled.clear();
1110
+ memo.pending.clear();
1111
+ memo.resting.clear();
1112
+ }
1113
+ marketReadFailures = 0;
1114
1114
  }
1115
1115
  // The live intake reads the dollar unit through its port (wrun-dollar-unit-port.leaf), so this module stays off the
1116
1116
  // pre-candle closure live-feed loads the intake in.
@@ -3,7 +3,7 @@
3
3
  * `<parent>::inset:<name>`, the price canvases of WRUN-STYLE g6
4
4
  * `<parent>::heatmap:<name>`, `<parent>::profile:<name>`, `<parent>::matrix:<name>`, and the
5
5
  * batched marks of WRUN-BATCHED-MARKS `<parent>::marks:<name>`, `<parent>::spans:<name>`,
6
- * `<parent>::rays:<name>`: one word per child kind the run result builds, checked against its
6
+ * `<parent>::rays:<name>`, `<parent>::flags:<name>`: one word per child kind the run result builds, checked against its
7
7
  * union, so a new child kind fails typecheck here until its id is one the store can read back.
8
8
  * A leaf module: the store reads it on every removal, so it imports nothing at run time. */
9
9
  const CHILD_KIND_WORDS = {
@@ -17,6 +17,7 @@ const CHILD_KIND_WORDS = {
17
17
  marks: true,
18
18
  spans: true,
19
19
  rays: true,
20
+ flags: true,
20
21
  };
21
22
  const CHILD_KINDS = `(?:${Object.keys(CHILD_KIND_WORDS).join('|')})`;
22
23
  const CHILD_ID_PATTERN = new RegExp(`^(.+)::${CHILD_KINDS}:`);
@@ -0,0 +1,15 @@
1
+ /** One delayed CME market a run read: the symbol the badge sentence names and its delay in whole minutes. */
2
+ export interface WrunCmeDelayedMarket {
3
+ symbol: string;
4
+ mins: number;
5
+ }
6
+ /**
7
+ * The delayed CME markets among `markets` (the run's admitted legs, in order, each once), off the chart's own exchange:
8
+ * a market whose exchange is the chart's rides the badge already. Undefined when none is delayed (a real-time or
9
+ * unknown served access names no delay: the account's tier is never guessed). The minutes are the served access's own
10
+ * figure, else the exchange's nominal delay.
11
+ */
12
+ export declare function wrunCmeDelayedMarkets(markets: Iterable<{
13
+ exchange?: unknown;
14
+ symbol?: unknown;
15
+ } | undefined>, chartExchange: unknown): WrunCmeDelayedMarket[] | undefined;