@orangecharts/wrun-chart-host 0.1.0 → 0.3.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 (337) hide show
  1. package/README.md +39 -6
  2. package/dist/constants/common.constants.d.ts +15 -0
  3. package/dist/constants/common.constants.js +23 -0
  4. package/dist/constants/data-source.constants.d.ts +1 -0
  5. package/dist/constants/data-source.constants.js +1 -0
  6. package/dist/constants/economic.constants.d.ts +39 -0
  7. package/dist/constants/economic.constants.js +77 -0
  8. package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
  9. package/dist/constants/etf-covered-coins.constants.js +9 -0
  10. package/dist/constants/feature-flags.constants.d.ts +60 -0
  11. package/dist/constants/feature-flags.constants.js +308 -0
  12. package/dist/constants/feature-limits.constants.d.ts +134 -0
  13. package/dist/constants/feature-limits.constants.js +155 -0
  14. package/dist/constants/marketCapabilities.constants.d.ts +87 -0
  15. package/dist/constants/marketCapabilities.constants.js +213 -0
  16. package/dist/constants/option-venues.constants.d.ts +100 -0
  17. package/dist/constants/option-venues.constants.js +167 -0
  18. package/dist/constants/overlay-data.constants.d.ts +53 -0
  19. package/dist/constants/overlay-data.constants.js +80 -0
  20. package/dist/constants/pane-grid.constants.d.ts +15 -0
  21. package/dist/constants/pane-grid.constants.js +17 -0
  22. package/dist/constants/venue-presets.constants.d.ts +10 -0
  23. package/dist/constants/venue-presets.constants.js +22 -0
  24. package/dist/enums/chart.enum.d.ts +68 -0
  25. package/dist/enums/chart.enum.js +70 -0
  26. package/dist/helpers/data.helpers.d.ts +2 -0
  27. package/dist/helpers/data.helpers.js +14 -0
  28. package/dist/host-env.d.ts +161 -5
  29. package/dist/host-ports.types.d.ts +446 -0
  30. package/dist/host-ports.types.js +1 -0
  31. package/dist/index.d.ts +131 -0
  32. package/dist/index.js +131 -0
  33. package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
  34. package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
  35. package/dist/interfaces/asset-venue.interface.d.ts +91 -0
  36. package/dist/interfaces/asset-venue.interface.js +1 -0
  37. package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
  38. package/dist/interfaces/cancel-reason.interface.js +2 -0
  39. package/dist/interfaces/catalog-display.interface.d.ts +3 -0
  40. package/dist/interfaces/catalog-display.interface.js +1 -0
  41. package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
  42. package/dist/interfaces/cme-realtime.interface.js +46 -0
  43. package/dist/interfaces/feed.interface.d.ts +80 -0
  44. package/dist/interfaces/feed.interface.js +7 -0
  45. package/dist/interfaces/market-kind.interface.d.ts +8 -0
  46. package/dist/interfaces/market-kind.interface.js +1 -0
  47. package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
  48. package/dist/interfaces/opra-realtime.interface.js +105 -0
  49. package/dist/interfaces/option-instrument.interface.d.ts +32 -0
  50. package/dist/interfaces/option-instrument.interface.js +1 -0
  51. package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
  52. package/dist/interfaces/options-chain-scope.interface.js +7 -0
  53. package/dist/interfaces/prediction-market.interface.d.ts +88 -0
  54. package/dist/interfaces/prediction-market.interface.js +8 -0
  55. package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
  56. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
  57. package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
  58. package/dist/settings-templates/frvp-fields.d.ts +27 -0
  59. package/dist/settings-templates/frvp-fields.js +108 -0
  60. package/dist/settings-templates/index.d.ts +119 -0
  61. package/dist/settings-templates/index.js +442 -0
  62. package/dist/settings-templates/indicator-fields.d.ts +56 -0
  63. package/dist/settings-templates/indicator-fields.js +793 -0
  64. package/dist/settings-templates/tool-rules.d.ts +59 -0
  65. package/dist/settings-templates/tool-rules.js +49 -0
  66. package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
  67. package/dist/settings-templates/tool-tables.generated.js +1668 -0
  68. package/dist/utility/blk-market.util.d.ts +5 -0
  69. package/dist/utility/blk-market.util.js +12 -0
  70. package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
  71. package/dist/utility/chart/chart-load-phase.util.js +78 -0
  72. package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
  73. package/dist/utility/chart/cme-cache-context.util.js +166 -0
  74. package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
  75. package/dist/utility/chart/cme-session-bucket.util.js +343 -0
  76. package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
  77. package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
  78. package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
  79. package/dist/utility/chart/continuous-contracts.util.js +374 -0
  80. package/dist/utility/chart/feed-interval.util.d.ts +119 -0
  81. package/dist/utility/chart/feed-interval.util.js +321 -0
  82. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
  83. package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
  84. package/dist/utility/chart/footprint-band.util.d.ts +76 -0
  85. package/dist/utility/chart/footprint-band.util.js +205 -0
  86. package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
  87. package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
  88. package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
  89. package/dist/utility/chart/formula-calendar.util.js +59 -0
  90. package/dist/utility/chart/history-wall.util.d.ts +67 -0
  91. package/dist/utility/chart/history-wall.util.js +87 -0
  92. package/dist/utility/chart/index-mode.util.d.ts +66 -0
  93. package/dist/utility/chart/index-mode.util.js +360 -0
  94. package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
  95. package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
  96. package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
  97. package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
  98. package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
  99. package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
  100. package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
  101. package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
  102. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
  103. package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
  104. package/dist/utility/chart/interval-registry.util.d.ts +23 -0
  105. package/dist/utility/chart/interval-registry.util.js +83 -0
  106. package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
  107. package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
  108. package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
  109. package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
  110. package/dist/utility/chart/live-bucket.util.d.ts +66 -0
  111. package/dist/utility/chart/live-bucket.util.js +165 -0
  112. package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
  113. package/dist/utility/chart/market-session-schedule.util.js +337 -0
  114. package/dist/utility/chart/marketKind.util.d.ts +181 -0
  115. package/dist/utility/chart/marketKind.util.js +371 -0
  116. package/dist/utility/chart/om-panel.util.js +6 -0
  117. package/dist/utility/chart/om-widget.util.d.ts +4 -0
  118. package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
  119. package/dist/utility/chart/opra-read-access.leaf.js +25 -0
  120. package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
  121. package/dist/utility/chart/prediction-identity.util.js +236 -0
  122. package/dist/utility/chart/rth-session.util.d.ts +352 -0
  123. package/dist/utility/chart/rth-session.util.js +926 -0
  124. package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
  125. package/dist/utility/chart/titan-constants.pin.js +50 -0
  126. package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
  127. package/dist/utility/chart/us-equities-session.util.js +251 -0
  128. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
  129. package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
  130. package/dist/utility/chart/wrun-run-result.util.js +10 -0
  131. package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
  132. package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
  133. package/dist/utility/common/safe-math-eval.d.ts +18 -0
  134. package/dist/utility/common/safe-math-eval.js +160 -0
  135. package/dist/utility/common/time.util.d.ts +134 -0
  136. package/dist/utility/common/time.util.js +428 -0
  137. package/dist/utility/common/transformations.util.d.ts +126 -0
  138. package/dist/utility/common/transformations.util.js +711 -0
  139. package/dist/utility/common/visible-timeout.util.d.ts +17 -0
  140. package/dist/utility/common/visible-timeout.util.js +75 -0
  141. package/dist/utility/exchange-normalization.util.d.ts +8 -0
  142. package/dist/utility/exchange-normalization.util.js +32 -0
  143. package/dist/utility/intl-locale.util.d.ts +2 -0
  144. package/dist/utility/intl-locale.util.js +28 -0
  145. package/dist/utility/number-format.util.d.ts +14 -1
  146. package/dist/utility/number-format.util.js +50 -19
  147. package/dist/utility/options/option-symbol.util.d.ts +28 -0
  148. package/dist/utility/options/option-symbol.util.js +176 -0
  149. package/dist/utility/options/option-trade-units.util.d.ts +190 -0
  150. package/dist/utility/options/option-trade-units.util.js +283 -0
  151. package/dist/utility/options/option-venue.util.d.ts +75 -0
  152. package/dist/utility/options/option-venue.util.js +85 -0
  153. package/dist/utility/pool-symbol.leaf.d.ts +34 -0
  154. package/dist/utility/pool-symbol.leaf.js +95 -0
  155. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
  156. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
  157. package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
  158. package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
  159. package/dist/utility/v2/gate-plane.util.d.ts +58 -0
  160. package/dist/utility/v2/gate-plane.util.js +99 -0
  161. package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
  162. package/dist/utility/v2/gate-session-latch.util.js +34 -0
  163. package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
  164. package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
  165. package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
  166. package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
  167. package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
  168. package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
  169. package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
  170. package/dist/utility/wrun/sources/lanes/economic.js +79 -0
  171. package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
  172. package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
  173. package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
  174. package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
  175. package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
  176. package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
  177. package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
  178. package/dist/utility/wrun/sources/lanes/index.js +32 -0
  179. package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
  180. package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
  181. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
  182. package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
  183. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
  184. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
  185. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
  186. package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
  187. package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
  188. package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
  189. package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
  190. package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
  191. package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
  192. package/dist/utility/wrun/sources/lanes/series.js +321 -0
  193. package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
  194. package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
  195. package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
  196. package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
  197. package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
  198. package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
  199. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
  200. package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
  201. package/dist/utility/wrun/sources/registry.d.ts +21 -0
  202. package/dist/utility/wrun/sources/registry.js +207 -0
  203. package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
  204. package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
  205. package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
  206. package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
  207. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
  208. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
  209. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
  210. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
  211. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
  212. package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
  213. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
  214. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
  215. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
  216. package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
  217. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
  218. package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
  219. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
  220. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
  221. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
  222. package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
  223. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
  224. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
  225. package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
  226. package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
  227. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
  228. package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
  229. package/dist/utility/wrun/wrun-color-settings.util.js +1 -1
  230. package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
  231. package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
  232. package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
  233. package/dist/utility/wrun/wrun-deadline.util.js +82 -0
  234. package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
  235. package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
  236. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
  237. package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
  238. package/dist/utility/wrun/wrun-failure-cause.d.ts +39 -0
  239. package/dist/utility/wrun/wrun-failure-cause.js +94 -0
  240. package/dist/utility/wrun/wrun-frames.d.ts +28 -3
  241. package/dist/utility/wrun/wrun-frames.js +132 -52
  242. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +167 -4
  243. package/dist/utility/wrun/wrun-hosted-wire-caps.js +47 -2
  244. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +5 -2
  245. package/dist/utility/wrun/wrun-hosted-wire.util.js +4 -2
  246. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
  247. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
  248. package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
  249. package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
  250. package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
  251. package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
  252. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
  253. package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
  254. package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
  255. package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
  256. package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
  257. package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
  258. package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
  259. package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
  260. package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
  261. package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
  262. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
  263. package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
  264. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
  265. package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
  266. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +30 -0
  267. package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
  268. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
  269. package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
  270. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
  271. package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
  272. package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
  273. package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
  274. package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
  275. package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
  276. package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
  277. package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
  278. package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
  279. package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
  280. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
  281. package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
  282. package/dist/utility/wrun/wrun-pack.util.d.ts +6 -2
  283. package/dist/utility/wrun/wrun-pack.util.js +13 -3
  284. package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
  285. package/dist/utility/wrun/wrun-param-map.util.js +581 -0
  286. package/dist/utility/wrun/wrun-param-values.util.d.ts +8 -0
  287. package/dist/utility/wrun/wrun-param-values.util.js +8 -0
  288. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
  289. package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
  290. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
  291. package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
  292. package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
  293. package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
  294. package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
  295. package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
  296. package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
  297. package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
  298. package/dist/utility/wrun/wrun-refusal.util.d.ts +95 -7
  299. package/dist/utility/wrun/wrun-refusal.util.js +314 -18
  300. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
  301. package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
  302. package/dist/utility/wrun/wrun-render-select.util.js +1 -0
  303. package/dist/utility/wrun/wrun-row-market.util.d.ts +29 -0
  304. package/dist/utility/wrun/wrun-row-market.util.js +92 -0
  305. package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
  306. package/dist/utility/wrun/wrun-row-source.js +75 -0
  307. package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
  308. package/dist/utility/wrun/wrun-run-health.util.js +273 -0
  309. package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
  310. package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
  311. package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
  312. package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
  313. package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
  314. package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
  315. package/dist/utility/wrun/wrun-symbol-code.util.d.ts +32 -0
  316. package/dist/utility/wrun/wrun-symbol-code.util.js +56 -0
  317. package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
  318. package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
  319. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
  320. package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
  321. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
  322. package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
  323. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
  324. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
  325. package/dist/utility/wrun-display-name.util.d.ts +33 -0
  326. package/dist/utility/wrun-display-name.util.js +64 -0
  327. package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
  328. package/dist/workers/constants/kscript-transport-codes.js +15 -0
  329. package/dist/workers/constants/socket-slots.d.ts +574 -0
  330. package/dist/workers/constants/socket-slots.js +539 -0
  331. package/dist/workers/utils/number.worker.util.d.ts +5 -0
  332. package/dist/workers/utils/number.worker.util.js +10 -0
  333. package/dist/workers/utils/time.worker.util.d.ts +12 -0
  334. package/dist/workers/utils/time.worker.util.js +24 -0
  335. package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
  336. package/dist/workers/utils/volume-profile.worker.util.js +631 -0
  337. package/package.json +10 -4
@@ -0,0 +1,212 @@
1
+ import { historyReachMs } from '../chart/history-wall.util.js';
2
+ import { wrunChartHostEnv } from '../../host-env.js';
3
+ import { WRUN_LEG_HISTORY_CLAMPED_CODE } from './wrun-run-health.util.js';
4
+ /** The leg candles a candle leg coarser than the chart asks before the window's head: a reading
5
+ * seeded on the first candle it sees (an EMA over 1h closes on a 1m chart, whose window holds
6
+ * about ten of them) then starts from history instead of the head (A23). The wall still cuts
7
+ * it, silently. */
8
+ export const WRUN_COARSER_LEG_WARMUP_CANDLES = 200;
9
+ /** The chart's history wall for a leg asked at its own interval: now minus the gateway's reach
10
+ * at that interval. The free row is the reach every viewer has (free and plus share one row
11
+ * since tsdb-gateway cee00f2), so the clamp never asks past what a viewer is served. */
12
+ export function wrunChartLegReachMs(intervalKey, nowMs) {
13
+ return nowMs - historyReachMs('free', intervalKey);
14
+ }
15
+ /** The chart's clamp of one leg ask (`wrunServedLegStart`, the core's): where to ask, whether
16
+ * the wall cut candles off the plan, and the note naming the served start. `reachMs` defaults
17
+ * to the chart's gateway wall at the leg's interval. */
18
+ export function wrunChartLegServedStart(input) {
19
+ return wrunChartHostEnv()
20
+ .sharedHost()
21
+ .wrunServedLegStart({
22
+ inputName: input.inputName,
23
+ legMs: input.leg.legMs,
24
+ nowMs: input.nowMs,
25
+ askedStartMs: input.askedStartMs,
26
+ reachMs: input.reachMs ?? wrunChartLegReachMs(input.leg.intervalKey, input.nowMs),
27
+ });
28
+ }
29
+ /** The readings of a candle leg (`kind` absent: a period leg's scalar views, the `candles`
30
+ * streams and the live-candle readings it serves), in input order. An own-market `forming`
31
+ * view folds the primary rows, whose head bucket the pre-roll fetch covers
32
+ * (`planWrunFormingPreRoll`); the leg's own series keeps the confirmed two-span pre-roll for it
33
+ * (the om daemon's rule). */
34
+ export function wrunLegFetchReads(metadata, leg, wires) {
35
+ const reads = [];
36
+ const nameOf = (index) => metadata.inputs.find((input) => input.index === index)?.name ?? String(index);
37
+ for (const index of [...leg.inputIndexes].sort((a, b) => a - b)) {
38
+ const wire = wires.get(index);
39
+ if (wire === undefined)
40
+ continue;
41
+ if (wire.kind === 'candles' && wire.leg.fetchKey === leg.fetchKey) {
42
+ // The live candle (view "forming") asks only around the bucket holding now; the holding
43
+ // candle's open (view "forming_open") from the candle holding the head; the stream asks for
44
+ // its backlog. All read the leg's one fetch.
45
+ reads.push(wire.forming === true
46
+ ? { inputName: nameOf(index), reading: 'candles_forming' }
47
+ : wire.formingOpen === true
48
+ ? { inputName: nameOf(index), reading: 'candles_forming_open' }
49
+ : { inputName: nameOf(index), reading: 'candles', ...(wire.bars !== undefined ? { bars: wire.bars } : {}) });
50
+ }
51
+ else if (wire.kind === 'forming' && wire.leg.fetchKey === leg.fetchKey) {
52
+ reads.push({ inputName: nameOf(index), reading: 'confirmed' });
53
+ }
54
+ else if (wire.kind === 'period' && wire.leg.fetchKey === leg.fetchKey) {
55
+ const bars = wire.source.bars;
56
+ reads.push({
57
+ inputName: nameOf(index),
58
+ reading: wire.view,
59
+ ...(bars !== undefined ? { bars } : {}),
60
+ ...(wire.view === 'offset' ? { offset: wire.offset } : {}),
61
+ });
62
+ }
63
+ }
64
+ return reads;
65
+ }
66
+ /** A stream's reading (a `candles`, `oi_candles` or `volume_profile_candles` input: its backlog, the live candle, the
67
+ * open of the candle holding each row): it reads nothing before its own ask. */
68
+ function isStreamReading(read) {
69
+ return read.reading === 'candles' || read.reading === 'candles_forming' || read.reading === 'candles_forming_open';
70
+ }
71
+ /** A candle leg's fetch window start: every reading's `wrunLegFetchStart` over the head and the
72
+ * clock, each clamped at the wall (`wrunServedLegStart`), the earliest served start asked; on a
73
+ * leg coarser than the chart, no later than the warm-up floor (`WRUN_COARSER_LEG_WARMUP_CANDLES`
74
+ * leg candles before the head, cut at the wall without a note). An odds leg keeps its readings'
75
+ * ask (its fetch seeds and gap-fills the market's own history), and so does a leg every reading of
76
+ * which is a stream's (a `candles` or lane stream backlog, the live candle alone, the open of the
77
+ * candle holding each row): a stream reads nothing before its own ask. `reachMs` defaults to the chart's gateway
78
+ * wall at the leg's interval. */
79
+ export function planWrunLegFetch(input) {
80
+ const { leg, clock, headMs } = input;
81
+ const reachMs = input.reachMs ?? wrunChartLegReachMs(leg.intervalKey, clock.nowMs);
82
+ let askedFromTs = Number.POSITIVE_INFINITY;
83
+ let fromTs = Number.POSITIVE_INFINITY;
84
+ const clamped = [];
85
+ // Every planned candle leg has a reading; a bare leg asks like a confirmed view.
86
+ const reads = input.reads.length > 0 ? input.reads : [{ inputName: leg.intervalKey, reading: 'confirmed' }];
87
+ for (const read of reads) {
88
+ const askedStartMs = wrunChartHostEnv().sharedHost().wrunLegFetchStart({
89
+ reading: read.reading,
90
+ legMs: leg.legMs,
91
+ primaryMs: clock.intervalMs,
92
+ headMs,
93
+ nowMs: clock.nowMs,
94
+ bars: read.bars,
95
+ offset: read.offset,
96
+ });
97
+ const served = wrunChartLegServedStart({
98
+ inputName: read.inputName,
99
+ leg,
100
+ nowMs: clock.nowMs,
101
+ askedStartMs,
102
+ reachMs,
103
+ });
104
+ askedFromTs = Math.min(askedFromTs, askedStartMs);
105
+ fromTs = Math.min(fromTs, served.startMs);
106
+ if (served.note !== null)
107
+ clamped.push({ inputName: read.inputName, intervalKey: leg.intervalKey, note: served.note });
108
+ }
109
+ // A stream reads only what its own reading asks (a backlog from wrunLegFetchStart, the live candle, the forming
110
+ // open), so a leg every reading of which is a stream's asks no warm-up: a profile stream's candles carry whole row
111
+ // sets, and a floor it never delivers would hold thousands of rows for the session.
112
+ const warmsUp = leg.legMs > clock.intervalMs && leg.odds !== true && reads.some((read) => !isStreamReading(read));
113
+ if (!warmsUp)
114
+ return { askedFromTs, fromTs, clamped };
115
+ // The floor is served like any ask (the first whole candle at or after the wall), its note
116
+ // dropped: an input never asked for it, so the legend says nothing when the wall cuts it.
117
+ const warmUpFromTs = wrunChartLegServedStart({
118
+ inputName: leg.intervalKey,
119
+ leg,
120
+ nowMs: clock.nowMs,
121
+ askedStartMs: headMs - WRUN_COARSER_LEG_WARMUP_CANDLES * leg.legMs,
122
+ reachMs,
123
+ }).startMs;
124
+ return { askedFromTs, fromTs: Math.min(fromTs, warmUpFromTs), clamped, warmUpFromTs };
125
+ }
126
+ /** An intrabar leg's fetch, kScript's ltf() rule: the chart's window whole from its head (an
127
+ * exact slice of each row needs no pre-roll), never clamped before the ask. The engine asks an
128
+ * ltf() source over the window it runs and the gateway trims a request straddling the viewer's
129
+ * history wall to the entitled suffix, so the twin asks that same request: the same chunking (a
130
+ * window past KSCRIPT_SOURCE_CHUNK_MAX_PIECES goes out as one request, the original's shape,
131
+ * where a pre-clamp at the free wall left ~60 pieces that outlived the source deadline) and the
132
+ * history the viewer is entitled to (all of it on an account the wall does not cut). The wall's
133
+ * notes are planned here (`clamped`, the core's words; `wallFromTs`, where the wall serves from)
134
+ * and stand only when the answer starts at the wall (`wrunIntrabarServedNotes`). */
135
+ export function planWrunIntrabarLegFetch(input) {
136
+ const { leg, clock, headMs } = input;
137
+ const reachMs = input.reachMs ?? wrunChartLegReachMs(leg.intervalKey, clock.nowMs);
138
+ let wallFromTs;
139
+ const clamped = [];
140
+ // Every input on the leg asks the same head, so each served start is the same instant; each
141
+ // input the wall cut gets its own note.
142
+ for (const index of [...leg.inputIndexes].sort((a, b) => a - b)) {
143
+ const inputName = input.metadata.inputs.find((candidate) => candidate.index === index)?.name ?? String(index);
144
+ const served = wrunChartLegServedStart({ inputName, leg, nowMs: clock.nowMs, askedStartMs: headMs, reachMs });
145
+ if (served.note === null)
146
+ continue;
147
+ wallFromTs = served.startMs;
148
+ clamped.push({ inputName, intervalKey: leg.intervalKey, note: served.note });
149
+ }
150
+ return { askedFromTs: headMs, fromTs: headMs, clamped, ...(wallFromTs !== undefined ? { wallFromTs } : {}) };
151
+ }
152
+ /** How far before the planned wall an answer may start and still be the wall's cut: the gateway
153
+ * measures its wall from its own request time, so its trimmed edge lands a few candles either
154
+ * side of the planned one (the slack history-wall.util reads a plan wall with: three bars plus a
155
+ * minute of clock drift). */
156
+ const WRUN_INTRABAR_WALL_SLACK_CANDLES = 3;
157
+ const WRUN_INTRABAR_WALL_DRIFT_MS = 60_000;
158
+ /** The wall notes an intrabar ask keeps once answered (`planWrunIntrabarLegFetch`): the ask went
159
+ * out whole, so a note stands only when the answer starts at the wall the plan named (its first
160
+ * closed candle opens no earlier than `wallFromTs` less the slack), or answered nothing; an
161
+ * answer reaching past the wall (an account it does not cut) keeps none, as kScript's original
162
+ * says nothing there. */
163
+ export function wrunIntrabarServedNotes(plan, closedRows, legMs) {
164
+ if (plan.clamped.length === 0 || plan.wallFromTs === undefined)
165
+ return [];
166
+ let firstOpenMs = Number.POSITIVE_INFINITY;
167
+ for (const row of closedRows) {
168
+ const openMs = Number(row[0]);
169
+ if (Number.isFinite(openMs) && openMs < firstOpenMs)
170
+ firstOpenMs = openMs;
171
+ }
172
+ const slackMs = WRUN_INTRABAR_WALL_SLACK_CANDLES * legMs + WRUN_INTRABAR_WALL_DRIFT_MS;
173
+ return firstOpenMs >= plan.wallFromTs - slackMs ? [...plan.clamped] : [];
174
+ }
175
+ /** The own-market `forming` pre-roll's ask: the earliest head bucket open over the views
176
+ * (`wrunLegFetchStart` reading "forming"), or undefined when nothing needs one (no such view,
177
+ * or every head bucket opens at the head). Undefined too when that bucket opens behind the
178
+ * wall (`reachMs`, default the chart's gateway wall at the chart interval): a bucket the
179
+ * gateway cannot serve whole stays NaN until a pan-back, never folded partial. */
180
+ export function planWrunFormingPreRoll(input) {
181
+ const { clock, headMs } = input;
182
+ let fromTs = Number.POSITIVE_INFINITY;
183
+ for (const wire of input.wires.values()) {
184
+ if (wire.kind !== 'forming' || wire.gridLeg !== undefined)
185
+ continue;
186
+ fromTs = Math.min(fromTs, wrunChartHostEnv().sharedHost().wrunLegFetchStart({
187
+ reading: 'forming',
188
+ legMs: wire.legMs,
189
+ primaryMs: clock.intervalMs,
190
+ headMs,
191
+ nowMs: clock.nowMs,
192
+ }));
193
+ }
194
+ if (!(fromTs < headMs))
195
+ return undefined;
196
+ const reachMs = input.reachMs ?? wrunChartLegReachMs(input.chartIntervalKey, clock.nowMs);
197
+ return fromTs >= reachMs ? fromTs : undefined;
198
+ }
199
+ /** One warning row per input whose leg ask the history wall cut: the core's note (asked N
200
+ * candles from a date; history served from a date), the run drawn from what was served. */
201
+ export function wrunClampedLegDiagnostics(legs) {
202
+ return legs.map((leg) => ({
203
+ stage: 'compute',
204
+ severity: 'warning',
205
+ code: WRUN_LEG_HISTORY_CLAMPED_CODE,
206
+ type: 'execution',
207
+ // The leg core's note verbatim: the same words the om daemon puts on its rows.
208
+ message: leg.note,
209
+ suggestedFix: `The chart's data reaches no further back at ${leg.intervalKey}: read fewer candles (a smaller bars), or treat the periods before the served start as absent.`,
210
+ details: { input: leg.inputName, interval: leg.intervalKey, note: leg.note },
211
+ }));
212
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The leg STREAM classes: the celled classes that deliver one leg's CLOSED candles of an interval as a
3
+ * cell stream (the shared host's leg stream, `WrunCandleStream` and the kit's per-class row mappers: the
4
+ * backlog on the first delivered row, as far back as `bars`, then the candles admitted since, never a
5
+ * forming candle, never truncated). One row per class; every reader of "is this a leg stream" reads this
6
+ * table, so a fourth stream class is one row here.
7
+ *
8
+ * - `candles`: the leg's price candles, `[offset_ms, open, high, low, close, volume]`, over the chart's
9
+ * candle lane (`ohlcv`); the one class with views ("forming", "forming_open").
10
+ * - `oi_candles`: the leg's open-interest candles, `[offset_ms, open, high, low, close]`, over the
11
+ * `open_interest` lane, in the market's native units (coins or contracts) unless the input names
12
+ * `currency: "USD"`.
13
+ * - `volume_profile_candles`: one closed candle's price rows, `[offset_ms, low, high, buy, sell]` per row
14
+ * (the rows of one candle share `offset_ms`, ascending by price), over the `volume_profile` lane at the
15
+ * input's `ticks_per_bar` and `currency` (coins unless "USD"); `max_cells` is required (a block's size is
16
+ * rows per candle times the candles it carries, which the editor cannot know).
17
+ *
18
+ * The tuple widths are the shared host's (`WRUN_HOST_CELL_TUPLE_WIDTHS`), never copied here.
19
+ *
20
+ * A LEAF on purpose: no imports, erasable TypeScript only, so the socket worker and the Node scripts can
21
+ * read it. The two script-run leaves that cannot import (`wrun-browser-sources.leaf.ts`,
22
+ * `wrun-template-refusal.ts`) and the chart-host package (`wrun-refusal.util.ts` LEG_CLASSES) hand-copy the
23
+ * names; `tests/utility/wrun/wrun-leg-stream-classes.spec.ts` holds every copy and every special case to
24
+ * this table, and the table to the installed kit's leg-clocked celled classes.
25
+ * See docs/features/kscript/wrun/wrun-browser-runtime.md ("Leg history").
26
+ */
27
+ /** A leg stream class word, as a sheet's `source` spells it. */
28
+ export type WrunLegStreamClassName = 'candles' | 'oi_candles' | 'volume_profile_candles';
29
+ /** A leg stream class that reads a lane other than the chart's candles (its own fetch type and knobs). */
30
+ export type WrunLaneStreamClassName = Exclude<WrunLegStreamClassName, 'candles'>;
31
+ /** One stream class: the lane its leg rides and the words its refusals use. */
32
+ export interface WrunLegStreamClass {
33
+ /** The chart fetch type (the kScript data control `dataFetch` asks) the leg is fetched through. */
34
+ readonly fetchType: 'ohlcv' | 'open_interest' | 'volume_profile';
35
+ /** The gateway data type that fetch reads (the requirement row's market fact). */
36
+ readonly gatewayType: string;
37
+ /** What one candle of the leg is, in a label or a refusal ("Pinned 1h <noun>"). */
38
+ readonly noun: string;
39
+ /** The views the class takes beside the stream of closed candles (none but candles' two). */
40
+ readonly views: readonly string[];
41
+ /** The lane words the class takes beyond the stream's own knobs (interval, bars, max_cells, a whole
42
+ * market pin, chart_interval_below). */
43
+ readonly laneWords: ReadonlyArray<'currency' | 'ticks_per_bar'>;
44
+ /** The quote a leg reads when the input names no `currency` (a class without the word reads its lane's
45
+ * only quote). */
46
+ readonly defaultCurrency?: 'USD' | 'Coin';
47
+ /** `max_cells` must be declared: no editor fill can size a block of this class. */
48
+ readonly maxCellsRequired: boolean;
49
+ }
50
+ /** Every leg stream class, keyed by its word. */
51
+ export declare const WRUN_LEG_STREAM_CLASSES: Readonly<Record<WrunLegStreamClassName, WrunLegStreamClass>>;
52
+ /** The stream class words, in the table's order. */
53
+ export declare const WRUN_LEG_STREAM_CLASS_NAMES: readonly WrunLegStreamClassName[];
54
+ /** Whether a source class word is a leg stream class. */
55
+ export declare function isWrunLegStreamClass(value: unknown): value is WrunLegStreamClassName;
56
+ /** Whether a source class word is a leg stream class over a lane of its own (not the chart's candles). */
57
+ export declare function isWrunLaneStreamClass(value: unknown): value is WrunLaneStreamClassName;
58
+ /** The lane identity of one lane-stream leg: the class and the lane words its fetch carries (one fetch
59
+ * per class, market, interval and identity; two inputs with the same identity share it). */
60
+ export interface WrunLegStreamLane {
61
+ class: WrunLaneStreamClassName;
62
+ /** The quote the lane is asked in: "USD" (dollars) or "Coin" (the market's native units). */
63
+ currency: 'USD' | 'Coin';
64
+ /** `volume_profile_candles` only: the price ticks one row spans (1..500, normalized). */
65
+ ticksPerBar?: number;
66
+ }
67
+ /** A lane stream's quote: "USD" only when the input says so, else the class's default. */
68
+ export declare function wrunLegStreamCurrency(streamClass: WrunLaneStreamClassName, currency: unknown): 'USD' | 'Coin';
69
+ /** The fetch-key words a lane stream adds to its leg's key: the class, then its lane identity. */
70
+ export declare function wrunLegStreamKeyWords(lane: WrunLegStreamLane): string;
71
+ /** The payload words a lane stream's fetch carries (the kScript data control's settings: `currency` for
72
+ * the open-interest and volume-profile controls, `ticksPerBar` for the profile's). */
73
+ export declare function wrunLegStreamPayloadWords(lane: WrunLegStreamLane): Record<string, unknown>;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The leg STREAM classes: the celled classes that deliver one leg's CLOSED candles of an interval as a
3
+ * cell stream (the shared host's leg stream, `WrunCandleStream` and the kit's per-class row mappers: the
4
+ * backlog on the first delivered row, as far back as `bars`, then the candles admitted since, never a
5
+ * forming candle, never truncated). One row per class; every reader of "is this a leg stream" reads this
6
+ * table, so a fourth stream class is one row here.
7
+ *
8
+ * - `candles`: the leg's price candles, `[offset_ms, open, high, low, close, volume]`, over the chart's
9
+ * candle lane (`ohlcv`); the one class with views ("forming", "forming_open").
10
+ * - `oi_candles`: the leg's open-interest candles, `[offset_ms, open, high, low, close]`, over the
11
+ * `open_interest` lane, in the market's native units (coins or contracts) unless the input names
12
+ * `currency: "USD"`.
13
+ * - `volume_profile_candles`: one closed candle's price rows, `[offset_ms, low, high, buy, sell]` per row
14
+ * (the rows of one candle share `offset_ms`, ascending by price), over the `volume_profile` lane at the
15
+ * input's `ticks_per_bar` and `currency` (coins unless "USD"); `max_cells` is required (a block's size is
16
+ * rows per candle times the candles it carries, which the editor cannot know).
17
+ *
18
+ * The tuple widths are the shared host's (`WRUN_HOST_CELL_TUPLE_WIDTHS`), never copied here.
19
+ *
20
+ * A LEAF on purpose: no imports, erasable TypeScript only, so the socket worker and the Node scripts can
21
+ * read it. The two script-run leaves that cannot import (`wrun-browser-sources.leaf.ts`,
22
+ * `wrun-template-refusal.ts`) and the chart-host package (`wrun-refusal.util.ts` LEG_CLASSES) hand-copy the
23
+ * names; `tests/utility/wrun/wrun-leg-stream-classes.spec.ts` holds every copy and every special case to
24
+ * this table, and the table to the installed kit's leg-clocked celled classes.
25
+ * See docs/features/kscript/wrun/wrun-browser-runtime.md ("Leg history").
26
+ */
27
+ /** Every leg stream class, keyed by its word. */
28
+ export const WRUN_LEG_STREAM_CLASSES = Object.freeze({
29
+ candles: Object.freeze({
30
+ fetchType: 'ohlcv',
31
+ gatewayType: 'TRADE_SIDE_AGNOSTIC_AGG',
32
+ noun: 'candle',
33
+ views: Object.freeze(['forming', 'forming_open']),
34
+ laneWords: Object.freeze([]),
35
+ maxCellsRequired: false,
36
+ }),
37
+ oi_candles: Object.freeze({
38
+ fetchType: 'open_interest',
39
+ gatewayType: 'OPEN_INTEREST_AGG',
40
+ noun: 'open interest candle',
41
+ views: Object.freeze([]),
42
+ laneWords: Object.freeze(['currency']),
43
+ defaultCurrency: 'Coin',
44
+ maxCellsRequired: false,
45
+ }),
46
+ volume_profile_candles: Object.freeze({
47
+ fetchType: 'volume_profile',
48
+ gatewayType: 'VOLUME_PROFILE_AGG',
49
+ noun: 'volume profile candle',
50
+ views: Object.freeze([]),
51
+ laneWords: Object.freeze(['currency', 'ticks_per_bar']),
52
+ defaultCurrency: 'Coin',
53
+ maxCellsRequired: true,
54
+ }),
55
+ });
56
+ /** The stream class words, in the table's order. */
57
+ export const WRUN_LEG_STREAM_CLASS_NAMES = Object.freeze(Object.keys(WRUN_LEG_STREAM_CLASSES));
58
+ /** Whether a source class word is a leg stream class. */
59
+ export function isWrunLegStreamClass(value) {
60
+ return typeof value === 'string' && Object.prototype.hasOwnProperty.call(WRUN_LEG_STREAM_CLASSES, value);
61
+ }
62
+ /** Whether a source class word is a leg stream class over a lane of its own (not the chart's candles). */
63
+ export function isWrunLaneStreamClass(value) {
64
+ return isWrunLegStreamClass(value) && value !== 'candles';
65
+ }
66
+ /** A lane stream's quote: "USD" only when the input says so, else the class's default. */
67
+ export function wrunLegStreamCurrency(streamClass, currency) {
68
+ if (currency === 'USD')
69
+ return 'USD';
70
+ if (currency === 'Coin')
71
+ return 'Coin';
72
+ return WRUN_LEG_STREAM_CLASSES[streamClass].defaultCurrency ?? 'USD';
73
+ }
74
+ /** The fetch-key words a lane stream adds to its leg's key: the class, then its lane identity. */
75
+ export function wrunLegStreamKeyWords(lane) {
76
+ const ticks = lane.ticksPerBar !== undefined ? `|ticks=${lane.ticksPerBar}` : '';
77
+ return `${lane.class}|currency=${lane.currency}${ticks}`;
78
+ }
79
+ /** The payload words a lane stream's fetch carries (the kScript data control's settings: `currency` for
80
+ * the open-interest and volume-profile controls, `ticksPerBar` for the profile's). */
81
+ export function wrunLegStreamPayloadWords(lane) {
82
+ return {
83
+ currency: lane.currency,
84
+ ...(lane.ticksPerBar !== undefined ? { ticksPerBar: lane.ticksPerBar } : {}),
85
+ };
86
+ }
@@ -10,7 +10,11 @@
10
10
  * unresolved (a theme token rides to the mount door) and every font word
11
11
  * resolved to its CSS stack (X14: the engine never sees a font word). The
12
12
  * run-result translator calls them per level, after `wrunSharedLevelsScale`
13
- * once per run (DL-scale "shared").
13
+ * once per run (DL-scale "shared"). Both are one builder over a layout,
14
+ * the pane frame or the spans (WRUN-OI-PROFILE D6): a word reaches both
15
+ * children unless `WRUN_LEVELS_WORD_REACH` says it is a pane word, and
16
+ * each span's own value area, POC price and tag ride in titan's
17
+ * `span_levels`, keyed by the span's bounds.
14
18
  * - `checkWrunLevelsFrame` restates the kit's `validateWrunLevelsFrame`
15
19
  * cross-checks (X22) for the render selection, refused as
16
20
  * `wrun_frame_invalid`.
@@ -69,6 +73,26 @@ export type WrunLevelsChildOverlay = {
69
73
  panel?: 'lower';
70
74
  hover?: WrunLevelsHoverRow[];
71
75
  };
76
+ /** One profile's own levels, the pane frame's or one span's: its POC price
77
+ * and tag text and its value area's low and high, each when the group
78
+ * carries it. The pane child sends them as door keys; the spans child sends
79
+ * them per span in titan's `span_levels` (D6). */
80
+ export interface WrunLevelsSpanLevels {
81
+ poc_price?: number;
82
+ poc_label_text?: string;
83
+ value_area_low?: number;
84
+ value_area_high?: number;
85
+ }
86
+ /** One `span_levels` entry: a span's own levels keyed by the span's bounds
87
+ * in ms, the rows' cells 4 and 5 (the engine matches an entry to its span
88
+ * by that exact pair). A span without levels of its own has no entry and
89
+ * reads the record's, and a spans frame carries none at record level, so
90
+ * it keeps the engine's own rule (the largest row is the POC, the tag reads
91
+ * "POC", no value area). */
92
+ export interface WrunLevelsSpanLevelsEntry extends WrunLevelsSpanLevels {
93
+ start: number;
94
+ end: number;
95
+ }
72
96
  /** The child id of a levels declaration (`<parent>::levels:<name>`, the id
73
97
  * panel-mount gives every docked child). */
74
98
  export declare function wrunLevelsChildId(overlayId: string, name: string): string;
@@ -79,6 +103,72 @@ export declare function wrunLevelsChildId(overlayId: string, name: string): stri
79
103
  export declare function wrunLevelsLowerPaneId(overlayId: string): string;
80
104
  /** True for the spans shape of a parsed levels frame. */
81
105
  export declare function isWrunLevelsSpansFrame(frame: unknown): frame is WrunLevelsSpansFrame;
106
+ /** Where a `plot.levels` word reaches the engine: on both children (the
107
+ * pane dock and a span "time" level), or on the pane dock only. */
108
+ export type WrunLevelsWordReach = 'both' | 'pane';
109
+ /**
110
+ * Every `plot.levels` word (the sheet's `levels[]` keys) and where it
111
+ * reaches (D6). The pane child and the spans child are one builder
112
+ * (`levelsChildOf`), so a word reaches both unless this table says `pane`:
113
+ * the words that place, size or band a dock on the pane edge. `offset`
114
+ * (`offset_px`) and `beside` place it, `width_px` sizes it (a span takes
115
+ * `width_frac` of its own width) and `step` bands its rows (cells 4 and 5 of
116
+ * a span row hold the span's bounds). `scale` reaches both, but "shared"
117
+ * compares docks on the pane across the run, so a span keeps its own
118
+ * maximum ("fixed" reaches both). The typecheck refuses a word the
119
+ * declaration type gains until it has a row here, and
120
+ * tests/utility/wrun/wrun-levels-child.reach.spec.ts builds both children
121
+ * with every word and pins what each one sends.
122
+ */
123
+ export declare const WRUN_LEVELS_WORD_REACH: {
124
+ readonly name: "both";
125
+ readonly frame: "both";
126
+ readonly dock: "both";
127
+ readonly width_frac: "both";
128
+ readonly poc: "both";
129
+ readonly labels: "both";
130
+ readonly color: "both";
131
+ readonly panel: "both";
132
+ readonly behind_candles: "both";
133
+ readonly opacity: "both";
134
+ readonly baseline: "both";
135
+ readonly series: "both";
136
+ readonly step: "pane";
137
+ readonly thickness_px: "both";
138
+ readonly width_px: "pane";
139
+ readonly scale: "both";
140
+ readonly scale_max: "both";
141
+ readonly offset: "pane";
142
+ readonly beside: "pane";
143
+ readonly format: "both";
144
+ readonly decimals: "both";
145
+ readonly signed: "both";
146
+ readonly unit: "both";
147
+ readonly text_color: "both";
148
+ readonly font_size: "both";
149
+ readonly font_weight: "both";
150
+ readonly font_family: "both";
151
+ readonly label_place: "both";
152
+ readonly hover: "both";
153
+ readonly poc_color: "both";
154
+ readonly poc_width: "both";
155
+ readonly poc_line_style: "both";
156
+ readonly poc_extend: "both";
157
+ readonly poc_label: "both";
158
+ readonly outside_opacity: "both";
159
+ readonly value_area_color: "both";
160
+ readonly value_area_width: "both";
161
+ readonly value_area_line_style: "both";
162
+ readonly value_area_labels: "both";
163
+ readonly tag_place: "both";
164
+ readonly gradient: "both";
165
+ readonly gradient_direction: "both";
166
+ readonly border_color: "both";
167
+ readonly border_width: "both";
168
+ readonly border_style: "both";
169
+ readonly shape: "both";
170
+ readonly span: "both";
171
+ };
82
172
  /**
83
173
  * The docked child of one `plot.levels` declaration over its pane frame
84
174
  * (span "pane"): rows on row contract v2 and every door key of g2, colour
@@ -87,9 +177,12 @@ export declare function isWrunLevelsSpansFrame(frame: unknown): frame is WrunLev
87
177
  export declare function wrunLevelsChild(level: WrunLevelsDeclaration, frame: WrunLevelsFrame | null | undefined, ctx: WrunLevelsChildContext): WrunLevelsChildOverlay | null;
88
178
  /**
89
179
  * The docked child of a span "time" declaration (DL-time-anchored): every
90
- * span's rows concatenated as `[price, value, color?, label?, startMs,
91
- * endMs]`, settings `span: 'time'` beside today's levels settings and the
92
- * shared paint keys. Null without a frame.
180
+ * span's rows as `[price, value, color, label, startMs, endMs, seg_0 ..]`
181
+ * in frame order (the segments when a span carries `series`: drawnSeries),
182
+ * settings `span: 'time'` beside every word the pane child
183
+ * sends except the pane-only ones (D6, `WRUN_LEVELS_WORD_REACH`), each
184
+ * span's own value area, POC price and tag in `span_levels`, keyed by the
185
+ * span's bounds. Null without a frame.
93
186
  */
94
187
  export declare function wrunLevelsSpansChild(level: WrunLevelsDeclaration, frame: WrunLevelsSpansFrame | null | undefined, ctx: WrunLevelsChildContext): WrunLevelsChildOverlay | null;
95
188
  /**
@@ -103,8 +196,10 @@ export declare function wrunSharedLevelsScale(levels: ReadonlyArray<WrunLevelsDe
103
196
  * The declaration cross-checks of a parsed levels frame (the kit's
104
197
  * `validateWrunLevelsFrame`, restated per X22 with its messages): the shape
105
198
  * the level's `span` takes (DL-time-anchored), `series` against the declared
106
- * series and `colors` beside `series` (DL-stacked), `scale_max` needing scale
107
- * "fixed" (DL-scale). Throws `wrun_frame_invalid: slot '<slot>': <message>`.
199
+ * series and `colors` beside `series` (DL-stacked, per span on the spans
200
+ * shape, where every span carries `series` or none does), `scale_max`
201
+ * needing scale "fixed" (DL-scale). Throws
202
+ * `wrun_frame_invalid: slot '<slot>': <message>`.
108
203
  */
109
204
  export declare function checkWrunLevelsFrame(level: WrunLevelsDeclaration, frame: WrunLevelsFrame | WrunLevelsSpansFrame, slot: string): void;
110
205
  /**