@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,374 @@
1
+ // Continuous futures contracts (ES1!, NQ1!, ...): the FE mirror of the
2
+ // tsdb-gateway roll rule. A continuous symbol is a virtual symbol that, at any
3
+ // instant, IS exactly one underlying outright contract (the "lead"). The
4
+ // gateway owns the historical splice; this module only answers "which concrete
5
+ // contract leads right now, and when does it roll next" so live subscriptions
6
+ // and the legend chip can follow the lead.
7
+ //
8
+ // RULE (v1): the era of contract C ends at 17:00 America/Chicago on the day N
9
+ // business days (Mon-Fri; exchange holidays deliberately ignored) before C's
10
+ // expiry date, with the expiry date taken in America/Chicago. The next
11
+ // contract in the root's active month cycle leads from that instant.
12
+ //
13
+ // PARITY CONTRACT: the per-family constants below and the era math are pinned
14
+ // by src/utility/chart/__fixtures__/continuous-golden/continuous_golden.json,
15
+ // whose byte-identical twin lives in the tsdb-gateway repo and is asserted by
16
+ // its Go tests. Never edit the fixture here alone and never let these
17
+ // constants drift from it: change both repos in lockstep or the splice
18
+ // (gateway) and the live lead (FE) disagree at the roll boundary.
19
+ //
20
+ // Worker-safe and pure: no Vue, no stores, no i18n. The only runtime import is
21
+ // the existing contract-code parser (shared regex, one source of truth for
22
+ // month-code decoding).
23
+ import { parseCmeContractExpiry } from '../symbol-selection/contract-expiry.util.js';
24
+ export const CONTINUOUS_RULE_VERSION = 1;
25
+ export const CONTINUOUS_BOUNDARY_LOCAL_TIME = '17:00';
26
+ export const CONTINUOUS_BOUNDARY_TIMEZONE = 'America/Chicago';
27
+ const MONTH_CODES = 'FGHJKMNQUVXZ';
28
+ const ALL_MONTHS = MONTH_CODES.split('');
29
+ /**
30
+ * Per-family roll constants. EXACT mirror of the golden fixture's `families`
31
+ * object (and therefore of the gateway config); the parity spec deep-equals
32
+ * this against the fixture.
33
+ */
34
+ export const CONTINUOUS_FAMILIES = {
35
+ equity_index: {
36
+ nBusinessDays: 6,
37
+ cycle: ['H', 'M', 'U', 'Z'],
38
+ roots: ['ES', 'NQ', 'RTY', 'YM', 'MES', 'MNQ', 'M2K', 'MYM'],
39
+ },
40
+ fx: { nBusinessDays: 5, cycle: ['H', 'M', 'U', 'Z'], roots: ['6E', '6B', '6J', '6C'] },
41
+ treasuries: { nBusinessDays: 20, cycle: ['H', 'M', 'U', 'Z'], roots: ['ZT', 'ZF', 'ZN', 'TN', 'ZB', 'UB'] },
42
+ energy: { nBusinessDays: 3, cycle: ALL_MONTHS, roots: ['CL', 'MCL', 'NG', 'RB', 'HO', 'BZ'] },
43
+ metals: {
44
+ nBusinessDays: 20,
45
+ cycleByRoot: {
46
+ // October (V) is a listed gold month but never the lead: liquidity rolls
47
+ // Aug (Q) straight to Dec (Z), and every reference chain does the same.
48
+ GC: ['G', 'J', 'M', 'Q', 'Z'],
49
+ MGC: ['G', 'J', 'M', 'Q', 'Z'],
50
+ SI: ['H', 'K', 'N', 'U', 'Z'],
51
+ SIL: ['H', 'K', 'N', 'U', 'Z'],
52
+ HG: ['H', 'K', 'N', 'U', 'Z'],
53
+ MHG: ['H', 'K', 'N', 'U', 'Z'],
54
+ },
55
+ },
56
+ grains: {
57
+ nBusinessDays: 12,
58
+ cycleByRoot: {
59
+ ZC: ['H', 'K', 'N', 'U', 'Z'],
60
+ ZW: ['H', 'K', 'N', 'U', 'Z'],
61
+ KE: ['H', 'K', 'N', 'U', 'Z'],
62
+ // August (Q) and September (U) beans are listed but never the lead:
63
+ // liquidity rolls Jul (N) straight to the Nov (X) new crop, and every
64
+ // reference chain does the same.
65
+ ZS: ['F', 'H', 'K', 'N', 'X'],
66
+ ZL: ['F', 'G', 'H', 'K', 'N', 'Q', 'U', 'V', 'Z'],
67
+ },
68
+ },
69
+ // Crypto N=2: the market holds the front month until just before its
70
+ // last-Friday expiry; N=6 handed the virtual symbol to the thin next month
71
+ // for about a week every month.
72
+ crypto: { nBusinessDays: 2, cycle: ALL_MONTHS, roots: ['BTC', 'MBT', 'ETH', 'MET'] },
73
+ };
74
+ const RULE_BY_ROOT = (() => {
75
+ const map = new Map();
76
+ for (const family of Object.values(CONTINUOUS_FAMILIES)) {
77
+ if (family.roots && family.cycle) {
78
+ const cycle = new Set(family.cycle);
79
+ for (const root of family.roots)
80
+ map.set(root, { nBusinessDays: family.nBusinessDays, cycle });
81
+ }
82
+ else if (family.cycleByRoot) {
83
+ for (const [root, months] of Object.entries(family.cycleByRoot)) {
84
+ map.set(root, { nBusinessDays: family.nBusinessDays, cycle: new Set(months) });
85
+ }
86
+ }
87
+ }
88
+ return map;
89
+ })();
90
+ /** Root of a continuous symbol ("ES1!" -> "ES"), or null when not one. */
91
+ export function continuousRootOf(symbol) {
92
+ if (!symbol)
93
+ return null;
94
+ const trimmed = symbol.trim().toUpperCase();
95
+ if (!trimmed.endsWith('1!'))
96
+ return null;
97
+ const root = trimmed.slice(0, -2);
98
+ return RULE_BY_ROOT.has(root) ? root : null;
99
+ }
100
+ /** True for `<ROOT>1!` where ROOT is a configured continuous root. */
101
+ export function isContinuousSymbol(symbol) {
102
+ return continuousRootOf(symbol) !== null;
103
+ }
104
+ // ── America/Chicago calendar machinery ──────────────────────────────────────
105
+ // Intl.DateTimeFormat is the only worker-safe timezone database available
106
+ // here (no dayjs timezone plugin ships in this repo); formatters are cached
107
+ // because construction is expensive.
108
+ let chicagoParts = null;
109
+ function getChicagoParts() {
110
+ if (!chicagoParts) {
111
+ chicagoParts = new Intl.DateTimeFormat('en-US', {
112
+ timeZone: CONTINUOUS_BOUNDARY_TIMEZONE,
113
+ year: 'numeric',
114
+ month: '2-digit',
115
+ day: '2-digit',
116
+ hour: '2-digit',
117
+ minute: '2-digit',
118
+ second: '2-digit',
119
+ hourCycle: 'h23',
120
+ });
121
+ }
122
+ return chicagoParts;
123
+ }
124
+ function chicagoWallClockOf(utcMs) {
125
+ const parts = getChicagoParts().formatToParts(new Date(utcMs));
126
+ const out = {};
127
+ for (const part of parts) {
128
+ if (part.type !== 'literal')
129
+ out[part.type] = Number(part.value);
130
+ }
131
+ return {
132
+ year: out.year ?? 0,
133
+ month: out.month ?? 1,
134
+ day: out.day ?? 1,
135
+ hour: out.hour ?? 0,
136
+ minute: out.minute ?? 0,
137
+ second: out.second ?? 0,
138
+ };
139
+ }
140
+ /**
141
+ * UTC instant of a Chicago wall-clock time. Guess-and-refine against the
142
+ * Intl-provided offset; two passes converge for every instant outside the
143
+ * (nonexistent for a 17:00 boundary) spring-forward gap.
144
+ */
145
+ function chicagoWallClockToUtcMs(year, month, day, hour, minute) {
146
+ const wallAsUtc = Date.UTC(year, month - 1, day, hour, minute, 0, 0);
147
+ // CST first guess (UTC-6); refined below for CDT dates.
148
+ let guess = wallAsUtc + 6 * 3_600_000;
149
+ for (let i = 0; i < 2; i++) {
150
+ const wall = chicagoWallClockOf(guess);
151
+ const wallOfGuess = Date.UTC(wall.year, wall.month - 1, wall.day, wall.hour, wall.minute, wall.second);
152
+ guess += wallAsUtc - wallOfGuess;
153
+ }
154
+ return guess;
155
+ }
156
+ /** Calendar date N business days (Mon-Fri; holidays ignored, v1 rule) before the given date. */
157
+ function minusBusinessDays(year, month, day, n) {
158
+ let ms = Date.UTC(year, month - 1, day);
159
+ let remaining = n;
160
+ while (remaining > 0) {
161
+ ms -= 86_400_000;
162
+ const dow = new Date(ms).getUTCDay();
163
+ if (dow !== 0 && dow !== 6)
164
+ remaining--;
165
+ }
166
+ const date = new Date(ms);
167
+ return { y: date.getUTCFullYear(), m: date.getUTCMonth() + 1, d: date.getUTCDate() };
168
+ }
169
+ /**
170
+ * Eras for a root, given its contract instances: filter to the root's active
171
+ * month cycle, order by expiry, and end each era N business days before that
172
+ * contract's expiry at 17:00 America/Chicago. Contracts outside the cycle
173
+ * (serial months like ESF7) never lead.
174
+ */
175
+ export function computeContinuousEras(root, contracts) {
176
+ const rule = RULE_BY_ROOT.get(root.trim().toUpperCase());
177
+ if (!rule)
178
+ return [];
179
+ const inCycle = [];
180
+ const seen = new Set();
181
+ for (const contract of contracts) {
182
+ if (!contract || typeof contract.expiryMs !== 'number' || !Number.isFinite(contract.expiryMs))
183
+ continue;
184
+ const parsed = parseCmeContractExpiry(contract.symbol);
185
+ if (!parsed)
186
+ continue;
187
+ if (parsed.root.toUpperCase() !== root.trim().toUpperCase())
188
+ continue;
189
+ if (!rule.cycle.has(MONTH_CODES[parsed.monthIndex]))
190
+ continue;
191
+ // Instance identity is (symbol, expiry): recycled year digits a decade
192
+ // apart stay distinct; true duplicates collapse.
193
+ const key = `${contract.symbol.toUpperCase()}@${contract.expiryMs}`;
194
+ if (seen.has(key))
195
+ continue;
196
+ seen.add(key);
197
+ inCycle.push(contract);
198
+ }
199
+ inCycle.sort((a, b) => a.expiryMs - b.expiryMs);
200
+ const eras = [];
201
+ let prevEnd = 0;
202
+ for (const contract of inCycle) {
203
+ const expiry = chicagoWallClockOf(contract.expiryMs);
204
+ const roll = minusBusinessDays(expiry.year, expiry.month, expiry.day, rule.nBusinessDays);
205
+ const eraEndMs = chicagoWallClockToUtcMs(roll.y, roll.m, roll.d, 17, 0);
206
+ eras.push({
207
+ symbol: contract.symbol.toUpperCase(),
208
+ expiryMs: contract.expiryMs,
209
+ eraStartMs: prevEnd,
210
+ eraEndMs,
211
+ });
212
+ prevEnd = eraEndMs;
213
+ }
214
+ // Chain-head clamp, mirroring the gateway: with only listed contracts in
215
+ // the registry the head era would stretch to the unbounded past and the
216
+ // series would serve the current lead's back-month tape as history.
217
+ // Synthesize the head's roll-in from the previous cycle contract's
218
+ // ordinal-weekday-transferred expiry; when expired contracts are
219
+ // backfilled the chain grows a real predecessor and the clamp recedes.
220
+ if (eras.length > 0 && eras[0].eraStartMs === 0) {
221
+ const clamped = chainHeadRollInMs(eras[0], rule);
222
+ if (clamped !== null && clamped < eras[0].eraEndMs) {
223
+ eras[0] = { ...eras[0], eraStartMs: clamped };
224
+ }
225
+ }
226
+ return eras;
227
+ }
228
+ const MONTH_NUMBER_BY_CODE = {
229
+ F: 1,
230
+ G: 2,
231
+ H: 3,
232
+ J: 4,
233
+ K: 5,
234
+ M: 6,
235
+ N: 7,
236
+ Q: 8,
237
+ U: 9,
238
+ V: 10,
239
+ X: 11,
240
+ Z: 12,
241
+ };
242
+ function chainHeadRollInMs(head, rule) {
243
+ const parsed = parseCmeContractExpiry(head.symbol);
244
+ if (!parsed)
245
+ return null;
246
+ const ownMonth = MONTH_NUMBER_BY_CODE[MONTH_CODES[parsed.monthIndex]];
247
+ if (!ownMonth)
248
+ return null;
249
+ const months = [...rule.cycle]
250
+ .map((code) => MONTH_NUMBER_BY_CODE[code])
251
+ .filter((m) => typeof m === 'number')
252
+ .sort((a, b) => a - b);
253
+ const idx = months.indexOf(ownMonth);
254
+ if (idx < 0)
255
+ return null;
256
+ let gap = months.length === 1 ? 12 : ownMonth - months[(idx - 1 + months.length) % months.length];
257
+ if (gap <= 0)
258
+ gap += 12;
259
+ const expiry = chicagoWallClockOf(head.expiryMs);
260
+ const ordinal = Math.floor((expiry.day - 1) / 7);
261
+ const weekday = new Date(Date.UTC(expiry.year, expiry.month - 1, expiry.day)).getUTCDay();
262
+ // Last-occurrence transfer mirrors the gateway: a last-Friday expiry
263
+ // (crypto) must land on the target month's last Friday even when it has
264
+ // five, where the ordinal transfer would be a week early.
265
+ const isLast = expiry.day + 7 > daysInMonth(expiry.year, expiry.month);
266
+ let targetYear = expiry.year;
267
+ let targetMonth = expiry.month - gap;
268
+ while (targetMonth <= 0) {
269
+ targetMonth += 12;
270
+ targetYear -= 1;
271
+ }
272
+ let day;
273
+ if (isLast) {
274
+ const lastDay = daysInMonth(targetYear, targetMonth);
275
+ const lastDow = new Date(Date.UTC(targetYear, targetMonth - 1, lastDay)).getUTCDay();
276
+ day = lastDay - ((lastDow - weekday + 7) % 7);
277
+ }
278
+ else {
279
+ const firstDow = new Date(Date.UTC(targetYear, targetMonth - 1, 1)).getUTCDay();
280
+ day = 1 + ((weekday - firstDow + 7) % 7) + ordinal * 7;
281
+ while (day > daysInMonth(targetYear, targetMonth)) {
282
+ day -= 7;
283
+ }
284
+ }
285
+ const roll = minusBusinessDays(targetYear, targetMonth, day, rule.nBusinessDays);
286
+ return chicagoWallClockToUtcMs(roll.y, roll.m, roll.d, 17, 0);
287
+ }
288
+ function daysInMonth(year, month) {
289
+ return new Date(Date.UTC(year, month, 0)).getUTCDate();
290
+ }
291
+ /**
292
+ * The contract leading the continuous series at `nowMs`: the era containing
293
+ * now (era = [prevBoundary, boundary); at the boundary instant the NEXT
294
+ * contract already leads). Null when no known contract's era covers now
295
+ * (empty/expired registry list); callers treat that as "unresolved".
296
+ *
297
+ * `exchange` is carried for symmetry with the resolver cache identity; the
298
+ * math itself is venue-independent (roots are globally unique across the
299
+ * governed venues).
300
+ */
301
+ export function resolveContinuousLead(root, exchange, contracts, nowMs) {
302
+ void exchange;
303
+ const eras = computeContinuousEras(root, contracts);
304
+ for (const era of eras) {
305
+ if (nowMs < era.eraEndMs) {
306
+ return { symbol: era.symbol, expiryMs: era.expiryMs, eraStartMs: era.eraStartMs, eraEndMs: era.eraEndMs };
307
+ }
308
+ }
309
+ return null;
310
+ }
311
+ let registeredLeadPeek = null;
312
+ /** Called once by continuous-contracts.service at construction. */
313
+ export function registerContinuousLeadPeek(peek) {
314
+ registeredLeadPeek = peek;
315
+ }
316
+ /** Last-known lead via the registered resolver; null when unregistered/unresolved. */
317
+ export function peekRegisteredContinuousLead(exchange, symbol) {
318
+ return registeredLeadPeek ? registeredLeadPeek(exchange, symbol) : null;
319
+ }
320
+ let registeredLeadApplier = null;
321
+ let registeredRootUsageProbe = null;
322
+ /** Called at module scope by the live-feed service. */
323
+ export function registerContinuousLeadApplier(applier) {
324
+ registeredLeadApplier = applier;
325
+ }
326
+ /** The registered applier; null (workers, isolated specs) means a lead flip re-homes nothing. */
327
+ export function registeredContinuousLeadApplier() {
328
+ return registeredLeadApplier;
329
+ }
330
+ /**
331
+ * Register the "does any chart still reference this root" probe. Resolver
332
+ * timer fires (failure retry and boundary revalidation alike) consult it and
333
+ * drop the root instead of refetching when the answer is no. Search-warmed
334
+ * roots ride the same lifecycle: warm freely, expire when no chart picked the
335
+ * symbol up.
336
+ */
337
+ export function registerContinuousRootUsageProbe(probe) {
338
+ registeredRootUsageProbe = probe;
339
+ }
340
+ /** The registered probe; null (workers, isolated specs) means "assume referenced". */
341
+ export function registeredContinuousRootUsageProbe() {
342
+ return registeredRootUsageProbe;
343
+ }
344
+ let registeredChartMetadataAccessor = null;
345
+ export function registerContinuousChartMetadataAccessor(accessor) {
346
+ registeredChartMetadataAccessor = accessor;
347
+ }
348
+ export function continuousChartMetadataByIndex(chartIndex) {
349
+ return registeredChartMetadataAccessor ? registeredChartMetadataAccessor(chartIndex) : undefined;
350
+ }
351
+ /**
352
+ * True when a live frame's symbol belongs to the target's stream: exact
353
+ * symbol/normalizedSymbol match, or, for a continuous target, the resolved
354
+ * lead contract. The alias only applies when the resolved contract's parsed
355
+ * root matches the continuous root, so a stale resolvedContract from another
356
+ * market can never claim foreign frames.
357
+ */
358
+ export function symbolsMatchForLiveFeed(target, frameSymbol) {
359
+ if (!target || typeof frameSymbol !== 'string' || frameSymbol.length === 0)
360
+ return false;
361
+ if (frameSymbol === target.symbol)
362
+ return true;
363
+ if (typeof target.normalizedSymbol === 'string' && frameSymbol === target.normalizedSymbol)
364
+ return true;
365
+ if (typeof target.symbol !== 'string' || typeof target.resolvedContract !== 'string')
366
+ return false;
367
+ const root = continuousRootOf(target.symbol);
368
+ if (!root)
369
+ return false;
370
+ if (frameSymbol.toUpperCase() !== target.resolvedContract.toUpperCase())
371
+ return false;
372
+ const frameParsed = parseCmeContractExpiry(frameSymbol);
373
+ return !!frameParsed && frameParsed.root.toUpperCase() === root;
374
+ }
@@ -0,0 +1,119 @@
1
+ import type { FeedCombineRule, FeedHead, FeedWireBar, FeedWireRow } from '../../interfaces/feed.interface.js';
2
+ /** C2: the intervals the relay regroups bars on, ascending. */
3
+ export declare const FEED_BAR_INTERVALS_S: readonly [60, 300, 900, 1800, 3600, 14400, 86400, 604800];
4
+ /** C4 poll: never more often than this. */
5
+ export declare const FEED_POLL_FLOOR_S = 10;
6
+ /** Bars of history a first read reaches back when the chart's candles have not landed yet. */
7
+ export declare const FEED_DEFAULT_LOOKBACK_BARS = 1000;
8
+ export type FeedPlot = 'line' | 'candles';
9
+ export type FeedRequest = {
10
+ kind: 'rows';
11
+ } | {
12
+ kind: 'bars';
13
+ interval_s: number;
14
+ };
15
+ /** C4: true when the feed draws its raw rows at their own timestamps on this chart interval. */
16
+ export declare function feedDrawsRows(cadenceS: number, chartIntervalMs: number): boolean;
17
+ /** What to ask the relay for on this chart interval: the rows, or bars on one of its intervals. */
18
+ export declare function chooseFeedRequest(cadenceS: number, chartIntervalMs: number): FeedRequest;
19
+ /** Two requests ask for the same thing (a regroup on the same interval, or the rows). */
20
+ export declare function sameFeedRequest(a: FeedRequest | null, b: FeedRequest | null): boolean;
21
+ /** C4 poll period: every `max(10, cadence_s / 2)` seconds (irregular feeds every 10 s). */
22
+ export declare function feedPollPeriodMs(cadenceS: number): number;
23
+ /**
24
+ * The UTC bucket a timestamp falls in, seconds: the relay's regroup, `floor(ts / interval_s)`,
25
+ * except that weeks start Monday 00:00 UTC as the relay's (and the chart's weekly candles) do.
26
+ */
27
+ export declare function feedBucketStartSec(tsSec: number, intervalS: number): number;
28
+ /** An exact-interval feed on a chart of another interval: it draws nothing there. */
29
+ export declare function feedExactIntervalBlocks(exactInterval: boolean | null | undefined, cadenceS: number, chartIntervalMs: number): boolean;
30
+ export type FeedPlan = FeedRequest | {
31
+ kind: 'exact-only';
32
+ cadence_s: number;
33
+ };
34
+ /** What the pane does on this chart interval: nothing (an exact-interval feed elsewhere), else rows or bars. */
35
+ export declare function chooseFeedPlan(cadenceS: number, chartIntervalMs: number, exactInterval?: boolean | null): FeedPlan;
36
+ /** The legend's hint ("hourly on a 1m chart"): a feed slower than the chart, drawn at its own stamps. */
37
+ export declare function feedCadenceHintApplies(cadenceS: number, chartIntervalMs: number, exactInterval?: boolean | null): boolean;
38
+ /** A span of seconds as a chart interval label: `1m`, `15m`, `1h`, `4h`, `1d`, `1w`; whole seconds otherwise. */
39
+ export declare function feedIntervalLabel(seconds: number): string;
40
+ /** The chart interval a cadence switches to (a label the chart's interval list holds), or null. */
41
+ export declare function feedChartIntervalFor(cadenceS: number): string | null;
42
+ /** The chart's own interval as a label (`1m`, `4h`, `1d`), from its milliseconds. */
43
+ export declare function feedChartIntervalLabel(chartIntervalMs: number): string;
44
+ export interface FeedFetchWindowInput {
45
+ request: FeedRequest;
46
+ cadenceS: number;
47
+ chartIntervalMs: number;
48
+ nowMs: number;
49
+ /** The first mounted candle, ms; null while the candles have not landed. */
50
+ mainFirstMs: number | null;
51
+ /** The feed's newest row (head `last_ts`), seconds: always inside the window, so the legend has a value. */
52
+ lastTs?: number | null;
53
+ }
54
+ /**
55
+ * The window a full read covers, seconds: from one cadence (or one bar)
56
+ * before the first candle, so the line enters from the left edge, to now.
57
+ * The newest row is always inside, so a slow feed on a short chart still
58
+ * shows its value.
59
+ */
60
+ export declare function feedFetchWindow(input: FeedFetchWindowInput): {
61
+ fromSec: number;
62
+ toSec: number;
63
+ };
64
+ /** Wire rows to chart rows `[ts_ms, value]` (the first value key; null and state cells read NaN), ascending, one per stamp. */
65
+ export declare function feedRowsToSeries(rows: readonly FeedWireRow[]): number[][];
66
+ /**
67
+ * Wire bars to chart rows: `[ts_ms, value]` for a line, `[ts_ms, open, high, low, close]` for
68
+ * candles. A line's value is the bar's `combined` (position 6, P3 C7: the value's rule over the
69
+ * bucket, a sum for a volume) when the bar carries one, else its close (position 4).
70
+ */
71
+ export declare function feedBarsToSeries(bars: readonly FeedWireBar[], plot: FeedPlot): number[][];
72
+ /** Union by stamp, ascending; an incoming row replaces a held row at the same stamp. */
73
+ export declare function mergeFeedSeries(held: readonly number[][], incoming: readonly number[][]): number[][];
74
+ /** The newest stamp of a series, seconds; null when empty. */
75
+ export declare function feedSeriesLastTsSec(series: readonly number[][]): number | null;
76
+ export interface FeedReadingInput {
77
+ /** The reading's stamp, seconds. */
78
+ ts: number;
79
+ /** Its first value (the plotted key); a null reading breaks a line and leaves bars as they are. */
80
+ value: number | string | null;
81
+ request: FeedRequest;
82
+ plot: FeedPlot;
83
+ /** The feed's storage grain: one stored reading per slot of this length (rows only). */
84
+ floorS?: number | null;
85
+ }
86
+ export interface FeedReadingFold {
87
+ series: number[][];
88
+ /** The newest row, when the engine's live update can land it (a new newest row, or the newest at its own stamp);
89
+ * null when the series must be committed whole. */
90
+ live: number[] | null;
91
+ }
92
+ /**
93
+ * Fold one reading into the held series. A reading is the relay's stored row for one slot as
94
+ * it stands (a replacement, never an increment): on rows, the row already held in the reading's
95
+ * storage slot (`floor_s`) is replaced, else the reading is added; on bars, the bar of its bucket
96
+ * takes it as its close (a candle also widens its high and low), else a new bar opens at it.
97
+ * Null when there is nothing to draw (a null reading on bars).
98
+ */
99
+ export declare function foldFeedReading(series: readonly number[][], input: FeedReadingInput): FeedReadingFold | null;
100
+ /**
101
+ * The span one stored reading stands for: the cadence (the relay's head first, else the saved
102
+ * one; the stored cadence for an irregular feed), never under the storage grain `floor_s`. 0 when
103
+ * nothing says (no gap can be judged then).
104
+ */
105
+ export declare function feedReadingSlotS(head: Pick<FeedHead, 'cadence_s' | 'observed_cadence_s' | 'floor_s'> | null | undefined, savedCadenceS?: number): number;
106
+ /**
107
+ * A reading more than one slot past the cursor (the newest row held with nothing missing before
108
+ * it): it skipped a whole slot, so rows between them may exist that the stream never sent.
109
+ * Slot-aligned, so a late stamp inside the next slot is no gap.
110
+ */
111
+ export declare function feedReadingSkipsSlot(cursorTs: number | null, ts: number, slotS: number): boolean;
112
+ /** A stream reading stands for its bucket only for a value combining by `last` (the series lane's rule). */
113
+ export declare function feedReadingFoldsBars(rule: FeedCombineRule | null | undefined): boolean;
114
+ /**
115
+ * Rows read from the relay over the held ones, by storage slot (`floor_s`): the relay keeps one row
116
+ * per slot, so a read row replaces whatever the held series has in its slot (a slot whose row moved
117
+ * from T to T+1 keeps one row, never two). Ascending.
118
+ */
119
+ export declare function mergeFeedRowsBySlot(held: readonly number[][], incoming: readonly number[][], floorS: number | null | undefined): number[][];