@orangecharts/wrun-chart-host 0.11.1 → 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 (307) 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 +17 -0
  16. package/dist/index.js +18 -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 +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/om-panel.util.d.ts +5 -3
  88. package/dist/utility/chart/om-panel.util.js +42 -7
  89. package/dist/utility/chart/om-target.util.d.ts +14 -1
  90. package/dist/utility/chart/om-target.util.js +22 -5
  91. package/dist/utility/chart/opra-read-access.leaf.d.ts +16 -1
  92. package/dist/utility/chart/opra-read-access.leaf.js +22 -0
  93. package/dist/utility/chart/profile-row-height.util.d.ts +49 -16
  94. package/dist/utility/chart/profile-row-height.util.js +74 -37
  95. package/dist/utility/chart/rth-session.util.d.ts +55 -20
  96. package/dist/utility/chart/rth-session.util.js +94 -46
  97. package/dist/utility/chart/session-lattice.util.d.ts +150 -0
  98. package/dist/utility/chart/session-lattice.util.js +488 -0
  99. package/dist/utility/chart/trading-day.util.d.ts +40 -2
  100. package/dist/utility/chart/trading-day.util.js +84 -7
  101. package/dist/utility/chart/us-equities-session.util.d.ts +32 -11
  102. package/dist/utility/chart/us-equities-session.util.js +44 -15
  103. package/dist/utility/chart/window-geometry.leaf.d.ts +28 -7
  104. package/dist/utility/chart/window-geometry.leaf.js +57 -8
  105. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +21 -14
  106. package/dist/utility/chart/wrun-bar-session-facts.util.js +32 -38
  107. package/dist/utility/chart/wrun-run-result.util.d.ts +29 -12
  108. package/dist/utility/chart/wrun-run-result.util.js +89 -25
  109. package/dist/utility/common/time.util.js +5 -4
  110. package/dist/utility/market-events/earnings-scope.util.d.ts +10 -5
  111. package/dist/utility/market-events/earnings-scope.util.js +17 -9
  112. package/dist/utility/market-events/market-events.util.d.ts +14 -7
  113. package/dist/utility/market-events/market-events.util.js +30 -17
  114. package/dist/utility/number-format.util.d.ts +14 -21
  115. package/dist/utility/number-format.util.js +38 -24
  116. package/dist/utility/options/option-venue-disclosure.util.d.ts +40 -6
  117. package/dist/utility/options/option-venue-disclosure.util.js +71 -11
  118. package/dist/utility/options/option-venue.util.d.ts +1 -1
  119. package/dist/utility/options/option-venue.util.js +1 -1
  120. package/dist/utility/pool-symbol.leaf.d.ts +7 -0
  121. package/dist/utility/pool-symbol.leaf.js +50 -5
  122. package/dist/utility/stocks/stock-display.util.d.ts +15 -0
  123. package/dist/utility/stocks/stock-display.util.js +37 -0
  124. package/dist/utility/symbol-selection/contract-expiry.util.js +5 -4
  125. package/dist/utility/v2/gate-plane.util.d.ts +6 -0
  126. package/dist/utility/v2/gate-plane.util.js +11 -1
  127. package/dist/utility/v2/gate-session-latch.util.d.ts +1 -1
  128. package/dist/utility/v2/gate-session-latch.util.js +3 -3
  129. package/dist/utility/v2/governed-tier.leaf.d.ts +17 -16
  130. package/dist/utility/v2/governed-tier.leaf.js +17 -16
  131. package/dist/utility/v2/stocks-governed.util.d.ts +5 -0
  132. package/dist/utility/v2/stocks-governed.util.js +14 -0
  133. package/dist/utility/v2/v2-enums.leaf.d.ts +13 -0
  134. package/dist/utility/v2/v2-enums.leaf.js +458 -0
  135. package/dist/utility/wrun/derived-roots.leaf.d.ts +21 -1
  136. package/dist/utility/wrun/derived-roots.leaf.js +27 -1
  137. package/dist/utility/wrun/derived-roots.util.d.ts +44 -32
  138. package/dist/utility/wrun/derived-roots.util.js +97 -56
  139. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -3
  140. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -3
  141. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +2 -1
  142. package/dist/utility/wrun/sources/lanes/option_daily.js +2 -1
  143. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +3 -0
  144. package/dist/utility/wrun/sources/lanes/options_flow.js +23 -5
  145. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -4
  146. package/dist/utility/wrun/sources/row-lane-registry.js +9 -4
  147. package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +19 -0
  148. package/dist/utility/wrun/sources/row-lanes/dark_pool.js +104 -0
  149. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  150. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.d.ts +20 -0
  151. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.js +103 -0
  152. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -2
  153. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +15 -13
  154. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +49 -23
  155. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +14 -9
  156. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +75 -27
  157. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +139 -82
  158. package/dist/utility/wrun/wrun-app-layer.leaf.d.ts +78 -0
  159. package/dist/utility/wrun/wrun-app-layer.leaf.js +89 -0
  160. package/dist/utility/wrun/wrun-bar-count.util.d.ts +11 -7
  161. package/dist/utility/wrun/wrun-bar-count.util.js +12 -8
  162. package/dist/utility/wrun/wrun-batched-kinds.leaf.d.ts +13 -0
  163. package/dist/utility/wrun/wrun-batched-kinds.leaf.js +18 -0
  164. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +41 -22
  165. package/dist/utility/wrun/wrun-batched-marks.util.js +255 -59
  166. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +26 -19
  167. package/dist/utility/wrun/wrun-batched-readout.util.js +81 -27
  168. package/dist/utility/wrun/wrun-book-bands.leaf.d.ts +8 -0
  169. package/dist/utility/wrun/wrun-book-bands.leaf.js +7 -0
  170. package/dist/utility/wrun/wrun-candle-equal.leaf.d.ts +19 -0
  171. package/dist/utility/wrun/wrun-candle-equal.leaf.js +40 -0
  172. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -2
  173. package/dist/utility/wrun/wrun-canvases.util.js +7 -3
  174. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +6 -3
  175. package/dist/utility/wrun/wrun-chart-context-names.util.js +8 -4
  176. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +47 -29
  177. package/dist/utility/wrun/wrun-chart-market-facts.util.js +201 -201
  178. package/dist/utility/wrun/wrun-child-overlay-id.util.js +2 -1
  179. package/dist/utility/wrun/wrun-cme-legs-note.util.d.ts +15 -0
  180. package/dist/utility/wrun/wrun-cme-legs-note.util.js +49 -0
  181. package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +38 -0
  182. package/dist/utility/wrun/wrun-cme-root-specs.util.js +81 -0
  183. package/dist/utility/wrun/wrun-coin-lane-live.util.js +3 -0
  184. package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -1
  185. package/dist/utility/wrun/wrun-color-settings.util.js +32 -7
  186. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +50 -0
  187. package/dist/utility/wrun/wrun-dark-pool.util.js +127 -0
  188. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +67 -12
  189. package/dist/utility/wrun/wrun-declared-warmup.util.js +165 -13
  190. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +18 -8
  191. package/dist/utility/wrun/wrun-draft-legend-note.util.js +57 -11
  192. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +14 -10
  193. package/dist/utility/wrun/wrun-draft-overlay.util.js +26 -14
  194. package/dist/utility/wrun/wrun-earnings-facts.util.js +3 -2
  195. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +2 -0
  196. package/dist/utility/wrun/wrun-etf-funds.util.js +4 -0
  197. package/dist/utility/wrun/wrun-held-lanes.util.js +8 -2
  198. package/dist/utility/wrun/wrun-history-as-of.util.d.ts +77 -0
  199. package/dist/utility/wrun/wrun-history-as-of.util.js +108 -0
  200. package/dist/utility/wrun/wrun-host.service.d.ts +64 -14
  201. package/dist/utility/wrun/wrun-host.service.js +137 -27
  202. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +3 -3
  203. package/dist/utility/wrun/wrun-hosted-wire-caps.js +12 -2
  204. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +13 -0
  205. package/dist/utility/wrun/wrun-inert-legend.util.js +31 -3
  206. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +7 -5
  207. package/dist/utility/wrun/wrun-input-requirements.leaf.js +16 -6
  208. package/dist/utility/wrun/wrun-install-pacer.util.d.ts +26 -0
  209. package/dist/utility/wrun/wrun-install-pacer.util.js +145 -0
  210. package/dist/utility/wrun/wrun-kit-refusal-stages.types.d.ts +22 -0
  211. package/dist/utility/wrun/wrun-kit-refusal-stages.types.js +1 -0
  212. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +12 -5
  213. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +23 -5
  214. package/dist/utility/wrun/wrun-lane-warmup.util.js +22 -4
  215. package/dist/utility/wrun/wrun-leg-close.util.d.ts +6 -5
  216. package/dist/utility/wrun/wrun-leg-close.util.js +11 -9
  217. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +3 -1
  218. package/dist/utility/wrun/wrun-leg-fetch.util.js +9 -2
  219. package/dist/utility/wrun/wrun-levels-child.util.d.ts +2 -0
  220. package/dist/utility/wrun/wrun-levels-child.util.js +6 -0
  221. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -0
  222. package/dist/utility/wrun/wrun-live-intake.util.d.ts +15 -6
  223. package/dist/utility/wrun/wrun-live-intake.util.js +167 -47
  224. package/dist/utility/wrun/wrun-live-tick.util.d.ts +52 -8
  225. package/dist/utility/wrun/wrun-live-tick.util.js +648 -97
  226. package/dist/utility/wrun/wrun-market-facts.util.d.ts +16 -2
  227. package/dist/utility/wrun/wrun-market-facts.util.js +32 -3
  228. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +27 -27
  229. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +28 -16
  230. package/dist/utility/wrun/wrun-market-size-defaults.util.js +34 -5
  231. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +10 -7
  232. package/dist/utility/wrun/wrun-oi-lane.util.js +16 -10
  233. package/dist/utility/wrun/wrun-option-strike-flow.util.js +1 -1
  234. package/dist/utility/wrun/wrun-option-views.util.d.ts +2 -2
  235. package/dist/utility/wrun/wrun-option-views.util.js +5 -2
  236. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.d.ts +5 -0
  237. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.js +16 -0
  238. package/dist/utility/wrun/wrun-options-stop.util.d.ts +3 -2
  239. package/dist/utility/wrun/wrun-options-stop.util.js +6 -4
  240. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +75 -11
  241. package/dist/utility/wrun/wrun-overlay-drivers.util.js +176 -43
  242. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +20 -10
  243. package/dist/utility/wrun/wrun-overlay-park.util.d.ts +84 -0
  244. package/dist/utility/wrun/wrun-overlay-park.util.js +135 -0
  245. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +37 -4
  246. package/dist/utility/wrun/wrun-overlay-recovery.util.js +26 -14
  247. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +239 -24
  248. package/dist/utility/wrun/wrun-overlay-run.util.js +2204 -405
  249. package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
  250. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +2 -1
  251. package/dist/utility/wrun/wrun-panel-mount.util.js +20 -14
  252. package/dist/utility/wrun/wrun-panel-style.util.d.ts +4 -2
  253. package/dist/utility/wrun/wrun-panel-style.util.js +3 -2
  254. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +7 -0
  255. package/dist/utility/wrun/wrun-pin-spelling.util.js +18 -4
  256. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +26 -17
  257. package/dist/utility/wrun/wrun-pin-venues.util.js +43 -36
  258. package/dist/utility/wrun/wrun-pinned-lanes.util.d.ts +58 -0
  259. package/dist/utility/wrun/wrun-pinned-lanes.util.js +72 -0
  260. package/dist/utility/wrun/wrun-prefix-cohort.util.js +2 -1
  261. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +22 -9
  262. package/dist/utility/wrun/wrun-prefix-lanes.util.js +145 -26
  263. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +29 -0
  264. package/dist/utility/wrun/wrun-prefix-proof.util.js +23 -5
  265. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +9 -1
  266. package/dist/utility/wrun/wrun-refusal-surface.util.js +15 -1
  267. package/dist/utility/wrun/wrun-refusal.util.d.ts +19 -1
  268. package/dist/utility/wrun/wrun-refusal.util.js +103 -16
  269. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +20 -6
  270. package/dist/utility/wrun/wrun-registry-errors.util.js +20 -6
  271. package/dist/utility/wrun/wrun-replay-rows.util.js +6 -10
  272. package/dist/utility/wrun/wrun-run-health.util.d.ts +89 -2
  273. package/dist/utility/wrun/wrun-run-health.util.js +204 -1
  274. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +2 -2
  275. package/dist/utility/wrun/wrun-run-interval-session.util.js +2 -2
  276. package/dist/utility/wrun/wrun-run-interval.util.d.ts +9 -8
  277. package/dist/utility/wrun/wrun-run-interval.util.js +13 -11
  278. package/dist/utility/wrun/wrun-sandbox-row-source.js +5 -2
  279. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +13 -3
  280. package/dist/utility/wrun/wrun-script-inputs.util.js +51 -13
  281. package/dist/utility/wrun/wrun-session-composition.util.d.ts +81 -0
  282. package/dist/utility/wrun/wrun-session-composition.util.js +169 -0
  283. package/dist/utility/wrun/wrun-setting-words.util.d.ts +10 -7
  284. package/dist/utility/wrun/wrun-setting-words.util.js +25 -7
  285. package/dist/utility/wrun/wrun-source-rows.util.d.ts +94 -28
  286. package/dist/utility/wrun/wrun-source-rows.util.js +738 -93
  287. package/dist/utility/wrun/wrun-stream-clock.util.d.ts +45 -0
  288. package/dist/utility/wrun/wrun-stream-clock.util.js +108 -0
  289. package/dist/utility/wrun/wrun-tape-coins.util.d.ts +116 -0
  290. package/dist/utility/wrun/wrun-tape-coins.util.js +110 -0
  291. package/dist/utility/wrun/wrun-tape-source.util.d.ts +62 -32
  292. package/dist/utility/wrun/wrun-tape-source.util.js +72 -34
  293. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +13 -5
  294. package/dist/utility/wrun/wrun-tier-grid.util.js +23 -13
  295. package/dist/utility/wrun/wrun-tpo-rows.util.js +2 -1
  296. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +73 -0
  297. package/dist/utility/wrun/wrun-trades-lane.util.js +82 -0
  298. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +5 -0
  299. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +9 -2
  300. package/dist/utility/wrun/wrun-visibility-table.d.ts +13 -0
  301. package/dist/utility/wrun/wrun-visibility-table.js +9 -0
  302. package/dist/utility/wrun/wrun-volume-profile.util.js +7 -3
  303. package/dist/utils/replay/replay-buffer-math.d.ts +16 -6
  304. package/dist/utils/replay/replay-buffer-math.js +60 -30
  305. package/dist/workers/constants/socket-slots.d.ts +11 -7
  306. package/dist/workers/constants/socket-slots.js +6 -5
  307. package/package.json +5 -5
@@ -11,8 +11,9 @@
11
11
  * width, a positive retention or none and a positive served lag or none, `assertWrunHostGridLanding`; a
12
12
  * `tierChoice` of `coarsest` only on a flow with tiers and a fold; `coarserWhenEmpty` only on a snapshot with
13
13
  * tiers) or `latest` (no tiers, no tier choice, no fold);
14
- * - `governed` is `opra` or absent; `emptyAnswer` is `quiet`, `degrades` or absent; `acquisitions` is `one` or
15
- * absent; a `liveByCoin` lane names its script source and its stamp and fold functions, and is no `latest` one;
14
+ * - `governed` is `opra`, `stocks` (never fed by coin) or absent; `emptyAnswer` is `quiet`, `degrades` or absent;
15
+ * `acquisitions` is `one` or absent; a `liveByCoin` lane names its script source and its stamp and fold functions,
16
+ * and is no `latest` one;
16
17
  * a `rowBudget` names the whole cells of one answered row and a projection (its cap is the source answer budget,
17
18
  * never the lane's own), on a flow or snapshot that carries a present mask;
18
19
  * - a `chain` lane names its exchange field, resolves its chain in its identity or facets, and declares no
@@ -109,8 +110,12 @@ function assertWrunRowLanes(lanes) {
109
110
  if (lane.acquisitions !== undefined && lane.acquisitions !== 'one') {
110
111
  throw new Error(`${who}: acquisitions is 'one' or absent`);
111
112
  }
112
- if (lane.governed !== undefined && lane.governed !== 'opra')
113
- throw new Error(`${who}: governed is 'opra' or absent`);
113
+ if (lane.governed !== undefined && lane.governed !== 'opra' && lane.governed !== 'stocks') {
114
+ throw new Error(`${who}: governed is 'opra', 'stocks' or absent`);
115
+ }
116
+ if (lane.governed === 'stocks' && lane.liveByCoin !== undefined) {
117
+ throw new Error(`${who}: a stocks lane is polled by the live reconcile, never fed live by coin`);
118
+ }
114
119
  assertWrunRowChainLane(who, lane);
115
120
  if (lane.emptyAnswer !== undefined && lane.emptyAnswer !== 'quiet' && lane.emptyAnswer !== 'degrades') {
116
121
  throw new Error(`${who}: emptyAnswer is 'quiet', 'degrades' or absent`);
@@ -0,0 +1,19 @@
1
+ import type { WrunRowLaneDescriptor } from '../wrun-row-lane.types.js';
2
+ /** f64s per print: `[offset_ms, price, size, usd, side, present]`. */
3
+ export declare const WRUN_DARK_POOL_WIDTH = 6;
4
+ /** How far back the source holds prints (the raw trade table keeps about two days): the lane's one horizon. */
5
+ export declare const WRUN_DARK_POOL_HORIZON_MS: number;
6
+ /** The overflow words, the default first. */
7
+ export declare const WRUN_DARK_POOL_OVERFLOW: readonly string[];
8
+ /** A partial bar's marker tuple: bit 14 alone, every other value 0. */
9
+ export declare function isWrunDarkPoolMarker(tuple: ArrayLike<number>): boolean;
10
+ /** A host bar's prints: each row's tuples (a row is stamped at its print's time), offsets re-based on the bar's open,
11
+ * in time order; a marker or a partial print on any row makes the bar partial (bit 14 on every print, else a marker). */
12
+ export declare function landWrunDarkPoolPrints(group: {
13
+ barOpenMs: number;
14
+ rows: ReadonlyArray<ReadonlyArray<unknown>>;
15
+ }): number[][];
16
+ /** `overflow: "largest"` over a bar past its bound (om's packer rule): its `maxCells` prints of the most dollars (an
17
+ * equal amount keeps the earlier one), in the order they printed, bit 14 on the FIRST kept print's `present`. */
18
+ export declare function wrunLargestDarkPoolPrints(tuples: ReadonlyArray<ReadonlyArray<number>>, maxCells: number): ReadonlyArray<ReadonlyArray<number>>;
19
+ export declare const rowLane: WrunRowLaneDescriptor;
@@ -0,0 +1,104 @@
1
+ /**
2
+ * `dark_pool` (frozen contract `dark_pool.cells`): each off-exchange print of $1M and up on a US stock's tape, by the
3
+ * Tape's own rule, as `[offset_ms, price, size, usd, side, present]` on the bar it printed in, oldest first; bit 14 of
4
+ * `present` marks a bar served in part, which holds one marker tuple (zeros, bit 14) when it has no print.
5
+ * - `governed: 'stocks'`: the identity and the own fetch read the chart port (wrun-dark-pool.util, loaded inside them):
6
+ * refused by name off a US stock tape market, on a tape the venue policy closes to the run, and on Price only, before
7
+ * any fetch.
8
+ * - Horizon: `WRUN_DARK_POOL_HORIZON_MS` (the raw table's); older bars and a capped day's bars are served in part.
9
+ * - Knobs: `max_cells` and `overflow` ("refuse" | "largest": the most dollars). No floor knob. Live: the poll reconcile.
10
+ * docs/features/data/us-stocks-tape.md, "Dark pool prints on the chart". LIGHT at module load.
11
+ */
12
+ import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED } from '../wrun-poll-lane.types.js';
13
+ import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunPresentWithPartial } from '../../wrun-present-bits.util.js';
14
+ /** f64s per print: `[offset_ms, price, size, usd, side, present]`. */
15
+ export const WRUN_DARK_POOL_WIDTH = 6;
16
+ const OFFSET = 0;
17
+ const USD = 3;
18
+ const PRESENT = 5;
19
+ /** How far back the source holds prints (the raw trade table keeps about two days): the lane's one horizon. */
20
+ export const WRUN_DARK_POOL_HORIZON_MS = 48 * 3_600_000;
21
+ /** The overflow words, the default first. */
22
+ export const WRUN_DARK_POOL_OVERFLOW = Object.freeze(['refuse', 'largest']);
23
+ const isTuple = (cell) => Array.isArray(cell) && cell.length === WRUN_DARK_POOL_WIDTH && cell.every((value) => Number.isFinite(value));
24
+ /** A partial bar's marker tuple: bit 14 alone, every other value 0. */
25
+ export function isWrunDarkPoolMarker(tuple) {
26
+ if (!wrunPresentIsPartial(tuple[PRESENT]))
27
+ return false;
28
+ for (let at = 0; at < PRESENT; at += 1)
29
+ if (tuple[at] !== 0)
30
+ return false;
31
+ return true;
32
+ }
33
+ /** A host bar's prints: each row's tuples (a row is stamped at its print's time), offsets re-based on the bar's open,
34
+ * in time order; a marker or a partial print on any row makes the bar partial (bit 14 on every print, else a marker). */
35
+ export function landWrunDarkPoolPrints(group) {
36
+ const prints = [];
37
+ let partial = false;
38
+ for (const row of group.rows) {
39
+ const base = Number(row[0]) - group.barOpenMs;
40
+ if (!Number.isFinite(base))
41
+ continue;
42
+ for (const cell of row.slice(1)) {
43
+ if (!isTuple(cell))
44
+ continue;
45
+ if (wrunPresentIsPartial(cell[PRESENT]))
46
+ partial = true;
47
+ if (isWrunDarkPoolMarker(cell))
48
+ continue;
49
+ const print = [...cell];
50
+ print[OFFSET] = base + cell[OFFSET];
51
+ prints.push(print);
52
+ }
53
+ }
54
+ prints.sort((a, b) => a[OFFSET] - b[OFFSET]);
55
+ if (!partial)
56
+ return prints;
57
+ if (prints.length === 0)
58
+ return [wrunPartialMarkerTuple(WRUN_DARK_POOL_WIDTH)];
59
+ for (const print of prints)
60
+ print[PRESENT] = wrunPresentWithPartial(print[PRESENT]);
61
+ return prints;
62
+ }
63
+ /** `overflow: "largest"` over a bar past its bound (om's packer rule): its `maxCells` prints of the most dollars (an
64
+ * equal amount keeps the earlier one), in the order they printed, bit 14 on the FIRST kept print's `present`. */
65
+ export function wrunLargestDarkPoolPrints(tuples, maxCells) {
66
+ const bound = Math.max(0, Math.floor(maxCells));
67
+ if (tuples.length <= bound)
68
+ return tuples;
69
+ const usd = (at) => isWrunDarkPoolMarker(tuples[at]) || !Number.isFinite(tuples[at][USD]) ? -Infinity : tuples[at][USD];
70
+ const kept = tuples
71
+ .map((_, at) => at)
72
+ .sort((a, b) => usd(b) - usd(a) || a - b)
73
+ .slice(0, bound)
74
+ .sort((a, b) => a - b)
75
+ .map((at) => [...tuples[at]]);
76
+ if (kept.length > 0)
77
+ kept[0][PRESENT] = wrunPresentWithPartial(kept[0][PRESENT]);
78
+ return kept;
79
+ }
80
+ const util = () => import('../../wrun-dark-pool.util.js');
81
+ export const rowLane = {
82
+ sourceClass: 'dark_pool',
83
+ laneKey: 'dark_pool',
84
+ kType: 'dark_pool',
85
+ label: 'Dark pool prints',
86
+ feedWords: 'wrun.refusal.feed.darkPool',
87
+ width: WRUN_DARK_POOL_WIDTH,
88
+ governed: 'stocks',
89
+ identity: async (ctx) => (await util()).wrunDarkPoolIdentity(ctx),
90
+ // The overflow word is projection, never acquisition: every input of a chart shares one read.
91
+ facets: (source, ctx) => {
92
+ const overflow = source.overflow ?? WRUN_DARK_POOL_OVERFLOW[0];
93
+ if (typeof overflow !== 'string' || !WRUN_DARK_POOL_OVERFLOW.includes(overflow)) {
94
+ refuseWrunPollInput(ctx, `declares overflow ${JSON.stringify(overflow)}: overflow is one of ${WRUN_DARK_POOL_OVERFLOW.join(', ')}`, WRUN_POLL_AUTHOR_GATE_SEED);
95
+ }
96
+ },
97
+ landing: { kind: 'flow', fold: landWrunDarkPoolPrints },
98
+ horizon: (_extras, nowMs) => ({ servedFromMs: nowMs - WRUN_DARK_POOL_HORIZON_MS }),
99
+ emptyAnswer: 'quiet',
100
+ cells: (tuples, input) => input.source.overflow === 'largest' && input.maxCells !== undefined
101
+ ? wrunLargestDarkPoolPrints(tuples, input.maxCells)
102
+ : tuples,
103
+ fetch: async (ask) => (await util()).fetchWrunDarkPoolRows(ask),
104
+ };
@@ -1,3 +1,4 @@
1
+ import * as lane_dark_pool from './dark_pool.js';
1
2
  import * as lane_option_contract_flow from './option_contract_flow.js';
2
3
  import * as lane_option_contract_state from './option_contract_state.js';
3
4
  import * as lane_option_prints from './option_prints.js';
@@ -5,6 +6,7 @@ import * as lane_option_strike_flow from './option_strike_flow.js';
5
6
  import * as lane_option_strikes from './option_strikes.js';
6
7
  import * as lane_option_surface from './option_surface.js';
7
8
  export const WRUN_ROW_LANE_MODULES = {
9
+ './row-lanes/dark_pool.ts': lane_dark_pool,
8
10
  './row-lanes/option_contract_flow.ts': lane_option_contract_flow,
9
11
  './row-lanes/option_contract_state.ts': lane_option_contract_state,
10
12
  './row-lanes/option_prints.ts': lane_option_prints,
@@ -0,0 +1,20 @@
1
+ /** The chart and the data generation a consumer planned its reads under. */
2
+ export interface WrunLaneFetchScope {
3
+ chartIndex: number;
4
+ generation: number;
5
+ /** Whether the consumer is still the overlay's (a run's head): false takes an aborted signal and leaves no entry. */
6
+ isCurrent?: () => boolean;
7
+ }
8
+ /**
9
+ * The overlay's own-fetch signal: live until the overlay leaves its chart or pauses, or the scope's chart dataset ends,
10
+ * then a fresh one. With a scope whose generation is not the chart's any more, an aborted signal and no entry.
11
+ */
12
+ export declare function wrunLaneFetchSignal(indicatorId: string, scope?: WrunLaneFetchScope): AbortSignal;
13
+ /** Abort every own fetch of an overlay still out (the teardown hook's): their reads stop, their answers land nowhere. */
14
+ export declare function abortWrunLaneFetches(indicatorId: string): void;
15
+ /** Abort the own fetches of every overlay on a chart whose dataset ended (the generation bump's). */
16
+ export declare function abortWrunLaneFetchesOfChart(chartIndex: number): void;
17
+ /** Test seam: whether an overlay holds a signal in the map. */
18
+ export declare function __wrunLaneFetchSignalHeldForTests(indicatorId: string): boolean;
19
+ /** Test seam: forget every signal and the hooks' registration. */
20
+ export declare function __resetWrunLaneFetchAbortsForTests(): void;
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The abort signal a lane's OWN fetch reads (`WrunPollLaneFetchAsk.signal`): one per overlay, aborted when the overlay
3
+ * leaves its chart or pauses (the drivers' live teardown hook, both causes) and when its chart's dataset ends (the
4
+ * fetch-generation bump every `cancelFetchDataOfChart` drives: an interval or symbol switch in place, a refetch, a
5
+ * teardown), so a lane whose fetch is a long scan (the `dark_pool` row lane's day reads of the stocks tape) stops with
6
+ * the picture it was asked for instead of reading on for nothing and holding the overlay's next run back. A chart
7
+ * fetch never reads it: the chart's own fetch door cancels its reads with the chart.
8
+ *
9
+ * A consumer (the run, the live reconcile, a prefix page) takes its signal once, when it starts, scoped to the chart
10
+ * and the generation it planned under: a teardown or a dataset end meanwhile aborts what it holds, and a consumer whose
11
+ * generation already ended takes an aborted signal and leaves nothing in the map. The next consumer after an abort
12
+ * takes a fresh signal.
13
+ *
14
+ * The hooks register with the first signal handed out (a module that merely imports this one registers nothing), and
15
+ * a node spec's partial mock of the drivers util is tolerated: the registration is retried at the next ask.
16
+ */
17
+ import { getChartDataFetchGeneration, onChartDataFetchGenerationBump, } from '../../chart/chart-data-fetch-generation.util.js';
18
+ import { onWrunOverlayLiveTeardown } from '../wrun-overlay-drivers.util.js';
19
+ const controllers = new Map();
20
+ let teardownRegistered = false;
21
+ let datasetEndOff;
22
+ function registerHooks() {
23
+ if (!teardownRegistered) {
24
+ try {
25
+ onWrunOverlayLiveTeardown((indicatorId) => abortWrunLaneFetches(indicatorId));
26
+ teardownRegistered = true;
27
+ }
28
+ catch {
29
+ // A partial mock of the drivers util: retried at the next ask.
30
+ }
31
+ }
32
+ if (datasetEndOff === undefined) {
33
+ try {
34
+ datasetEndOff = onChartDataFetchGenerationBump((chartIndex) => abortWrunLaneFetchesOfChart(chartIndex));
35
+ }
36
+ catch {
37
+ // A partial mock of the generation leaf: retried at the next ask.
38
+ }
39
+ }
40
+ }
41
+ function abortedSignal(reason) {
42
+ const controller = new AbortController();
43
+ controller.abort(new DOMException(reason, 'AbortError'));
44
+ return controller.signal;
45
+ }
46
+ /**
47
+ * The overlay's own-fetch signal: live until the overlay leaves its chart or pauses, or the scope's chart dataset ends,
48
+ * then a fresh one. With a scope whose generation is not the chart's any more, an aborted signal and no entry.
49
+ */
50
+ export function wrunLaneFetchSignal(indicatorId, scope) {
51
+ registerHooks();
52
+ if (scope !== undefined && getChartDataFetchGeneration(scope.chartIndex) !== scope.generation) {
53
+ return abortedSignal(`wrun overlay '${indicatorId}' asked for a dataset its chart replaced`);
54
+ }
55
+ if (scope?.isCurrent !== undefined && !scope.isCurrent()) {
56
+ return abortedSignal(`wrun overlay '${indicatorId}' asked after its run was superseded`);
57
+ }
58
+ let entry = controllers.get(indicatorId);
59
+ // An overlay asked on another chart than its signal's left that chart: what it still reads there stops.
60
+ if (entry !== undefined &&
61
+ scope !== undefined &&
62
+ entry.chartIndex !== undefined &&
63
+ entry.chartIndex !== scope.chartIndex) {
64
+ abortWrunLaneFetches(indicatorId);
65
+ entry = undefined;
66
+ }
67
+ if (entry === undefined || entry.controller.signal.aborted) {
68
+ entry = { controller: new AbortController(), chartIndex: scope?.chartIndex };
69
+ controllers.set(indicatorId, entry);
70
+ }
71
+ else if (entry.chartIndex === undefined && scope !== undefined) {
72
+ entry.chartIndex = scope.chartIndex;
73
+ }
74
+ return entry.controller.signal;
75
+ }
76
+ /** Abort every own fetch of an overlay still out (the teardown hook's): their reads stop, their answers land nowhere. */
77
+ export function abortWrunLaneFetches(indicatorId) {
78
+ const entry = controllers.get(indicatorId);
79
+ if (entry === undefined)
80
+ return;
81
+ controllers.delete(indicatorId);
82
+ entry.controller.abort(new DOMException(`wrun overlay '${indicatorId}' left its chart`, 'AbortError'));
83
+ }
84
+ /** Abort the own fetches of every overlay on a chart whose dataset ended (the generation bump's). */
85
+ export function abortWrunLaneFetchesOfChart(chartIndex) {
86
+ for (const [indicatorId, entry] of [...controllers]) {
87
+ if (entry.chartIndex !== chartIndex)
88
+ continue;
89
+ controllers.delete(indicatorId);
90
+ entry.controller.abort(new DOMException(`chart ${chartIndex}'s dataset ended`, 'AbortError'));
91
+ }
92
+ }
93
+ /** Test seam: whether an overlay holds a signal in the map. */
94
+ export function __wrunLaneFetchSignalHeldForTests(indicatorId) {
95
+ return controllers.has(indicatorId);
96
+ }
97
+ /** Test seam: forget every signal and the hooks' registration. */
98
+ export function __resetWrunLaneFetchAbortsForTests() {
99
+ controllers.clear();
100
+ teardownRegistered = false;
101
+ datasetEndOff?.();
102
+ datasetEndOff = undefined;
103
+ }
@@ -39,6 +39,7 @@
39
39
  * planned; `forming` views and bindings are refused by the kit.
40
40
  */
41
41
  import type { OpraOptionPlaneStop } from '../../../host-ports.types.js';
42
+ import type { OpraReadFacts } from '../../chart/opra-read-access.leaf.js';
42
43
  import type { WrunInputSource } from '../../../interfaces/wrun-runtime.interface.js';
43
44
  import type { GateProvider } from '../../../workers/constants/socket-slots.js';
44
45
  import type { WrunDailyLanding } from '../wrun-daily-lane.util.js';
@@ -49,7 +50,7 @@ import type { WrunRowLaneChain, WrunRowLaneHorizon } from './wrun-row-lane.types
49
50
  * that the interface does not name yet (`asset`, `publisher`, `series`, ...), as `unknown`. */
50
51
  export type WrunPollLaneSource = WrunInputSource & Readonly<Record<string, unknown>>;
51
52
  /** The chart a lane is planned against, and the input being planned. */
52
- export interface WrunPollLaneContext {
53
+ export interface WrunPollLaneContext extends OpraReadFacts {
53
54
  /** The input's declared name (every refusal names it). */
54
55
  inputName: string;
55
56
  /** The input's source class (the lane's own; carried so a refusal can name it). */
@@ -64,6 +65,9 @@ export interface WrunPollLaneContext {
64
65
  category?: number;
65
66
  /** The chart's bar interval in ms. */
66
67
  intervalMs: number;
68
+ /** The chart market's metadata whole (its feed fields), for a lane whose resolver reads more than the market (a
69
+ * `stocks` row lane). Opaque to the planners; absent outside a run's plan. */
70
+ chartMetadata?: Readonly<Record<string, unknown>>;
67
71
  /** The chart is index-mode (a stock, forex, commodity or DEX chart): only a `global` lane is
68
72
  * planned there, and the chart's coin is not a crypto asset a lane may default to. */
69
73
  indexMode: boolean;
@@ -100,6 +104,9 @@ export interface WrunPollLaneContext {
100
104
  plane: GateProvider | null;
101
105
  opraStop?: OpraOptionPlaneStop;
102
106
  };
107
+ /** The crypto venue word a contract F root's chain is read under (derived-roots.util `wrunUnderlyingLaneContext`: the
108
+ * chart's own crypto venue when its listing names the root), for a lane whose `venue` knob names no chain. */
109
+ underlyingVenue?: string;
103
110
  /**
104
111
  * The run's plan as an identity: one object per `planWrunPollLanes` call, the same for every input it plans. A lane
105
112
  * keys a resolution every input of the run shares by it (a `WeakMap`: a `chain` lane's chart, its chain and its
@@ -160,10 +167,20 @@ export interface WrunPollLaneFetchAsk {
160
167
  toTs: number;
161
168
  /** The grid's bar interval, ms (the run interval on a run at another interval). */
162
169
  intervalMs: number;
170
+ /** The run clock's now, the instant the plan's horizon was cut at (absent: the lane reads the server clock). */
171
+ nowMs?: number;
172
+ /** The host bars the ask reaches on the chart's session grid, each its span (wrun-tier-grid `wrunHostBarSpansWithin`):
173
+ * a lane marks a bar by a row inside it. Absent: the lane steps `intervalMs` from its own times. */
174
+ hostBars?: ReadonlyArray<{
175
+ fromMs: number;
176
+ toMs: number;
177
+ }>;
163
178
  /** Told, once the answer is in, whether it is the whole window: true when the source said nothing more follows,
164
179
  * false when the answer ended early (the source named more without a way to it). A lane that cannot tell never
165
180
  * calls it; a caller that needs the verdict (a wrun prefix page) reads its absence as not whole. */
166
181
  onComplete?: (complete: boolean) => void;
182
+ /** Aborted when the overlay leaves its chart or pauses (wrun-lane-fetch-abort.util): a long scan stops with it. */
183
+ signal?: AbortSignal;
167
184
  }
168
185
  /** A lane's live channel (`WrunPollLane.live`; contract in `wrun-series-stream.util.ts`): its ask,
169
186
  * its sink (rows on the grid's bar opens, reopens, spans it cannot vouch for, re-plans) and its
@@ -256,7 +273,7 @@ export interface WrunPollLane {
256
273
  * (`wrunLaneChainPlaneOf`):
257
274
  * - `opra`: the OPRA wall (before the chain is resolved on a chart whose options ride the plane), the plane and its
258
275
  * routed tier in the ask, the overlay's OPRA provenance and the legend's delayed-tier note, as an `opra` lane's;
259
- * - `cme`: the CME display wall (OpenMarket's own packages only) and the routed tier in the ask (`servedTier`);
276
+ * - `cme`: the CME chain wall (`mayReadCmeChain`) and the routed tier in the ask (`servedTier`);
260
277
  * - `plain` (a crypto options venue): nothing beside the lane's own fields.
261
278
  * It is admitted on every chart (a chart with no chain refuses by name in its `plan`) and rides the native-rows path
262
279
  * on every plane (`nativeRows`: its rows are its chain's, never the chart market's). The registry refuses it beside
@@ -40,7 +40,7 @@
40
40
  * naming `tierChoice: 'coarsest'`, the coarsest that already serves the bar.
41
41
  */
42
42
  import type { WrunIndicatorMetadata, WrunInputSource, WrunMetadataParam } from '../../../interfaces/wrun-runtime.interface.js';
43
- import type { OpraReadFacts } from '../../chart/opra-read-access.leaf.js';
43
+ import { type OpraReadFacts } from '../../chart/opra-read-access.leaf.js';
44
44
  import type { OpraOptionPlaneStop } from '../../../host-ports.types.js';
45
45
  import { type WrunRunOptionsMarket } from '../derived-roots.util.js';
46
46
  import { type WrunRefusalSeed } from '../wrun-refusal.util.js';
@@ -69,6 +69,8 @@ export declare function planWrunPollLaneInputs(metadata: WrunIndicatorMetadata):
69
69
  /** A value's canonical text: object keys sorted at every depth, `undefined` members dropped (the instance key's
70
70
  * suffix, here and for the row lanes). */
71
71
  export declare function stableJson(value: unknown): string;
72
+ /** The extras field naming a contract F root's market (`planWrunLaneUnderlying`'s key), absent on the chart's own reads. */
73
+ export declare const WRUN_POLL_LANE_UNDERLYING_FIELD = "underlyingMarket";
72
74
  /** The id of the lane instance `extras` names: `poll:<laneKey>` when the ask carries no extras,
73
75
  * else the extras' canonical text appended, so equal asks are ONE instance whatever order
74
76
  * their fields were written in and different asks never collide. */
@@ -76,11 +78,11 @@ export declare function wrunPollLaneInstanceKey(laneKey: string, extras: Readonl
76
78
  /** Why a lane reading the chart's market is not served on an index-mode chart, as its refusal
77
79
  * says it: such a chart serves candles, time and the global series (named by class). */
78
80
  export declare function wrunPollLaneIndexModeReason(): string;
79
- /** What the run hands the poll planner beside the chart: its OPRA facts (`mayReadOpra`: who may read the plane)
80
- * and the predicate an `opra` lane is admitted by (`isOpraPlaneExchange`, over the chart market's exchange and
81
- * symbol: the chart's options ride the OPRA plane, a US stock or ETF chart under either venue spelling while the
82
- * `opra` flag is lit, an OPRA contract chart, a stock twin reading its stock's chain; absent, no chart is judged off
83
- * the plane). */
81
+ /** What the run hands the poll planner beside the chart: its plane facts (`mayReadOpra`: who may read the OPRA plane;
82
+ * `mayReadCmeChain`: who may read a CME chain) and the predicate an `opra` lane is admitted by (`isOpraPlaneExchange`,
83
+ * over the chart market's exchange and symbol: the chart's options ride the OPRA plane, a US stock or ETF chart under
84
+ * either venue spelling while the `opra` flag is lit, an OPRA contract chart, a stock twin reading its stock's chain;
85
+ * absent, no chart is judged off the plane). */
84
86
  export interface WrunPollLaneRunFacts extends OpraReadFacts {
85
87
  isOpraPlaneExchange?: (exchange: string, symbol: string) => boolean;
86
88
  /** Why a chart off the plane is off it although its options list on OPRA (opra-options-gate.util
@@ -272,12 +274,12 @@ export type WrunPollLanePlanResult = WrunPollLanePlan & WrunPollLaneInstance[];
272
274
  * A `chain` lane (the chart's options chain on whichever plane it lists on) is admitted on every chart its options are
273
275
  * not stopped on: its `plan` resolves the chain through the one chain resolver. It meets the OPRA wall before its
274
276
  * `plan` runs where the chart's options list on OPRA (every chain it reads there is OPRA's), and each instance then
275
- * meets its own plane's wall (`assertWrunLaneChainPlaneReadable`: OPRA's, the CME display wall, none for a crypto
277
+ * meets its own plane's wall (`assertWrunLaneChainPlaneReadable`: OPRA's, the CME chain wall, none for a crypto
276
278
  * chain). On a chart whose options list on OPRA but ride no plane for a known reason (`run.opraPlaneStop`) it keeps an
277
279
  * `opra` lane's rules (`wrunChainLaneStop`, the row lanes' one rule): a declared fill drops the input with the stop's
278
- * note, any other input refuses with it, and no chain is resolved past the stop. Its context carries the run's OPRA
279
- * facts (the chain decision's `auto` reads them), the chart's category, the plane verdict (`opraPlane`: a lane reading
280
- * by coin there reads no chain directory) and the plan's `runScope` (its inputs share one chart resolution).
280
+ * note, any other input refuses with it, and no chain is resolved past the stop. Its context carries the run's plane
281
+ * facts (the chain decision's `auto` reads the OPRA ones), the chart's category, the plane verdict (`opraPlane`: a lane
282
+ * reading by coin there reads no chain directory) and the plan's `runScope` (its inputs share one chart resolution).
281
283
  *
282
284
  * A chart with no option chain (a LINK perp, a forex pair, a stock listing no options) does not serve an options feed:
283
285
  * an input whose lane's `plan` refuses so (`wrunLaneNoChainRefusal`: the record's `no-options` / `chain`) meets the
@@ -308,9 +310,9 @@ export declare function planWrunPollLaneInstances(metadata: WrunIndicatorMetadat
308
310
  }, isIndexModeExchange?: (exchange: string) => boolean, isCryptoVenueExchange?: (exchange: string) => boolean, run?: WrunPollLaneRunFacts): Promise<WrunPollLaneInstance[]>;
309
311
  /**
310
312
  * A chain instance against its own plane's wall, by the plane and the exchange its chain lists on: an OPRA chain the
311
- * OPRA wall (`mayReadOpra`), a CME chain the CME display wall (OpenMarket's own packages only, the run door's rule on
312
- * a CME chart, kscript-venue-policy.util; the `opra-user-scripts` flag never opens it), a crypto chain (`plain`)
313
- * none. The row lanes keep the same rule (wrun-row-lanes.util), in the same words.
313
+ * OPRA wall (`mayReadOpra`), a CME chain the CME chain wall (`mayReadCmeChain`: an official run, or a CME chart study;
314
+ * the `opra-user-scripts` flag never opens it), a crypto chain (`plain`) none. The row lanes, the options chain lane
315
+ * and a CME root read through `underlying` meet this one rule, in the same words.
314
316
  */
315
317
  export declare function assertWrunLaneChainPlaneReadable(plane: WrunLaneChainPlane | undefined, exchange: string, run: OpraReadFacts | undefined, ctx: Pick<WrunPollLaneContext, 'inputName' | 'sourceClass'>): void;
316
318
  /** The exchange a chain-lane instance's chain lists on (the payload field its `chain` names); '' for any other lane
@@ -1,4 +1,5 @@
1
- import { wrunUnderlyingLaneContext } from '../derived-roots.util.js';
1
+ import { mayReadCmeChain, planeReadFactsOf } from '../../chart/opra-read-access.leaf.js';
2
+ import { planWrunLaneUnderlying, resolveWrunUnderlyingSettingKnob, wrunTakesUnderlying, wrunUnderlyingLaneContext, } from '../derived-roots.util.js';
2
3
  import { wrunParamChoices } from '../wrun-color-settings.util.js';
3
4
  import { isWrunOptionsChainCryptoVenueWord } from '../wrun-options-chain.util.js';
4
5
  import { refuseWrunOptionKnob } from '../wrun-option-knobs.util.js';
@@ -59,6 +60,8 @@ export function stableJson(value) {
59
60
  }
60
61
  return JSON.stringify(value) ?? 'null';
61
62
  }
63
+ /** The extras field naming a contract F root's market (`planWrunLaneUnderlying`'s key), absent on the chart's own reads. */
64
+ export const WRUN_POLL_LANE_UNDERLYING_FIELD = 'underlyingMarket';
62
65
  /** The id of the lane instance `extras` names: `poll:<laneKey>` when the ask carries no extras,
63
66
  * else the extras' canonical text appended, so equal asks are ONE instance whatever order
64
67
  * their fields were written in and different asks never collide. */
@@ -410,12 +413,12 @@ function wrunPollLanePlanResult(lanes, missingFeeds) {
410
413
  * A `chain` lane (the chart's options chain on whichever plane it lists on) is admitted on every chart its options are
411
414
  * not stopped on: its `plan` resolves the chain through the one chain resolver. It meets the OPRA wall before its
412
415
  * `plan` runs where the chart's options list on OPRA (every chain it reads there is OPRA's), and each instance then
413
- * meets its own plane's wall (`assertWrunLaneChainPlaneReadable`: OPRA's, the CME display wall, none for a crypto
416
+ * meets its own plane's wall (`assertWrunLaneChainPlaneReadable`: OPRA's, the CME chain wall, none for a crypto
414
417
  * chain). On a chart whose options list on OPRA but ride no plane for a known reason (`run.opraPlaneStop`) it keeps an
415
418
  * `opra` lane's rules (`wrunChainLaneStop`, the row lanes' one rule): a declared fill drops the input with the stop's
416
- * note, any other input refuses with it, and no chain is resolved past the stop. Its context carries the run's OPRA
417
- * facts (the chain decision's `auto` reads them), the chart's category, the plane verdict (`opraPlane`: a lane reading
418
- * by coin there reads no chain directory) and the plan's `runScope` (its inputs share one chart resolution).
419
+ * note, any other input refuses with it, and no chain is resolved past the stop. Its context carries the run's plane
420
+ * facts (the chain decision's `auto` reads the OPRA ones), the chart's category, the plane verdict (`opraPlane`: a lane
421
+ * reading by coin there reads no chain directory) and the plan's `runScope` (its inputs share one chart resolution).
419
422
  *
420
423
  * A chart with no option chain (a LINK perp, a forex pair, a stock listing no options) does not serve an options feed:
421
424
  * an input whose lane's `plan` refuses so (`wrunLaneNoChainRefusal`: the record's `no-options` / `chain`) meets the
@@ -461,12 +464,10 @@ export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = (
461
464
  sourceClass: planned.lane.sourceClass,
462
465
  indexMode: indexModeChart,
463
466
  cryptoVenue,
464
- // The run's OPRA facts reach the plan of a lane that reads OPRA (`opra`) or may (a `chain` lane: its chain
465
- // decision's `auto` reads them), the lanes the decision concerns; every other lane's context is as it always
466
- // was. Absent reads closed.
467
- ...(run !== undefined && (planned.lane.opra === true || chainLane)
468
- ? { official: run.official === true, opraUserScripts: run.opraUserScripts === true }
469
- : {}),
467
+ // The run's plane facts reach the plan of a lane that reads OPRA (`opra`) or may (a `chain` lane: its chain
468
+ // decision's `auto` reads them, its CME chain the CME chain fact), the lanes the decisions concern; every other
469
+ // lane's context is as it always was. Absent reads closed.
470
+ ...(run !== undefined && (planned.lane.opra === true || chainLane) ? planeReadFactsOf(run) : {}),
470
471
  ...(chainLane ? { runScope, opraPlane: plane.onPlane } : {}),
471
472
  };
472
473
  // A chain lane reads the run's one options market: a stock twin's stock in place of the chart's
@@ -490,11 +491,24 @@ export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = (
490
491
  continue;
491
492
  }
492
493
  let answered;
494
+ let underlyingKey;
493
495
  try {
496
+ const params = metadata.params ?? [];
497
+ const declared = planned.source;
498
+ // Contract F: a root's input plans against the root's market (`planWrunLaneUnderlying`, the row lanes' one rule).
499
+ const underlying = wrunTakesUnderlying(planned.lane.sourceClass) && declared.underlying !== undefined
500
+ ? await planWrunLaneUnderlying(declared, laneCtx, params, run, WRUN_POLL_LANE_UNSERVED_FILLS)
501
+ : undefined;
502
+ if (underlying !== undefined && 'why' in underlying) {
503
+ wrunUnservedLaneInput(missing, unserved, WRUN_POLL_LANE_UNSERVED_FILLS, underlying.why, cryptoVenue);
504
+ continue;
505
+ }
506
+ underlyingKey = underlying?.key;
494
507
  // An option knob naming a setting reads the setting's current value before the lane judges it (om
495
508
  // `resolveOptionParamKnobs`): the instance's extras carry the value, so a settings change re-plans and re-asks.
496
- const source = resolveWrunOptionSettingKnobs(ctx, planned.source, metadata.params ?? [], run?.paramValues);
497
- answered = await planned.lane.plan(source, laneCtx);
509
+ // The lane reads the word an `underlying` setting picks, the word its root was planned by.
510
+ const source = resolveWrunOptionSettingKnobs(ctx, resolveWrunUnderlyingSettingKnob(ctx, declared, params, run?.paramValues), params, run?.paramValues);
511
+ answered = await planned.lane.plan(source, underlying?.ctx ?? laneCtx);
498
512
  }
499
513
  catch (error) {
500
514
  // A chart with no option chain does not serve the feed (`wrunLaneNoChainRefusal`), nor one whose options plane
@@ -508,6 +522,9 @@ export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = (
508
522
  for (const [key, value] of Object.entries(answered ?? {}))
509
523
  if (value !== undefined)
510
524
  extras[key] = value;
525
+ // A root's input is its own instance, named by the root's market: two roots of one sheet are two fetches.
526
+ if (underlyingKey !== undefined)
527
+ extras[WRUN_POLL_LANE_UNDERLYING_FIELD] = underlyingKey;
511
528
  // A chain instance meets its own plane's wall, by the exchange its chain lists on.
512
529
  if (chainLane) {
513
530
  assertWrunLaneChainPlaneReadable(wrunPollLaneChainPlane(planned.lane, extras), wrunPollLaneChainExchange(planned.lane, extras), run, ctx);
@@ -537,22 +554,31 @@ export async function planWrunPollLaneInstances(metadata, chart, isIndexModeExch
537
554
  // ---------------------------------------------------------------------------
538
555
  // A chain lane's plane per instance (`WrunPollLane.chain`, the row lanes' mark): the run's and the live tick's rule
539
556
  // ---------------------------------------------------------------------------
540
- /** The record seed of the CME display wall on a chain instance's CME chain (the display wall's own record). */
541
- const WRUN_CME_WALL_SEED = Object.freeze({ cls: 'cme-wall' });
557
+ /** The CME chain wall's seed for a run the gate is open to: the `cme-wall` `chain` row (CME chart only, works-on). */
558
+ const WRUN_CME_CHAIN_WALL_SEED = Object.freeze({ cls: 'cme-wall', variant: 'chain' });
559
+ /** For a run the gate is closed to: the default CME wall words, never the switch OUT (the read is walled there too). */
560
+ const WRUN_CME_CHAIN_CLOSED_SEED = Object.freeze({
561
+ cls: 'cme-wall',
562
+ out: { kind: 'works-on' },
563
+ });
542
564
  /**
543
565
  * A chain instance against its own plane's wall, by the plane and the exchange its chain lists on: an OPRA chain the
544
- * OPRA wall (`mayReadOpra`), a CME chain the CME display wall (OpenMarket's own packages only, the run door's rule on
545
- * a CME chart, kscript-venue-policy.util; the `opra-user-scripts` flag never opens it), a crypto chain (`plain`)
546
- * none. The row lanes keep the same rule (wrun-row-lanes.util), in the same words.
566
+ * OPRA wall (`mayReadOpra`), a CME chain the CME chain wall (`mayReadCmeChain`: an official run, or a CME chart study;
567
+ * the `opra-user-scripts` flag never opens it), a crypto chain (`plain`) none. The row lanes, the options chain lane
568
+ * and a CME root read through `underlying` meet this one rule, in the same words.
547
569
  */
548
570
  export function assertWrunLaneChainPlaneReadable(plane, exchange, run, ctx) {
549
571
  if (plane === 'opra')
550
572
  assertWrunOpraLaneReadable(run, ctx);
551
- // OpenMarket's own packages only, whatever the `cme-user-scripts` gate says: the gate opens CME chart studies (the
552
- // chart's own futures data), never CME options data (no implied expansion to CME options in this release).
553
- if (plane === 'cme' && run?.official !== true) {
554
- refuseWrunPollInput(ctx, `reads CME options data (${exchange}), which is open to OpenMarket's own Indicators only: a package you wrote ` +
555
- 'or added from the community cannot read it yet', WRUN_CME_WALL_SEED);
573
+ // A user run off a CME chart holds no CME mark and no CME authorisation: its output would carry CME data off it.
574
+ if (plane === 'cme' && !mayReadCmeChain(run)) {
575
+ // Worded by the gate, as every CME door is: a CME chart is a way out only for a run the gate is open to.
576
+ const open = run?.cmeUserScripts === true;
577
+ refuseWrunPollInput(ctx, open
578
+ ? `reads CME options data (${exchange}): a package you wrote or added from the community reads it on a CME ` +
579
+ 'futures chart only, in the browser'
580
+ : `reads CME options data (${exchange}), which a package you wrote or added from the community cannot read ` +
581
+ 'on this account yet', open ? WRUN_CME_CHAIN_WALL_SEED : WRUN_CME_CHAIN_CLOSED_SEED);
556
582
  }
557
583
  }
558
584
  /** The exchange a chain-lane instance's chain lists on (the payload field its `chain` names); '' for any other lane
@@ -35,7 +35,7 @@ import type { WrunBackendTier, WrunHostBarGroup, WrunTierChoice } from '../wrun-
35
35
  /** An input's declaration as a row lane reads it (the typed fields and any knob the sheet carries). */
36
36
  export type WrunRowLaneSource = WrunPollLaneSource;
37
37
  /** The chart a row lane is planned against, and the input being planned (the poll lanes' context: the
38
- * market, the interval, the index-mode verdict and the run's OPRA facts, `official` and `opraUserScripts`). */
38
+ * market, the interval, the index-mode verdict and the run's plane facts, `official` and the rest). */
39
39
  export type WrunRowLaneContext = WrunPollLaneContext;
40
40
  /**
41
41
  * How a lane's rows reach the chart's bars:
@@ -148,7 +148,7 @@ export interface WrunRowLaneLiveByCoin {
148
148
  * - `opra` (US options data): the OPRA wall (`opra-official-only:<class>`, before the chain is resolved on a chart
149
149
  * whose options ride the plane), the plane stamp and its routed tier in the ask (`wrunPlane`, `servedTier`), the
150
150
  * overlay's OPRA provenance before the first fetch and the legend's delayed-tier note, as a governed lane's;
151
- * - `cme` (a CME Group exchange): the CME display wall (official packages only) and the routed tier in the ask
151
+ * - `cme` (a CME Group exchange): the CME chain wall (`mayReadCmeChain`) and the routed tier in the ask
152
152
  * (`servedTier`, so no source cache serves one tier's rows to the other); no plane stamp, no provenance, no legend
153
153
  * note (the chart's own delay badge names the delay);
154
154
  * - `plain` (a crypto options venue): nothing beside the lane's own fields.
@@ -216,14 +216,19 @@ export interface WrunRowLaneDescriptor {
216
216
  * horizon made them (a lane whose answer cannot pass the budget). */
217
217
  rowBudget?: WrunRowLaneRowBudget;
218
218
  /**
219
- * The lane reads a governed plane on every chart it serves: `opra` (US options data). Its inputs are refused by
220
- * name before any fetch for a run that may not read OPRA (`opra-official-only:<class>`); it is admitted on the
221
- * charts whose options ride the plane (a US stock or ETF chart while the `opra` flag is lit, an OPRA contract
222
- * chart) and nowhere else; its asks ride the native-rows path naming the plane and their routed tier; the run
223
- * stamps the overlay's OPRA provenance before its first fetch and the legend names a delayed tier. A `chain` lane
224
- * declares none: its plane is its instance's.
219
+ * The lane reads a governed plane on every chart it serves:
220
+ * - `opra` (US options data). Its inputs are refused by name before any fetch for a run that may not read OPRA
221
+ * (`opra-official-only:<class>`); it is admitted on the charts whose options ride the plane (a US stock or ETF
222
+ * chart while the `opra` flag is lit, an OPRA contract chart) and nowhere else; its asks ride the native-rows path
223
+ * naming the plane and their routed tier; the run stamps the overlay's OPRA provenance before its first fetch and
224
+ * the legend names a delayed tier.
225
+ * - `stocks` (the US stocks tape, `dark_pool`): admitted on every chart; its identity answers the tape market
226
+ * (`exchange`) or refuses by name. Its asks name the plane and the tape's tier (`wrunRowLaneChainAsk`), the run
227
+ * stamps the tape provenance, the legend carries the delay statement, the reconcile opens the tape's poll window.
228
+ * Never fed live by coin.
229
+ * A `chain` lane declares none: its plane is its instance's.
225
230
  */
226
- governed?: 'opra';
231
+ governed?: 'opra' | 'stocks';
227
232
  /**
228
233
  * A CHAIN lane: it reads the chart's options chain on whichever plane that chain lists on, decided per INSTANCE by
229
234
  * the one chain resolver (sources/opra-option-lanes.util `decideWrunLaneChain`), never per descriptor (see