@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,191 @@
1
+ /**
2
+ * `option_prints` (UW-PARITY source contract v2, S3): every OPRA print of the chart's underlying at or above the
3
+ * input's `min_premium`, one 16-value tuple per print on the bar it printed in (wrun-option-prints.util), history
4
+ * plus live. A row lane: the host plans, asks, lands and reconciles it from this descriptor.
5
+ *
6
+ * - Identity: the underlying the OPRA plane keys prints by (`coin`), resolved before any fetch.
7
+ * - Facets (the acquisition, om's facet list and words): `min_premium` (required: `wrun_option_prints_min_premium_
8
+ * required`), `expiries`, `history` ("live" | "3d" | "90d") and `overflow` ("refuse" | "largest"), each refused by
9
+ * name outside its words (`wrun_option_knob_invalid`). One acquisition a package: two inputs whose knobs differ
10
+ * refuse by name.
11
+ * - History: one ask over the window from the span the backend serves the acquisition (`horizon`: the table the
12
+ * floor and the history reach, the gateway's bar limit); older bars are partial. The K control `K_OPTION_PRINT`
13
+ * reads it on the native-rows path, keyed by second; the landing re-bases each print's offset on its host bar.
14
+ * - Projection, per input: `expiries: "nearest:N"` keeps the bar's N nearest expiries; `overflow: "largest"` cuts a
15
+ * bar over the input's own `max_cells` to its largest premiums (om's packer rule, bit 14 on the first kept print).
16
+ * - Live by coin: the coin-scoped OPRA channel (`K_OPTION_PRINT` subscribes it at a real-time routed tier only) feeds
17
+ * every print of the underlying; the fold keeps the acquisition's floor and "0dte"; a reconcile merges by
18
+ * `print_key`, so a print shown live never vanishes and one seen on both paths is one tuple.
19
+ */
20
+ import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED } from '../wrun-poll-lane.types.js';
21
+ import { refuseWrunOptionKnob, wrunNearestExpiryTuples, wrunOptionExpiriesKnob, wrunOptionExpiriesOf, wrunOptionExpiriesWord, } from '../../wrun-option-knobs.util.js';
22
+ import { isWrunOptionPrintTuple, WRUN_OPTION_PRINT_COLUMN, WRUN_OPTION_PRINTS_HISTORY, WRUN_OPTION_PRINTS_OVERFLOW, WRUN_OPTION_PRINTS_WIDTH, wrunLargestPremiumPrints, wrunOptionPrintKept, wrunOptionPrintOf, wrunOptionPrintsAcquisitionOf, wrunOptionPrintsHorizon, wrunOptionPrintsInTimeOrder, wrunOptionPrintTimeMs, } from '../../wrun-option-prints.util.js';
23
+ import { resolveWrunOpraLaneUnderlying } from '../../wrun-opra-underlying.util.js';
24
+ import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../../wrun-present-bits.util.js';
25
+ import { wrunHostBarOf } from '../../wrun-tier-grid.util.js';
26
+ /** The lane's key, its feed in a refusal record. */
27
+ const LANE_KEY = 'option_prints';
28
+ /** om's refusal name of a missing floor. */
29
+ export const WRUN_OPTION_PRINTS_MIN_PREMIUM_REQUIRED_CODE = 'wrun_option_prints_min_premium_required';
30
+ /** One input's facets: the floor (required), the history, the overflow rule and the expiries word. */
31
+ function optionPrintsFacets(source, ctx) {
32
+ const minPremium = source.min_premium;
33
+ if (minPremium === undefined) {
34
+ return refuseWrunPollInput(ctx, `declares no min_premium (${WRUN_OPTION_PRINTS_MIN_PREMIUM_REQUIRED_CODE}): declare the smallest premium a print ` +
35
+ 'keeps, in USD (a number above 0)', WRUN_POLL_AUTHOR_GATE_SEED);
36
+ }
37
+ if (typeof minPremium !== 'number' || !(Number.isFinite(minPremium) && minPremium > 0)) {
38
+ return refuseWrunOptionKnob(ctx, 'min_premium', minPremium, 'a premium in USD above 0');
39
+ }
40
+ const history = source.history ?? 'live';
41
+ if (!WRUN_OPTION_PRINTS_HISTORY.includes(history)) {
42
+ return refuseWrunOptionKnob(ctx, 'history', history, WRUN_OPTION_PRINTS_HISTORY.join(', '));
43
+ }
44
+ const overflow = source.overflow ?? 'refuse';
45
+ if (!WRUN_OPTION_PRINTS_OVERFLOW.includes(overflow)) {
46
+ return refuseWrunOptionKnob(ctx, 'overflow', overflow, WRUN_OPTION_PRINTS_OVERFLOW.join(', '));
47
+ }
48
+ const expiries = wrunOptionExpiriesWord(wrunOptionExpiriesKnob(source, ctx));
49
+ return { minPremium, history, overflow, ...(expiries !== undefined ? { expiries } : {}) };
50
+ }
51
+ /** A host bar's prints: each second row's prints, their offsets re-based on the bar's open, in time order. */
52
+ function landOptionPrints(group) {
53
+ const out = [];
54
+ for (const row of group.rows) {
55
+ const base = Number(row[0]) - group.barOpenMs;
56
+ if (!Number.isFinite(base))
57
+ continue;
58
+ for (let at = 1; at < row.length; at += 1) {
59
+ const cell = row[at];
60
+ if (!isWrunOptionPrintTuple(cell))
61
+ continue;
62
+ const tuple = [...cell];
63
+ tuple[WRUN_OPTION_PRINT_COLUMN.offset] = base + cell[WRUN_OPTION_PRINT_COLUMN.offset];
64
+ out.push(tuple);
65
+ }
66
+ }
67
+ return wrunOptionPrintsInTimeOrder(out);
68
+ }
69
+ /** A live point's print and series (the feed's point: `{ series, optionPrint }`). */
70
+ function livePrintOf(point) {
71
+ if (point === null || typeof point !== 'object')
72
+ return {};
73
+ const record = point;
74
+ const print = record.optionPrint;
75
+ const series = record.series;
76
+ return {
77
+ ...(print !== null && typeof print === 'object' ? { print: print } : {}),
78
+ ...(series !== null && typeof series === 'object' ? { series: series } : {}),
79
+ };
80
+ }
81
+ /** Whether a tuple is a partial bar's marker (every value 0, `present` bit 14 alone), never a print. */
82
+ function isPartialMarker(tuple) {
83
+ const present = tuple[WRUN_OPTION_PRINT_COLUMN.present];
84
+ return (wrunPresentIsPartial(present) && tuple.every((value, at) => at === WRUN_OPTION_PRINT_COLUMN.present || value === 0));
85
+ }
86
+ /**
87
+ * One bar's print tuples merged with more (`incoming` win on a shared `print_key`), in time order. A partial bar
88
+ * stays partial: when any tuple of either side says so, every print carries bit 14, and a bar left without a print
89
+ * keeps one marker; a marker never sits beside a print.
90
+ */
91
+ function mergeBarPrints(existing, incoming) {
92
+ const tuples = [...existing.filter(isWrunOptionPrintTuple), ...incoming];
93
+ const partial = tuples.some((tuple) => wrunPresentIsPartial(tuple[WRUN_OPTION_PRINT_COLUMN.present]));
94
+ const byKey = new Map();
95
+ for (const tuple of tuples)
96
+ if (!isPartialMarker(tuple))
97
+ byKey.set(tuple[WRUN_OPTION_PRINT_COLUMN.key], tuple);
98
+ const prints = wrunOptionPrintsInTimeOrder([...byKey.values()]);
99
+ if (!partial)
100
+ return prints;
101
+ return prints.length > 0
102
+ ? wrunTuplesMarkedPartial(prints, WRUN_OPTION_PRINTS_WIDTH)
103
+ : [wrunPartialMarkerTuple(WRUN_OPTION_PRINTS_WIDTH)];
104
+ }
105
+ /** Live prints folded into the instance's host-bar rows: each kept print (the acquisition's floor and "0dte") on
106
+ * the bar holding it, once per `print_key`, every touched bar's prints in time order. */
107
+ function foldLiveOptionPrints(rows, points, ctx) {
108
+ const acquisition = wrunOptionPrintsAcquisitionOf(ctx.acquisition);
109
+ const byBar = new Map(rows.map((row) => [Number(row[0]), [...row]]));
110
+ const arrived = new Map();
111
+ if (acquisition !== undefined) {
112
+ for (const point of points) {
113
+ const { print, series } = livePrintOf(point);
114
+ const tupled = wrunOptionPrintOf(print, series);
115
+ if (typeof tupled === 'string' || !wrunOptionPrintKept(tupled, acquisition))
116
+ continue;
117
+ const open = wrunHostBarOf(tupled.tsMs, ctx.intervalMs, ctx.barGrid);
118
+ if (open === null)
119
+ continue;
120
+ tupled.tuple[WRUN_OPTION_PRINT_COLUMN.offset] = tupled.tsMs - open;
121
+ const list = arrived.get(open) ?? [];
122
+ list.push(tupled.tuple);
123
+ arrived.set(open, list);
124
+ }
125
+ }
126
+ for (const [open, prints] of arrived) {
127
+ // A print already held keeps its tuple (the live copy of a print history served is the same print).
128
+ const held = (byBar.get(open) ?? [open]).slice(1);
129
+ const heldKeys = new Set(held.filter(isWrunOptionPrintTuple).map((t) => t[WRUN_OPTION_PRINT_COLUMN.key]));
130
+ const fresh = prints.filter((tuple) => !heldKeys.has(tuple[WRUN_OPTION_PRINT_COLUMN.key]));
131
+ byBar.set(open, [open, ...mergeBarPrints(held, fresh)]);
132
+ }
133
+ return [...byBar.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
134
+ }
135
+ /** A reconcile answer over the rows held: the answer's prints, plus every held print of the bar its key does not
136
+ * name (a print shown live keeps its place until history serves it), in time order. */
137
+ function reconcileOptionPrints(held, answer) {
138
+ const heldByBar = new Map(held.map((row) => [Number(row[0]), row]));
139
+ return answer.map((row) => {
140
+ const before = heldByBar.get(Number(row[0]));
141
+ if (before === undefined)
142
+ return [...row];
143
+ const answered = row.slice(1).filter(isWrunOptionPrintTuple);
144
+ const keys = new Set(answered.map((tuple) => tuple[WRUN_OPTION_PRINT_COLUMN.key]));
145
+ const kept = before
146
+ .slice(1)
147
+ .filter(isWrunOptionPrintTuple)
148
+ .filter((tuple) => !isPartialMarker(tuple) && !keys.has(tuple[WRUN_OPTION_PRINT_COLUMN.key]));
149
+ if (kept.length === 0)
150
+ return [...row];
151
+ return [row[0], ...mergeBarPrints(answered, kept)];
152
+ });
153
+ }
154
+ /** One input's projection of a bar: its N nearest expiries, then its own bound under `overflow: "largest"`. */
155
+ function projectOptionPrints(tuples, input) {
156
+ const source = input.source;
157
+ const ordered = wrunOptionPrintsInTimeOrder(tuples);
158
+ const expiries = wrunOptionExpiriesOf(source.expiries);
159
+ const kept = expiries?.kind === 'nearest'
160
+ ? wrunNearestExpiryTuples(ordered, expiries.count, WRUN_OPTION_PRINT_COLUMN.expiry)
161
+ : ordered;
162
+ if (source.overflow === 'largest' && input.maxCells !== undefined) {
163
+ return wrunLargestPremiumPrints(kept, input.maxCells);
164
+ }
165
+ return kept;
166
+ }
167
+ export const rowLane = {
168
+ sourceClass: 'option_prints',
169
+ laneKey: LANE_KEY,
170
+ kType: 'option_print',
171
+ label: 'Option prints',
172
+ feedWords: 'wrun.refusal.feed.optionPrints',
173
+ width: WRUN_OPTION_PRINTS_WIDTH,
174
+ identity: async (ctx) => ({ coin: await resolveWrunOpraLaneUnderlying(ctx) }),
175
+ facets: optionPrintsFacets,
176
+ acquisitions: 'one',
177
+ landing: { kind: 'flow', fold: landOptionPrints },
178
+ horizon: wrunOptionPrintsHorizon,
179
+ governed: 'opra',
180
+ emptyAnswer: 'quiet',
181
+ cells: projectOptionPrints,
182
+ liveByCoin: {
183
+ scriptSource: 'option_print',
184
+ stampOf: (point) => {
185
+ const tsMs = wrunOptionPrintTimeMs(livePrintOf(point).print?.timestamp);
186
+ return Number.isFinite(tsMs) ? tsMs : null;
187
+ },
188
+ fold: foldLiveOptionPrints,
189
+ reconcile: reconcileOptionPrints,
190
+ },
191
+ };
@@ -0,0 +1,13 @@
1
+ import type { WrunRowLaneDescriptor } from '../wrun-row-lane.types.js';
2
+ /** f64s per tuple (om's `WRUN_OPTION_STRIKES_TUPLE_WIDTH`). */
3
+ export declare const WRUN_OPTION_STRIKES_WIDTH = 12;
4
+ /** The columns a tuple must hold a finite number in: the strike and the expiry. */
5
+ export declare const WRUN_OPTION_STRIKES_FINITE_COLUMNS: readonly number[];
6
+ /** om's code for a market pin on the chain classes. */
7
+ export declare const WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE = "wrun_options_chain_market_pinned";
8
+ /** Test seam: forget every resolved chart. */
9
+ export declare function __resetWrunStrikesChartsForTests(): void;
10
+ /** The tuples an input keeps under its `expiries` word: every one, or ("nearest:N") the tuples of the N earliest
11
+ * distinct expiries the bar's snapshot lists (om's `wrunOptionsChainKept`, the expiry being the second member). */
12
+ export declare function wrunOptionStrikesKept(tuples: ReadonlyArray<ReadonlyArray<number>>, expiriesWord: unknown): ReadonlyArray<ReadonlyArray<number>>;
13
+ export declare const rowLane: WrunRowLaneDescriptor;
@@ -0,0 +1,137 @@
1
+ /**
2
+ * `option_strikes`: the chart's options chain measured by strike on EVERY bar (UW-PARITY S1, adopting om's class as
3
+ * the om worktree `feat/wrun-option-strikes` defines it: `WRUN_OPTION_STRIKES_TUPLE_WIDTH`, wrun-host cells.ts
4
+ * `kscriptStrikeCells` / `wrunOptionStrikesBlock`, docs "Option strikes").
5
+ *
6
+ * - Tuple, width 12, NO `present` mask: `[strike, expiry_ms, net_gex, call_gex, put_gex, net_dex, net_vex, call_oi,
7
+ * put_oi, call_iv, put_iv, underlying]`. A side the strike does not list reads NaN in its own fields, and so does an
8
+ * IV the side does not report: only a strike or an expiry that is not a finite number drops the tuple (om's adapter;
9
+ * `finiteColumns`), and nothing reads bit 14 off the last column (`presentMask: false`).
10
+ * - Per bar: ONE snapshot, the newest minute of strike rows inside the bar (every expiry and strike of that minute),
11
+ * stamped at the bar's open: a snapshot landing with no tier rule (`landing: { kind: 'snapshot' }`, the newest row of
12
+ * each host bar, any chart interval), its rows read off OPTION_STRIKE_AGG (pb-common 12.67.0, MINUTE, by the
13
+ * chain's underlying; the K_OPTION_STRIKES control and its worker twin). A bar holding no minute (outside the
14
+ * session, a minute the backend missed, history past its about seven days) is an EMPTY block; an empty answer is
15
+ * quiet (om's `absence: "empty"`).
16
+ * - Knobs, the options chain's words: `venue` ("auto" by default) through the chain decision the options_chain lane
17
+ * makes (`decideWrunOptionsChainIdentity`: a pinned word, the flag, the listing, the directory, the OPRA wall), and
18
+ * `expiries` ("all", or "nearest:N": the N earliest expiries each bar's snapshot lists, kept per input before the
19
+ * packer judges `max_cells`, never a fetch facet). A market pin, `history` and `min_size` are refused by name; a
20
+ * block over `max_cells` refuses the run (wrun_cell_block_too_large, never truncated). One chain per package.
21
+ * - The strike rows exist for OPRA chains only: on a chart whose options ride the OPRA plane the lane is governed
22
+ * (the wall, native rows, the provenance stamp, the routed tier); anywhere else (`offPlane: 'empty'`) the decision
23
+ * still refuses by name, and a chain it resolves (Deribit, CME, a crypto venue) reads empty blocks with no fetch.
24
+ *
25
+ * LIGHT at module load: the chain resolver and the listing are imported inside `identity`.
26
+ */
27
+ import { wrunChartHostEnv } from '../../../../host-env.js';
28
+ import { refuseWrunLaneStrayKnob, resolveWrunLaneChartChain, resolveWrunLaneCryptoVenues, wrunLaneChainRefusalError, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
29
+ import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
30
+ import { decideWrunOptionsChainIdentity, WRUN_OPTIONS_CHAIN_EXPIRIES_CODE, wrunOptionsChainExpiries, wrunOptionsChainIdentityKey, } from '../../wrun-options-chain.util.js';
31
+ import { attachWrunRefusal } from '../../wrun-refusal.util.js';
32
+ /** f64s per tuple (om's `WRUN_OPTION_STRIKES_TUPLE_WIDTH`). */
33
+ export const WRUN_OPTION_STRIKES_WIDTH = 12;
34
+ /** The columns a tuple must hold a finite number in: the strike and the expiry. */
35
+ export const WRUN_OPTION_STRIKES_FINITE_COLUMNS = Object.freeze([0, 1]);
36
+ /** om's code for a market pin on the chain classes. */
37
+ export const WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE = 'wrun_options_chain_market_pinned';
38
+ const STRIKES_CHARTS_KEPT = 16;
39
+ const strikesCharts = new Map();
40
+ function rememberStrikesChart(key, chart) {
41
+ strikesCharts.delete(key);
42
+ strikesCharts.set(key, chart);
43
+ while (strikesCharts.size > STRIKES_CHARTS_KEPT)
44
+ strikesCharts.delete(strikesCharts.keys().next().value);
45
+ }
46
+ /** Test seam: forget every resolved chart. */
47
+ export function __resetWrunStrikesChartsForTests() {
48
+ strikesCharts.clear();
49
+ }
50
+ /** The tuples an input keeps under its `expiries` word: every one, or ("nearest:N") the tuples of the N earliest
51
+ * distinct expiries the bar's snapshot lists (om's `wrunOptionsChainKept`, the expiry being the second member). */
52
+ export function wrunOptionStrikesKept(tuples, expiriesWord) {
53
+ const expiries = wrunOptionsChainExpiries(typeof expiriesWord === 'string' ? expiriesWord : undefined);
54
+ if (expiries === undefined || expiries.kind !== 'nearest')
55
+ return tuples;
56
+ const distinct = [...new Set(tuples.map((tuple) => Number(tuple[1])))].sort((a, b) => a - b);
57
+ const nearest = new Set(distinct.slice(0, expiries.count));
58
+ return tuples.filter((tuple) => nearest.has(Number(tuple[1])));
59
+ }
60
+ export const rowLane = {
61
+ sourceClass: 'option_strikes',
62
+ laneKey: 'option_strikes',
63
+ kType: 'option_strikes',
64
+ label: 'Option strikes',
65
+ feedWords: 'wrun.refusal.feed.optionStrikes',
66
+ width: WRUN_OPTION_STRIKES_WIDTH,
67
+ finiteColumns: WRUN_OPTION_STRIKES_FINITE_COLUMNS,
68
+ presentMask: false,
69
+ governed: 'opra',
70
+ offPlane: 'empty',
71
+ acquisitions: 'one',
72
+ emptyAnswer: 'quiet',
73
+ landing: { kind: 'snapshot' },
74
+ identity: async (ctx) => {
75
+ const chain = await resolveWrunLaneChartChain(ctx);
76
+ const [cryptoVenues, { hasDeribitOptions }] = await Promise.all([
77
+ resolveWrunLaneCryptoVenues(chain, ctx.coin),
78
+ wrunChartHostEnv().market.loadDeribitOptions(),
79
+ ]);
80
+ rememberStrikesChart(wrunLaneChartKey(ctx), { chain, cryptoVenues, deribitListed: hasDeribitOptions });
81
+ },
82
+ facets: (source, ctx) => {
83
+ for (const knob of ['history', 'min_size']) {
84
+ if (source[knob] !== undefined)
85
+ refuseWrunLaneStrayKnob(ctx, knob, "'tape' celled");
86
+ }
87
+ if (source.symbol !== undefined || source.exchange !== undefined) {
88
+ refuseWrunPollInput(ctx, `pins option_strikes cells to a fixed market (${WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE}); option_strikes reads the chain of the chart's own underlying (pick the chain family with venue), so drop the symbol and exchange pin`, { cls: 'run-failed', variant: 'generic' });
89
+ }
90
+ const chart = strikesCharts.get(wrunLaneChartKey(ctx));
91
+ if (chart === undefined) {
92
+ return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', {
93
+ cls: 'run-failed',
94
+ variant: 'generic',
95
+ });
96
+ }
97
+ const decision = decideWrunOptionsChainIdentity({
98
+ venue: source.venue === undefined ? undefined : String(source.venue),
99
+ chartSource: chart.chain.chartSource,
100
+ chartCoin: ctx.coin,
101
+ deribitListed: chart.deribitListed,
102
+ cryptoVenues: chart.cryptoVenues,
103
+ marketLabel: `${ctx.exchange}/${ctx.symbol}`,
104
+ inputName: ctx.inputName,
105
+ official: ctx.official === true,
106
+ opraUserScripts: ctx.opraUserScripts === true,
107
+ ...(chart.chain.directoryFailed !== undefined ? { directoryFailed: chart.chain.directoryFailed } : {}),
108
+ // The known reason the chart's OPRA options ride no plane (the flag, the router): the refusal says it.
109
+ ...(chart.chain.opraStop !== undefined ? { opraStop: chart.chain.opraStop } : {}),
110
+ // Another screen holds the session of the chain's plane: the refusal says so, with Resume here.
111
+ ...(chart.chain.heldElsewhere !== undefined ? { heldElsewhere: chart.chain.heldElsewhere } : {}),
112
+ });
113
+ // om's order: the venue word, then the expiries word, then the chain the word resolves.
114
+ if (!decision.ok && decision.reason === 'bad-venue-word')
115
+ throw wrunLaneChainRefusalError(decision, 'option_strikes');
116
+ const expiries = source.expiries;
117
+ const expiriesRead = expiries === undefined || (typeof expiries === 'string' && wrunOptionsChainExpiries(expiries) !== undefined);
118
+ if (!expiriesRead) {
119
+ throw attachWrunRefusal(new Error(`Input '${ctx.inputName}' reads option_strikes cells with expiries '${String(expiries)}' (${WRUN_OPTIONS_CHAIN_EXPIRIES_CODE}): declare "all" or "nearest:N" (the N nearest live expiries, 1..999)`), { cls: 'run-failed', variant: 'generic' });
120
+ }
121
+ if (!decision.ok)
122
+ throw wrunLaneChainRefusalError(decision, 'option_strikes');
123
+ const { identity } = decision;
124
+ const strikeChain = wrunOptionsChainIdentityKey(identity);
125
+ // Only an OPRA chain lists strike rows; any other chain the word resolves (off the plane) is never fetched.
126
+ if (identity.venue !== 'opra')
127
+ return { strikeChain };
128
+ return {
129
+ strikeChain,
130
+ strikeExchange: identity.exchange,
131
+ strikeUnderlying: identity.underlying,
132
+ // The run's bar span: the worker keeps the newest minute of each of these bars.
133
+ hostIntervalMs: ctx.intervalMs,
134
+ };
135
+ },
136
+ cells: (tuples, input) => wrunOptionStrikesKept(tuples, input.source.expiries),
137
+ };
@@ -0,0 +1,38 @@
1
+ import { type WrunLaneChain } from '../opra-option-lanes.util.js';
2
+ import type { WrunRowLaneDescriptor } from '../wrun-row-lane.types.js';
3
+ import type { WrunBackendTier } from '../../wrun-tier-grid.util.js';
4
+ /** f64s per tuple (the source contract's width, the `present` mask included). */
5
+ export declare const WRUN_OPTION_SURFACE_WIDTH = 9;
6
+ /** The point type the lane reads, by name (sent as its id once the protocol package names it). */
7
+ export declare const WRUN_OPTION_SURFACE_TYPE = "OPTION_SURFACE";
8
+ /** The two job tiers: 5m kept 30 days, 1d kept for good. */
9
+ export declare const WRUN_OPTION_SURFACE_TIERS: readonly WrunBackendTier[];
10
+ /** The payload field an instance names its chain's exchange in (its plane follows it). */
11
+ export declare const WRUN_OPTION_SURFACE_EXCHANGE_FIELD = "surfaceExchange";
12
+ /** Test seam: forget every resolved chart. */
13
+ export declare function __resetWrunSurfaceChartsForTests(): void;
14
+ /**
15
+ * An input's acquisition, the chain it reads as the ask's fields (the acquisition key: the class, the plane its
16
+ * exchange names, the exchange, the underlying, the book and, per ask, the tier): `surfaceExchange` and
17
+ * `surfaceUnderlying` always (an OPRA chain's exactly as before), the ONE book the run decided named the way the data
18
+ * plane names it (the job's synthetic symbol `<underlying>|<YYYYMMDD>[|AM][|<series>]` writes no series tail for the
19
+ * underlying's own series): no `surfaceBook` for the underlying's own series (Deribit's BTC on BTC, every CME and
20
+ * OPRA chain's one book), `surfaceBook` for any other (Deribit's BTC_USDC, OKX's BTC-USD), and `surfaceContinuous` for
21
+ * a CME chain read off a continuous alias (`wrunOptionSurfaceAcquisitionMoved` reads it).
22
+ */
23
+ export declare function wrunOptionSurfaceExtras(chain: WrunLaneChain): Record<string, unknown>;
24
+ /**
25
+ * Whether an acquisition no longer names the chain the lane would plan now (D12): a CME chain read off a continuous
26
+ * alias whose lead contract rolled since the run planned it (`peekRegisteredContinuousLead`, the lead resolver's
27
+ * last answer, names another contract than `surfaceUnderlying`). A live session holding it rebuilds (the full run
28
+ * plans the lead contract and its own series, and drops every buffered row), so no ask, cache or buffer joins the
29
+ * old contract's surfaces to the new one's. A lead not resolved yet moves nothing.
30
+ */
31
+ export declare function wrunOptionSurfaceAcquisitionMoved(acquisition: Readonly<Record<string, unknown>>): boolean;
32
+ /**
33
+ * Whether an acquisition's bar its tier answered nothing for reads the next coarser tier (D12): a CME chain's, whose
34
+ * 1d tier holds the settlement DAY rows while its 5m tier fills only inside a session where rows exist, so a daily
35
+ * bar reads its settlement instead of nothing. An OPRA or crypto chain keeps the tier rule as it is.
36
+ */
37
+ export declare function wrunOptionSurfaceReadsSettlements(acquisition: Readonly<Record<string, unknown>>): boolean;
38
+ export declare const rowLane: WrunRowLaneDescriptor;
@@ -0,0 +1,150 @@
1
+ /**
2
+ * `option_surface`: the volatility surface of the chart's options chain, one tuple per expiry on every bar (UW-PARITY S9,
3
+ * `contracts/sources.md`), on every chain the surface job samples (OPTIONS-PORT P1: the crypto venues, CME, OPRA).
4
+ *
5
+ * - Tuple, width 9: `[expiry_ms, dte_days, forward, atm_iv, iv_p25, iv_c25, iv_p10, iv_c10, present]`; bits 1 to 7 of
6
+ * `present` for dte_days through iv_c10 (each bit its column, 0 with the bit clear when the sample leaves it out),
7
+ * bit 8 when the forward came from put-call parity, bit 14 a partial bar.
8
+ * - Backend: OPTION_SURFACE (type 251, kiyotaka-go !62), venue-agnostic, by the chain's exchange and underlying (a
9
+ * crypto venue's root coin, a CME futures contract, an OPRA ticker), one surface per BOOK (a chain's series: Deribit's
10
+ * BTC and BTC_USDC, OKX's BTC-USD and BTC-USD_UM), sampled by the option-surface job into two tiers: 5m kept 30 days
11
+ * and 1d (the session's last sample, or a CME settlement, stamped at its UTC date) kept for good. pb-common 12.68.0
12
+ * names the type; under a pin that does not, every input refuses by name before any fetch
13
+ * (`protocol-pending:OPTION_SURFACE`, the one protocol gate every lane reading a type by name shares:
14
+ * wrun-protocol-pending.util).
15
+ * - Per bar, a snapshot under the tier rule (rule 9): each host bar reads the finest tier that fits it and still
16
+ * retains it (a 09:30-anchored stock bar of 5m or more reads 5m buckets within 30 days, a daily bar past them the 1d
17
+ * row), its newest SEALED bucket, and a bar its tier answered nothing for reads the next coarser tier (D12: a CME
18
+ * daily bar whose 5m tier holds no session reads its settlement DAY row); a bar no fitting tier retains (an intraday
19
+ * bar older than 30 days, a bar finer than 5m) is partial (bit 14, the marker tuple when it holds none).
20
+ * - A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `decideWrunLaneChain`), per
21
+ * input, and its plane is per instance: OPRA's rules on a US stock or OPRA contract chart (unchanged), CME's on a CME
22
+ * futures chart (a continuous chart reads its lead contract, and a live session rebuilds once the lead rolls:
23
+ * `acquisitionMoved`), none on a crypto chain.
24
+ * - Knobs: `venue` (the options chain's words, decided by the venue decision `options_chain` reads, so `auto` reads
25
+ * the chain `options_chain`'s `auto` reads on the same chart: the chart's own options market, else the coin's
26
+ * Deribit chain, else the first venue that lists it), `book` (`auto` or one series name: ONE series per input,
27
+ * decided when the run plans and named in the acquisition, `auto` the chain's default book over the series its
28
+ * directory lists, opra-option-lanes.util `resolveWrunLaneChainAutoBook`; an answer never picks it) and `max_cells`
29
+ * (a block over it refuses the run); a market pin and the other options classes' knobs refuse by name.
30
+ *
31
+ * LIGHT at module load: pb-common and the chain resolver are imported inside `identity`.
32
+ */
33
+ import { peekRegisteredContinuousLead } from '../../../chart/continuous-contracts.util.js';
34
+ import { decideWrunLaneChain, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, wrunLaneChainPlaneOf, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
35
+ import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
36
+ import { assertWrunProtocolType } from '../../wrun-protocol-pending.util.js';
37
+ const MINUTE_MS = 60_000;
38
+ const DAY_MS = 86_400_000;
39
+ /** f64s per tuple (the source contract's width, the `present` mask included). */
40
+ export const WRUN_OPTION_SURFACE_WIDTH = 9;
41
+ /** The point type the lane reads, by name (sent as its id once the protocol package names it). */
42
+ export const WRUN_OPTION_SURFACE_TYPE = 'OPTION_SURFACE';
43
+ /** The two job tiers: 5m kept 30 days, 1d kept for good. */
44
+ export const WRUN_OPTION_SURFACE_TIERS = Object.freeze([
45
+ { key: '5m', ms: 5 * MINUTE_MS, retentionMs: 30 * DAY_MS },
46
+ { key: '1d', ms: DAY_MS },
47
+ ]);
48
+ /** The payload field an instance names its chain's exchange in (its plane follows it). */
49
+ export const WRUN_OPTION_SURFACE_EXCHANGE_FIELD = 'surfaceExchange';
50
+ /** The knobs of the other options classes, each refused here by name. */
51
+ const STRAY_KNOBS = [
52
+ [
53
+ 'expiries',
54
+ "'options_chain', 'option_strikes', 'option_prints', 'option_contract_flow' and 'option_contract_state'",
55
+ ],
56
+ ['strike_window_pct', "'option_contract_flow' and 'option_contract_state'"],
57
+ ['history', "'tape' and 'option_prints' celled"],
58
+ ['min_size', "'tape' celled"],
59
+ ['min_premium', "'option_prints' celled"],
60
+ ['overflow', "'option_prints' celled"],
61
+ ['min_volume', "'option_contract_flow' celled"],
62
+ ];
63
+ /** What `identity` resolved for a chart, read back by `facets` (synchronous). Keyed by the chart market; the newest
64
+ * entries kept. */
65
+ const SURFACE_CHARTS_KEPT = 16;
66
+ const surfaceCharts = new Map();
67
+ function rememberSurfaceChart(key, chart) {
68
+ surfaceCharts.delete(key);
69
+ surfaceCharts.set(key, chart);
70
+ while (surfaceCharts.size > SURFACE_CHARTS_KEPT)
71
+ surfaceCharts.delete(surfaceCharts.keys().next().value);
72
+ }
73
+ /** Test seam: forget every resolved chart. */
74
+ export function __resetWrunSurfaceChartsForTests() {
75
+ surfaceCharts.clear();
76
+ }
77
+ /**
78
+ * An input's acquisition, the chain it reads as the ask's fields (the acquisition key: the class, the plane its
79
+ * exchange names, the exchange, the underlying, the book and, per ask, the tier): `surfaceExchange` and
80
+ * `surfaceUnderlying` always (an OPRA chain's exactly as before), the ONE book the run decided named the way the data
81
+ * plane names it (the job's synthetic symbol `<underlying>|<YYYYMMDD>[|AM][|<series>]` writes no series tail for the
82
+ * underlying's own series): no `surfaceBook` for the underlying's own series (Deribit's BTC on BTC, every CME and
83
+ * OPRA chain's one book), `surfaceBook` for any other (Deribit's BTC_USDC, OKX's BTC-USD), and `surfaceContinuous` for
84
+ * a CME chain read off a continuous alias (`wrunOptionSurfaceAcquisitionMoved` reads it).
85
+ */
86
+ export function wrunOptionSurfaceExtras(chain) {
87
+ const book = chain.book.toUpperCase();
88
+ return {
89
+ [WRUN_OPTION_SURFACE_EXCHANGE_FIELD]: chain.exchange,
90
+ surfaceUnderlying: chain.underlying,
91
+ ...(book !== chain.underlying.toUpperCase() ? { surfaceBook: book } : {}),
92
+ ...(chain.continuous !== undefined ? { surfaceContinuous: chain.continuous } : {}),
93
+ };
94
+ }
95
+ /**
96
+ * Whether an acquisition no longer names the chain the lane would plan now (D12): a CME chain read off a continuous
97
+ * alias whose lead contract rolled since the run planned it (`peekRegisteredContinuousLead`, the lead resolver's
98
+ * last answer, names another contract than `surfaceUnderlying`). A live session holding it rebuilds (the full run
99
+ * plans the lead contract and its own series, and drops every buffered row), so no ask, cache or buffer joins the
100
+ * old contract's surfaces to the new one's. A lead not resolved yet moves nothing.
101
+ */
102
+ export function wrunOptionSurfaceAcquisitionMoved(acquisition) {
103
+ const alias = acquisition.surfaceContinuous;
104
+ const exchange = acquisition[WRUN_OPTION_SURFACE_EXCHANGE_FIELD];
105
+ if (typeof alias !== 'string' || alias === '' || typeof exchange !== 'string')
106
+ return false;
107
+ const lead = peekRegisteredContinuousLead(exchange, alias)?.symbol;
108
+ return typeof lead === 'string' && lead !== '' && lead !== acquisition.surfaceUnderlying;
109
+ }
110
+ /**
111
+ * Whether an acquisition's bar its tier answered nothing for reads the next coarser tier (D12): a CME chain's, whose
112
+ * 1d tier holds the settlement DAY rows while its 5m tier fills only inside a session where rows exist, so a daily
113
+ * bar reads its settlement instead of nothing. An OPRA or crypto chain keeps the tier rule as it is.
114
+ */
115
+ export function wrunOptionSurfaceReadsSettlements(acquisition) {
116
+ const exchange = acquisition[WRUN_OPTION_SURFACE_EXCHANGE_FIELD];
117
+ return wrunLaneChainPlaneOf(typeof exchange === 'string' ? exchange : '') === 'cme';
118
+ }
119
+ export const rowLane = {
120
+ sourceClass: 'option_surface',
121
+ laneKey: 'option_surface',
122
+ kType: 'option_surface',
123
+ label: 'Volatility surface',
124
+ feedWords: 'wrun.refusal.feed.optionSurface',
125
+ width: WRUN_OPTION_SURFACE_WIDTH,
126
+ chain: { exchangeField: WRUN_OPTION_SURFACE_EXCHANGE_FIELD },
127
+ landing: { kind: 'snapshot', tiers: WRUN_OPTION_SURFACE_TIERS, coarserWhenEmpty: wrunOptionSurfaceReadsSettlements },
128
+ acquisitionMoved: wrunOptionSurfaceAcquisitionMoved,
129
+ identity: async (ctx) => {
130
+ await assertWrunProtocolType(ctx, WRUN_OPTION_SURFACE_TYPE, 'option_surface');
131
+ rememberSurfaceChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx));
132
+ },
133
+ facets: async (source, ctx) => {
134
+ for (const [knob, owners] of STRAY_KNOBS) {
135
+ if (source[knob] !== undefined)
136
+ refuseWrunLaneStrayKnob(ctx, knob, owners);
137
+ }
138
+ if (source.symbol !== undefined || source.exchange !== undefined) {
139
+ refuseWrunPollInput(ctx, "pins option_surface cells to a fixed market (wrun_option_market_pinned); it reads the chart's own underlying, so drop the symbol and exchange pin", { cls: 'run-failed', variant: 'generic' });
140
+ }
141
+ const chart = surfaceCharts.get(wrunLaneChartKey(ctx));
142
+ if (chart === undefined) {
143
+ return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', {
144
+ cls: 'run-failed',
145
+ variant: 'generic',
146
+ });
147
+ }
148
+ return wrunOptionSurfaceExtras(await decideWrunLaneChain(chart, { venue: source.venue, book: source.book }, ctx));
149
+ },
150
+ };