@orangecharts/wrun-chart-host 0.2.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 (320) hide show
  1. package/README.md +14 -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 +128 -0
  32. package/dist/index.js +128 -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/opra-read-access.leaf.d.ts +26 -0
  117. package/dist/utility/chart/opra-read-access.leaf.js +25 -0
  118. package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
  119. package/dist/utility/chart/prediction-identity.util.js +236 -0
  120. package/dist/utility/chart/rth-session.util.d.ts +352 -0
  121. package/dist/utility/chart/rth-session.util.js +926 -0
  122. package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
  123. package/dist/utility/chart/titan-constants.pin.js +50 -0
  124. package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
  125. package/dist/utility/chart/us-equities-session.util.js +251 -0
  126. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
  127. package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
  128. package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
  129. package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
  130. package/dist/utility/common/safe-math-eval.d.ts +18 -0
  131. package/dist/utility/common/safe-math-eval.js +160 -0
  132. package/dist/utility/common/time.util.d.ts +134 -0
  133. package/dist/utility/common/time.util.js +428 -0
  134. package/dist/utility/common/transformations.util.d.ts +126 -0
  135. package/dist/utility/common/transformations.util.js +711 -0
  136. package/dist/utility/common/visible-timeout.util.d.ts +17 -0
  137. package/dist/utility/common/visible-timeout.util.js +75 -0
  138. package/dist/utility/exchange-normalization.util.d.ts +8 -0
  139. package/dist/utility/exchange-normalization.util.js +32 -0
  140. package/dist/utility/intl-locale.util.d.ts +2 -0
  141. package/dist/utility/intl-locale.util.js +28 -0
  142. package/dist/utility/number-format.util.d.ts +14 -1
  143. package/dist/utility/number-format.util.js +50 -19
  144. package/dist/utility/options/option-symbol.util.d.ts +28 -0
  145. package/dist/utility/options/option-symbol.util.js +176 -0
  146. package/dist/utility/options/option-trade-units.util.d.ts +190 -0
  147. package/dist/utility/options/option-trade-units.util.js +283 -0
  148. package/dist/utility/options/option-venue.util.d.ts +75 -0
  149. package/dist/utility/options/option-venue.util.js +85 -0
  150. package/dist/utility/pool-symbol.leaf.d.ts +34 -0
  151. package/dist/utility/pool-symbol.leaf.js +95 -0
  152. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
  153. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
  154. package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
  155. package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
  156. package/dist/utility/v2/gate-plane.util.d.ts +58 -0
  157. package/dist/utility/v2/gate-plane.util.js +99 -0
  158. package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
  159. package/dist/utility/v2/gate-session-latch.util.js +34 -0
  160. package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
  161. package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
  162. package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
  163. package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
  164. package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
  165. package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
  166. package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
  167. package/dist/utility/wrun/sources/lanes/economic.js +79 -0
  168. package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
  169. package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
  170. package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
  171. package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
  172. package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
  173. package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
  174. package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
  175. package/dist/utility/wrun/sources/lanes/index.js +32 -0
  176. package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
  177. package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
  178. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
  179. package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
  180. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
  181. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
  182. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
  183. package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
  184. package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
  185. package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
  186. package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
  187. package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
  188. package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
  189. package/dist/utility/wrun/sources/lanes/series.js +321 -0
  190. package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
  191. package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
  192. package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
  193. package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
  194. package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
  195. package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
  196. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
  197. package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
  198. package/dist/utility/wrun/sources/registry.d.ts +21 -0
  199. package/dist/utility/wrun/sources/registry.js +207 -0
  200. package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
  201. package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
  202. package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
  203. package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
  204. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
  205. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
  206. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
  207. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
  208. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
  209. package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
  210. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
  211. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
  212. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
  213. package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
  214. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
  215. package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
  216. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
  217. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
  218. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
  219. package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
  220. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
  221. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
  222. package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
  223. package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
  224. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
  225. package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
  226. package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
  227. package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
  228. package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
  229. package/dist/utility/wrun/wrun-deadline.util.js +82 -0
  230. package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
  231. package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
  232. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
  233. package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
  234. package/dist/utility/wrun/wrun-frames.d.ts +20 -1
  235. package/dist/utility/wrun/wrun-frames.js +103 -49
  236. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  237. package/dist/utility/wrun/wrun-hosted-wire-caps.js +27 -0
  238. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
  239. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
  240. package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
  241. package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
  242. package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
  243. package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
  244. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
  245. package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
  246. package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
  247. package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
  248. package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
  249. package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
  250. package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
  251. package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
  252. package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
  253. package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
  254. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
  255. package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
  256. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
  257. package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
  258. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +30 -0
  259. package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
  260. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
  261. package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
  262. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
  263. package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
  264. package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
  265. package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
  266. package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
  267. package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
  268. package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
  269. package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
  270. package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
  271. package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
  272. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
  273. package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
  274. package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
  275. package/dist/utility/wrun/wrun-param-map.util.js +581 -0
  276. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
  277. package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
  278. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
  279. package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
  280. package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
  281. package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
  282. package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
  283. package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
  284. package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
  285. package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
  286. package/dist/utility/wrun/wrun-refusal.util.d.ts +41 -1
  287. package/dist/utility/wrun/wrun-refusal.util.js +69 -2
  288. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
  289. package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
  290. package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
  291. package/dist/utility/wrun/wrun-row-source.js +75 -0
  292. package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
  293. package/dist/utility/wrun/wrun-run-health.util.js +273 -0
  294. package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
  295. package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
  296. package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
  297. package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
  298. package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
  299. package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
  300. package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
  301. package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
  302. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
  303. package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
  304. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
  305. package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
  306. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
  307. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
  308. package/dist/utility/wrun-display-name.util.d.ts +33 -0
  309. package/dist/utility/wrun-display-name.util.js +64 -0
  310. package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
  311. package/dist/workers/constants/kscript-transport-codes.js +15 -0
  312. package/dist/workers/constants/socket-slots.d.ts +574 -0
  313. package/dist/workers/constants/socket-slots.js +539 -0
  314. package/dist/workers/utils/number.worker.util.d.ts +5 -0
  315. package/dist/workers/utils/number.worker.util.js +10 -0
  316. package/dist/workers/utils/time.worker.util.d.ts +12 -0
  317. package/dist/workers/utils/time.worker.util.js +24 -0
  318. package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
  319. package/dist/workers/utils/volume-profile.worker.util.js +631 -0
  320. package/package.json +10 -4
@@ -0,0 +1,5 @@
1
+ /** Exchanges with enabled blk catalog, history and live routing. */
2
+ export declare function isBlkExchange(exchange: unknown): boolean;
3
+ /** A mixed-source request must be split by its caller, never silently sent to blk. */
4
+ export declare function isBlkReaderExchange(exchange: unknown): boolean;
5
+ export declare const BLK_BAR_CACHE_SHAPE = "blk-native-quote-v1";
@@ -0,0 +1,12 @@
1
+ /** Exchanges with enabled blk catalog, history and live routing. */
2
+ export function isBlkExchange(exchange) {
3
+ return exchange === 'SOLANA_ONCHAIN' || exchange === 172;
4
+ }
5
+ /** A mixed-source request must be split by its caller, never silently sent to blk. */
6
+ export function isBlkReaderExchange(exchange) {
7
+ if (Array.isArray(exchange) && exchange.some(isBlkExchange) && !exchange.every(isBlkExchange)) {
8
+ throw new Error('Reader requests spanning blk and ore must be split by exchange');
9
+ }
10
+ return Array.isArray(exchange) ? exchange.length > 0 && exchange.every(isBlkExchange) : isBlkExchange(exchange);
11
+ }
12
+ export const BLK_BAR_CACHE_SHAPE = 'blk-native-quote-v1';
@@ -0,0 +1,32 @@
1
+ export declare const CHART_LOAD_PHASES: readonly ["idle", "cached-paint", "candle-backfill-pending", "candle-in-flight", "indicator-backfill-pending", "retrying", "stalled"];
2
+ export type ChartLoadPhase = (typeof CHART_LOAD_PHASES)[number];
3
+ export declare const IDLE_CHART_LOAD_PHASE: ChartLoadPhase;
4
+ export type ChartLoadPhaseSignal = Extract<ChartLoadPhase, 'retrying' | 'stalled'>;
5
+ export declare function makeChartLoadPhaseState(): ChartLoadPhase[];
6
+ /**
7
+ * The derived load phase depends on signals that live outside LoadingTracker's
8
+ * operation ledger: the lazy-main refcount, the pending indicator wave, and the
9
+ * cache-paint set. Those modules cannot import LoadingTrackerService (it already
10
+ * imports them), so they announce changes through this listener registry and the
11
+ * tracker subscribes to re-derive and republish the chart's phase. Without this,
12
+ * diagnostics go stale between operation events (e.g. releaseLazyMainLoad flips
13
+ * the refcount with no accompanying operation event).
14
+ */
15
+ type ChartLoadPhaseInputListener = (chartIndex: number) => void;
16
+ export declare function onChartLoadPhaseInputChanged(listener: ChartLoadPhaseInputListener): () => void;
17
+ export declare function notifyChartLoadPhaseInputChanged(chartIndex: number): void;
18
+ export declare function setChartLoadPhaseSignal(chartIndex: number, phase: ChartLoadPhaseSignal): void;
19
+ export declare function clearChartLoadPhaseSignal(chartIndex: number): void;
20
+ /**
21
+ * Owner-scoped raise (data-loading discipline 2: a feature path reports a
22
+ * signal, never sets the status). The interval switch raises 'retrying' and
23
+ * 'stalled' with its AbortSignal as the owner; a newer owner's raise takes the
24
+ * chart over, after which the older owner's lower returns false and retracts
25
+ * nothing. Callers refresh the derived phase after a raise or lower.
26
+ */
27
+ export declare function raiseOwnedChartLoadPhaseSignal(chartIndex: number, phase: ChartLoadPhaseSignal, owner: object): void;
28
+ /** Lowers the chart's signal when `owner` still holds it; false when another owner took it or none is up. */
29
+ export declare function lowerOwnedChartLoadPhaseSignal(chartIndex: number, owner: object): boolean;
30
+ export declare function getChartLoadPhaseSignalOwner(chartIndex: number): object | undefined;
31
+ export declare function getChartLoadPhaseSignal(chartIndex: number): ChartLoadPhaseSignal | undefined;
32
+ export {};
@@ -0,0 +1,78 @@
1
+ import { MAX_CHARTS } from '../../constants/common.constants.js';
2
+ export const CHART_LOAD_PHASES = [
3
+ 'idle',
4
+ 'cached-paint',
5
+ 'candle-backfill-pending',
6
+ 'candle-in-flight',
7
+ 'indicator-backfill-pending',
8
+ 'retrying',
9
+ 'stalled',
10
+ ];
11
+ export const IDLE_CHART_LOAD_PHASE = 'idle';
12
+ export function makeChartLoadPhaseState() {
13
+ return Array(MAX_CHARTS).fill(IDLE_CHART_LOAD_PHASE);
14
+ }
15
+ const phaseInputListeners = new Set();
16
+ const chartLoadPhaseSignals = new Map();
17
+ // The owner of a chart's signal (the interval switch's AbortSignal): only that
18
+ // owner, or an un-owned write, can take the signal down again. An un-owned
19
+ // write forgets the owner, so a later owned lower is a no-op instead of
20
+ // retracting a label the boot ladder raised.
21
+ const chartLoadPhaseSignalOwners = new Map();
22
+ export function onChartLoadPhaseInputChanged(listener) {
23
+ phaseInputListeners.add(listener);
24
+ return () => {
25
+ phaseInputListeners.delete(listener);
26
+ };
27
+ }
28
+ export function notifyChartLoadPhaseInputChanged(chartIndex) {
29
+ for (const listener of phaseInputListeners) {
30
+ try {
31
+ listener(chartIndex);
32
+ }
33
+ catch {
34
+ // A listener must never break the signal source that triggered it.
35
+ }
36
+ }
37
+ }
38
+ function writeChartLoadPhaseSignal(chartIndex, phase) {
39
+ if (chartLoadPhaseSignals.get(chartIndex) === phase)
40
+ return;
41
+ chartLoadPhaseSignals.set(chartIndex, phase);
42
+ notifyChartLoadPhaseInputChanged(chartIndex);
43
+ }
44
+ export function setChartLoadPhaseSignal(chartIndex, phase) {
45
+ chartLoadPhaseSignalOwners.delete(chartIndex);
46
+ writeChartLoadPhaseSignal(chartIndex, phase);
47
+ }
48
+ export function clearChartLoadPhaseSignal(chartIndex) {
49
+ chartLoadPhaseSignalOwners.delete(chartIndex);
50
+ if (!chartLoadPhaseSignals.has(chartIndex))
51
+ return;
52
+ chartLoadPhaseSignals.delete(chartIndex);
53
+ notifyChartLoadPhaseInputChanged(chartIndex);
54
+ }
55
+ /**
56
+ * Owner-scoped raise (data-loading discipline 2: a feature path reports a
57
+ * signal, never sets the status). The interval switch raises 'retrying' and
58
+ * 'stalled' with its AbortSignal as the owner; a newer owner's raise takes the
59
+ * chart over, after which the older owner's lower returns false and retracts
60
+ * nothing. Callers refresh the derived phase after a raise or lower.
61
+ */
62
+ export function raiseOwnedChartLoadPhaseSignal(chartIndex, phase, owner) {
63
+ chartLoadPhaseSignalOwners.set(chartIndex, owner);
64
+ writeChartLoadPhaseSignal(chartIndex, phase);
65
+ }
66
+ /** Lowers the chart's signal when `owner` still holds it; false when another owner took it or none is up. */
67
+ export function lowerOwnedChartLoadPhaseSignal(chartIndex, owner) {
68
+ if (chartLoadPhaseSignalOwners.get(chartIndex) !== owner)
69
+ return false;
70
+ clearChartLoadPhaseSignal(chartIndex);
71
+ return true;
72
+ }
73
+ export function getChartLoadPhaseSignalOwner(chartIndex) {
74
+ return chartLoadPhaseSignalOwners.get(chartIndex);
75
+ }
76
+ export function getChartLoadPhaseSignal(chartIndex) {
77
+ return chartLoadPhaseSignals.get(chartIndex);
78
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Gate-plane served-access cache discriminators (CME and OPRA).
3
+ *
4
+ * Frontend data for gate-governed exchanges is partitioned by the smallest
5
+ * served-access facts that can change its contents: bar/indicator-history
6
+ * caches split on delayed vs realtime ONLY (real-time bars are identical on
7
+ * L1 and depth, so an L1<->depth change reuses them); order-book/heatmap
8
+ * caches split on timing plus depth. Ungoverned markets always get `null`,
9
+ * which every key builder treats as "append nothing", keeping their keys
10
+ * byte-for-byte identical. CME's values and shapes are unprefixed (the keys
11
+ * every CME entry already carries); every other plane's are prefixed with its
12
+ * provider (`opra-delayed`, shape `opra{N}-delayed`), so no plane's key, purge
13
+ * predicate or transition ever touches another plane's entries.
14
+ *
15
+ * `unknown` served access maps to the delayed-safe variant; when a known
16
+ * real-time signal later arrives, the transition handler invalidates that
17
+ * safe variant because data cached during the unknown window may actually
18
+ * have been real-time.
19
+ *
20
+ * Browser-safe AND worker-safe (zero Vue / store / i18n imports). Each JS
21
+ * context (main thread, worker) holds its own mirror: the main thread sets it
22
+ * from the CME store watcher, workers from the 'cme-served-access' message.
23
+ */
24
+ import type { CmeServedAccess, CmeServedAccessByExchange } from '../../interfaces/cme-realtime.interface.js';
25
+ import type { GateProvider } from '../../workers/constants/socket-slots.js';
26
+ /** Bars + indicator history: timing only, provider-prefixed off CME. */
27
+ export type CmeBarCacheContext = 'delayed' | 'realtime' | 'opra-delayed' | 'opra-realtime';
28
+ /** The served timing a bar context names, whatever its plane. */
29
+ export declare function barCacheTiming(context: CmeBarCacheContext): 'delayed' | 'realtime';
30
+ /** The bar context of one plane at one timing (CME unprefixed: its keys predate a second plane). */
31
+ export declare function barCacheContextFor(provider: GateProvider, timing: 'delayed' | 'realtime'): CmeBarCacheContext;
32
+ /**
33
+ * Order book + heatmap: timing plus served depth, prefixed with the units era.
34
+ *
35
+ * Era u2 (2026-07-28): the gateway starts serving CME books in raw contracts
36
+ * (tsdb-gateway !1862) instead of contract-multiplied pseudo-units. Buckets
37
+ * recorded in the multiplied era differ from raw-contract columns by the
38
+ * per-root multiplier (up to 100,000x on treasuries); mixing them in one
39
+ * heatmap renders the known solid-max-columns-beside-dark-neighbors class
40
+ * (see SCHEMA_VERSION v4 in heatmap-cache.constants.ts for the precedent).
41
+ * The era prefix orphans every pre-!1862 CME book bucket at the deploy that
42
+ * first writes u2 keys; orphaned buckets age out through the existing sweep.
43
+ * Bump the era ONLY together with a served-units change on the gateway, and
44
+ * deploy the frontend AFTER the gateway change so the orphaning happens
45
+ * exactly once.
46
+ */
47
+ export type CmeBookCacheContext = 'u2-delayed' | 'u2-rt-depth';
48
+ /** The two book context values, exported so consumers (transition detection,
49
+ * purge substrings) never hand-spell the era prefix. */
50
+ export declare const CME_BOOK_CACHE_DELAYED: CmeBookCacheContext;
51
+ export declare const CME_BOOK_CACHE_RT_DEPTH: CmeBookCacheContext;
52
+ export declare function setCmeServedAccessForCaches(byExchange: CmeServedAccessByExchange): void;
53
+ /**
54
+ * Latest served access for one exchange from this context's mirror; delayed-safe
55
+ * `unknown` when absent. The worker send path reads this to pick the same gate
56
+ * tier slot the main thread would (see `resolveGovernedSlot`), so tier routing
57
+ * agrees across threads off the one `SET_SERVED_ACCESS` mirror.
58
+ */
59
+ export declare function cmeServedAccessForExchange(exchange: string | undefined | null): CmeServedAccess;
60
+ /** null => no gate plane governs it: append nothing to the key. */
61
+ export declare function cmeBarCacheContext(exchange: string | undefined | null): CmeBarCacheContext | null;
62
+ export declare const CME_BAR_CACHE_SHAPE_VERSION = 4;
63
+ /** The OPRA twin of {@link CME_BAR_CACHE_SHAPE_VERSION} (`opra{N}-<timing>`); same bump rule. */
64
+ export declare const OPRA_BAR_CACHE_SHAPE_VERSION = 1;
65
+ /** The chart-session component of a bars cache key. Only the RTH-filtered
66
+ * data set is ever tagged: ETH is the default full-session set, and leaving
67
+ * it untagged keeps every non-RTH key byte-identical within a version era. */
68
+ export type CmeBarCacheSession = 'rth' | null;
69
+ /** The bars cache-key shape suffix for a governed bar context. Single
70
+ * authority for the format: the key builder (`cacheKeyForMetadata`) and the
71
+ * served-access transition purge predicate must agree byte-for-byte, across
72
+ * BOTH session variants of a timing (see `cmeDelayedBarShapeSuffixes`).
73
+ * The plane rides the prefix: `cme{N}-<timing>` for CME, `opra{N}-<timing>`
74
+ * for OPRA. */
75
+ export declare function cmeBarCacheShape(context: CmeBarCacheContext, session?: CmeBarCacheSession): string;
76
+ /** Every shape suffix a delayed-timing bars entry of one plane (CME unless
77
+ * named) can carry in the current version era: the session x back-adjustment
78
+ * product. The served-access transition purge must cover exactly this set:
79
+ * matching only the untagged variant would leave the RTH or adjusted
80
+ * variants' delayed-era rows alive after real-time is confirmed. */
81
+ export declare function cmeDelayedBarShapeSuffixes(provider?: GateProvider): string[];
82
+ /**
83
+ * Full shape suffix including the back-adjustment discriminator: adjusted
84
+ * continuous-symbol bars live at a different price level than raw ones, so
85
+ * they must never share an IDB row. Composition order is fixed as
86
+ * `cme{N}-<timing>[-rth][-adj]` (session before adjustment, matching
87
+ * cmeBarCacheShape's own composition). Same single-authority rule: the key
88
+ * builder and every purge predicate that enumerates bar variants go through
89
+ * here so the `-adj` spelling exists in exactly one place.
90
+ */
91
+ export declare function cmeBarCacheShapeFor(context: CmeBarCacheContext, session: CmeBarCacheSession, adjusted: boolean): string;
92
+ /**
93
+ * null => no gate plane governs it, or its plane serves no books (OPRA is top
94
+ * of book only, `GatePlane.servesBooks`): append nothing to the key.
95
+ *
96
+ * Under the mixed-tier feed split (R5b) an L1-capped (p1) plan's full-depth
97
+ * book is SERVED BY THE DELAYED TIER — the realtime socket would cap it at one
98
+ * level — so p1 book data keys as `delayed` (its actual source), never a
99
+ * distinct `rt-l1` variant. This also makes free→p1 a bars-only transition
100
+ * (book source unchanged) and p1→p2 a real book transition.
101
+ */
102
+ export declare function cmeBookCacheContext(exchange: string | undefined | null): CmeBookCacheContext | null;
103
+ /**
104
+ * First exchange of a joined `A|B|C` exchanges param (heatmap requests carry
105
+ * one for aggregated books). CME books are never cross-venue aggregated with
106
+ * non-governed exchanges, so the first entry decides governance.
107
+ */
108
+ export declare function primaryExchangeOfJoined(exchanges: string | undefined | null): string | null;
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Gate-plane served-access cache discriminators (CME and OPRA).
3
+ *
4
+ * Frontend data for gate-governed exchanges is partitioned by the smallest
5
+ * served-access facts that can change its contents: bar/indicator-history
6
+ * caches split on delayed vs realtime ONLY (real-time bars are identical on
7
+ * L1 and depth, so an L1<->depth change reuses them); order-book/heatmap
8
+ * caches split on timing plus depth. Ungoverned markets always get `null`,
9
+ * which every key builder treats as "append nothing", keeping their keys
10
+ * byte-for-byte identical. CME's values and shapes are unprefixed (the keys
11
+ * every CME entry already carries); every other plane's are prefixed with its
12
+ * provider (`opra-delayed`, shape `opra{N}-delayed`), so no plane's key, purge
13
+ * predicate or transition ever touches another plane's entries.
14
+ *
15
+ * `unknown` served access maps to the delayed-safe variant; when a known
16
+ * real-time signal later arrives, the transition handler invalidates that
17
+ * safe variant because data cached during the unknown window may actually
18
+ * have been real-time.
19
+ *
20
+ * Browser-safe AND worker-safe (zero Vue / store / i18n imports). Each JS
21
+ * context (main thread, worker) holds its own mirror: the main thread sets it
22
+ * from the CME store watcher, workers from the 'cme-served-access' message.
23
+ */
24
+ import { governedPlaneOf } from '../v2/gate-plane.util.js';
25
+ /** The served timing a bar context names, whatever its plane. */
26
+ export function barCacheTiming(context) {
27
+ return context === 'realtime' || context === 'opra-realtime' ? 'realtime' : 'delayed';
28
+ }
29
+ /** The bar context of one plane at one timing (CME unprefixed: its keys predate a second plane). */
30
+ export function barCacheContextFor(provider, timing) {
31
+ return provider === 'cme' ? timing : `opra-${timing}`;
32
+ }
33
+ /** The two book context values, exported so consumers (transition detection,
34
+ * purge substrings) never hand-spell the era prefix. */
35
+ export const CME_BOOK_CACHE_DELAYED = 'u2-delayed';
36
+ export const CME_BOOK_CACHE_RT_DEPTH = 'u2-rt-depth';
37
+ const UNKNOWN_ACCESS = { status: 'unknown' };
38
+ // Per-exchange served access, keyed uppercase. Each JS context holds its own
39
+ // mirror: the main thread sets it from the CME store watcher, workers from the
40
+ // 'cme-served-access' message. An absent exchange reads delayed-safe.
41
+ let servedAccessByExchange = {};
42
+ export function setCmeServedAccessForCaches(byExchange) {
43
+ servedAccessByExchange = byExchange;
44
+ }
45
+ /**
46
+ * Latest served access for one exchange from this context's mirror; delayed-safe
47
+ * `unknown` when absent. The worker send path reads this to pick the same gate
48
+ * tier slot the main thread would (see `resolveGovernedSlot`), so tier routing
49
+ * agrees across threads off the one `SET_SERVED_ACCESS` mirror.
50
+ */
51
+ export function cmeServedAccessForExchange(exchange) {
52
+ return (exchange ? servedAccessByExchange[exchange.toUpperCase()] : undefined) ?? UNKNOWN_ACCESS;
53
+ }
54
+ /** null => no gate plane governs it: append nothing to the key. */
55
+ export function cmeBarCacheContext(exchange) {
56
+ const plane = governedPlaneOf(exchange);
57
+ if (plane === null)
58
+ return null;
59
+ const access = cmeServedAccessForExchange(exchange);
60
+ return barCacheContextFor(plane.provider, access.status === 'known' && access.timing === 'realtime' ? 'realtime' : 'delayed');
61
+ }
62
+ // Version of the OHLCV bars shape suffix built from the bar context
63
+ // (`cme{N}-delayed[-rth]` / `cme{N}-realtime[-rth]`). Bumping it orphans
64
+ // every prior CME bars entry in one stroke (orphaned keys age out via the
65
+ // cache's normal stale-bound sweep + LRU cap), same pattern as the heatmap
66
+ // SCHEMA_VERSION.
67
+ // v2 (2026-07-27): purge CME bars entries poisoned by the symbol-switch
68
+ // window. Until the identity write-guard landed, the switch pipeline stamped
69
+ // the NEW symbol into metadata before the old series was cleared, so a
70
+ // snapshot write in that window (e.g. the APP_SLEEP persist) filed the OLD
71
+ // symbol's bars under the incoming CME key - and the cache's never-delete
72
+ // mergeBars upsert kept refreshing the poison on every later write. Field
73
+ // signature: a chart switched crypto -> governed CME rendering the crypto
74
+ // symbol's stale bars exactly inside the CME session gaps (weekends, the
75
+ // daily 20:00-22:00Z break), with the price line pinned to the crypto tail.
76
+ // v3 (2026-07-31): purge CME bars entries poisoned by the session-blind
77
+ // window. Until the effective chart session joined the key, an RTH-active
78
+ // chart (tradingHour=REGULAR, session-anchored buckets above 30m) read and
79
+ // wrote the SAME entry as the ETH chart: the boot stale-paint served one
80
+ // session's rows into the other session's chart, and the write-side
81
+ // mergeBars upsert then interleaved the session-anchored RTH grid with the
82
+ // :00-UTC ETH grid inside the entry itself. Field signature: an ES1! 1h
83
+ // chart flipped ETH->RTH rendering 13:30Z-anchored bars interleaved with
84
+ // :00-anchored bars after a reload.
85
+ // v4 (2026-10-14): purge CME RTH entries recorded under the old NYMEX window.
86
+ // The gateway serves an all-NYMEX REGULAR plan the 09:00-14:30 New York
87
+ // energy session and the chart's RTH gates now follow it (rth-session.util
88
+ // `rthWindowForExchange`), but every `-rth` entry written before held
89
+ // 09:30-16:15 rows: bars from 14:30 to 16:15 the wire no longer serves, and
90
+ // 1h bars on the 13:30Z grid. The never-delete mergeBars upsert would keep
91
+ // them, and at 1h the foreign-grid drop could keep the stale :30 grid over
92
+ // the fresh :00 rows. Field signature: a CL1! or NG1! RTH chart painting
93
+ // bars past the 14:30 close, or 1h bars at :30 beside :00 ones, after a
94
+ // reload. Like every bump it orphans all CME bars entries (ETH included).
95
+ export const CME_BAR_CACHE_SHAPE_VERSION = 4;
96
+ /** The OPRA twin of {@link CME_BAR_CACHE_SHAPE_VERSION} (`opra{N}-<timing>`); same bump rule. */
97
+ export const OPRA_BAR_CACHE_SHAPE_VERSION = 1;
98
+ /** The bars cache-key shape suffix for a governed bar context. Single
99
+ * authority for the format: the key builder (`cacheKeyForMetadata`) and the
100
+ * served-access transition purge predicate must agree byte-for-byte, across
101
+ * BOTH session variants of a timing (see `cmeDelayedBarShapeSuffixes`).
102
+ * The plane rides the prefix: `cme{N}-<timing>` for CME, `opra{N}-<timing>`
103
+ * for OPRA. */
104
+ export function cmeBarCacheShape(context, session = null) {
105
+ const prefix = context === 'opra-delayed' || context === 'opra-realtime'
106
+ ? `opra${OPRA_BAR_CACHE_SHAPE_VERSION}`
107
+ : `cme${CME_BAR_CACHE_SHAPE_VERSION}`;
108
+ return `${prefix}-${barCacheTiming(context)}${session ? `-${session}` : ''}`;
109
+ }
110
+ /** Every shape suffix a delayed-timing bars entry of one plane (CME unless
111
+ * named) can carry in the current version era: the session x back-adjustment
112
+ * product. The served-access transition purge must cover exactly this set:
113
+ * matching only the untagged variant would leave the RTH or adjusted
114
+ * variants' delayed-era rows alive after real-time is confirmed. */
115
+ export function cmeDelayedBarShapeSuffixes(provider = 'cme') {
116
+ const delayed = barCacheContextFor(provider, 'delayed');
117
+ return [
118
+ cmeBarCacheShapeFor(delayed, null, false),
119
+ cmeBarCacheShapeFor(delayed, 'rth', false),
120
+ cmeBarCacheShapeFor(delayed, null, true),
121
+ cmeBarCacheShapeFor(delayed, 'rth', true),
122
+ ];
123
+ }
124
+ /**
125
+ * Full shape suffix including the back-adjustment discriminator: adjusted
126
+ * continuous-symbol bars live at a different price level than raw ones, so
127
+ * they must never share an IDB row. Composition order is fixed as
128
+ * `cme{N}-<timing>[-rth][-adj]` (session before adjustment, matching
129
+ * cmeBarCacheShape's own composition). Same single-authority rule: the key
130
+ * builder and every purge predicate that enumerates bar variants go through
131
+ * here so the `-adj` spelling exists in exactly one place.
132
+ */
133
+ export function cmeBarCacheShapeFor(context, session, adjusted) {
134
+ const base = cmeBarCacheShape(context, session);
135
+ return adjusted ? `${base}-adj` : base;
136
+ }
137
+ /**
138
+ * null => no gate plane governs it, or its plane serves no books (OPRA is top
139
+ * of book only, `GatePlane.servesBooks`): append nothing to the key.
140
+ *
141
+ * Under the mixed-tier feed split (R5b) an L1-capped (p1) plan's full-depth
142
+ * book is SERVED BY THE DELAYED TIER — the realtime socket would cap it at one
143
+ * level — so p1 book data keys as `delayed` (its actual source), never a
144
+ * distinct `rt-l1` variant. This also makes free→p1 a bars-only transition
145
+ * (book source unchanged) and p1→p2 a real book transition.
146
+ */
147
+ export function cmeBookCacheContext(exchange) {
148
+ const plane = governedPlaneOf(exchange);
149
+ if (plane === null || !plane.servesBooks)
150
+ return null;
151
+ const access = cmeServedAccessForExchange(exchange);
152
+ if (!(access.status === 'known' && access.timing === 'realtime'))
153
+ return CME_BOOK_CACHE_DELAYED;
154
+ return access.depth === 'depth' ? CME_BOOK_CACHE_RT_DEPTH : CME_BOOK_CACHE_DELAYED;
155
+ }
156
+ /**
157
+ * First exchange of a joined `A|B|C` exchanges param (heatmap requests carry
158
+ * one for aggregated books). CME books are never cross-venue aggregated with
159
+ * non-governed exchanges, so the first entry decides governance.
160
+ */
161
+ export function primaryExchangeOfJoined(exchanges) {
162
+ if (!exchanges)
163
+ return null;
164
+ const first = exchanges.split('|')[0];
165
+ return first || null;
166
+ }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * The CME session lattice: the client mirror of how tsdb-gateway labels CME
3
+ * Group history at 4h, 1d, 1w and every rolled-up preset (pkg/tsdb/selects/
4
+ * cme.go, usesCMESessionRollup + cmeSessionBucketExpression, since c645fd6;
5
+ * the presets since !2151). The gateway re-groups source-tier rows on the
6
+ * Chicago wall clock:
7
+ *
8
+ * - intraday (2m 3m 10m 45m 2h 4h 6h 8h 12h): `time_bucket(width, ts,
9
+ * timezone => 'America/Chicago', offset => 17:00 modulo the width)`, so the
10
+ * 17:00 open starts a bar. 4h: local 01/05/09/13/17/21 (22/02/06/10/14/18Z
11
+ * in CDT, 23/03/07/11/15/19Z in CST); 2h and 8h offset 1h, 6h and 12h 5h,
12
+ * 45m 30m, 2m 3m 10m none. The source tier is the coarsest of 1h/15m/5m/1m
13
+ * dividing both the width and that offset (`sessionTier`);
14
+ * - 1d: the trade date (the date flips at the 17:00 open), stamped at 00:00Z
15
+ * of that date, so an evening print belongs to TOMORROW's bar. A weekday
16
+ * holiday's session belongs to the next trade date on the CME calendar
17
+ * (cme-trade-calendar.util, !2154): Labor Day trades are 9/8's;
18
+ * - 3d: a year's trade dates in threes from its first (`DayGroupStart`), the
19
+ * way TradingView groups them, labeled by the first, so Thu-Fri-Mon is one
20
+ * bar and a holiday never leaves one short;
21
+ * - 1w: the Monday of the trade-date week, 00:00Z (Sunday's open starts it);
22
+ * - 1M 3M 6M 1Y: the months of the trade dates, stamped on the first month's
23
+ * 1st at 00:00Z (29dda19, intervals part 4); a weekend day joins the Friday
24
+ * before, so a month opens at the 17:00 Chicago open before its first trade
25
+ * date.
26
+ *
27
+ * The rollup covers explicit CME-group plans only (every exchange CME, CBOT,
28
+ * NYMEX or COMEX) for TRADE_AGG, TRADE_SIDE_AGNOSTIC_AGG, and the per-symbol
29
+ * VOLUME_PROFILE_AGG / BLOCK_BOOK_SNAPSHOT_AGG; open interest, settlement and
30
+ * coin-aggregated series stay on UTC buckets. A live writer that floored CME
31
+ * frames on the UTC grid instead split the forming bar (a 04:00 ET candle
32
+ * beside the 02:00 ET one) and titan dropped the frames keyed before it.
33
+ *
34
+ * Pure and worker-safe: Intl only, no dayjs.
35
+ */
36
+ export declare function isCmeSessionLatticeExchange(exchange: unknown): boolean;
37
+ /** The intervals the gateway serves on the session lattice: the intraday widths, 1d, 3d, 1w and the calendar rungs. */
38
+ export declare function isCmeSessionLatticeIntervalMs(intervalMs: unknown): boolean;
39
+ /**
40
+ * The first trade date (00:00Z) of the 3d session bar holding the trade date
41
+ * `dayMs` (gateway `sessionGridStart`, session_grid.go): trade dates are
42
+ * counted in weekdays from 2000-01-03, a Monday, three to a bar; a weekend
43
+ * date counts as the Friday before it. The regular US equities session only
44
+ * (the gateway's NYSE calendar is not wired yet); CME rides the trade
45
+ * calendar, every other market's 3d is the calendar floor.
46
+ */
47
+ export declare function sessionGridStartMs(dayMs: number): number;
48
+ /**
49
+ * The bar key the gateway stamps for the CME session bar holding `tsMs`: the
50
+ * intraday bucket start, or the trade-date label (00:00Z of the trade date,
51
+ * not the 17:00 open instant) at 1d, the first trade date of its 3d group,
52
+ * the Monday of its week at 1w, and the 1st of its trade date's month,
53
+ * quarter, half or year at a calendar length. Null when the interval is not a
54
+ * session-lattice interval or the input is not a number.
55
+ */
56
+ export declare function cmeSessionBucketMs(tsMs: number, intervalMs: number): number | null;
57
+ /**
58
+ * The instant the CME session bar stamped `barMs` (a key `cmeSessionBucketMs` stamps) stops
59
+ * taking source rows: the end of the last source row the lattice books to it, for a reader that
60
+ * must never take a bar before it closes (a pinned wrun leg). At 1d, 3d and 1w the key only
61
+ * advances with the session day, so the bar ends at the first source row booked elsewhere: a 3d
62
+ * bar runs to the 17:00 Chicago open of the next group's first session, a weekend or a weekday
63
+ * holiday inside it (Thursday, Friday and Monday close at Monday's 17:00), and a 1d bar to the
64
+ * 17:00 open that starts the next session day. An intraday bar ends at its stamp plus its width,
65
+ * except across a DST change: on the fall-back Sunday a bucket reaching the repeated hour holds
66
+ * its rows an hour longer (the 01:00 4h bar runs five real hours), and the 45m lattice books
67
+ * rows of the repeated hour back to an earlier stamp, so the end is the end of the LAST row
68
+ * booked to it within its width and an hour. A calendar bar runs to the next one's open (July 2026
69
+ * to Sunday 8/2 at 17:00 CDT). Null off the lattice intervals, or for a stamp the lattice books no
70
+ * row to.
71
+ */
72
+ export declare function cmeSessionBarEndMs(barMs: number, intervalMs: number): number | null;
73
+ /**
74
+ * The instant the CME session bar holding `tsMs` opens, for a fetch window
75
+ * that must cover the whole bar: the intraday bucket start, or the 17:00
76
+ * Chicago open before the trade date (1d), the 3d group's first trade date
77
+ * and the week's Monday (1w), where the bar key is a 00:00Z label that runs
78
+ * ahead of the open, and a calendar bar's first trade date (August 2026 opens
79
+ * Sunday 8/2). A 1d or 3d bar after a weekday holiday opens with the holiday's
80
+ * session (9/8 opens Sunday 9/6). Null off the lattice intervals.
81
+ */
82
+ export declare function cmeSessionBarOpenMs(tsMs: number, intervalMs: number): number | null;