@orangecharts/wrun-chart-host 0.9.0 → 0.11.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 (252) hide show
  1. package/README.md +2 -0
  2. package/dist/constants/feature-flags.constants.d.ts +15 -1
  3. package/dist/constants/feature-flags.constants.js +130 -24
  4. package/dist/constants/governed-exchanges.constants.d.ts +12 -0
  5. package/dist/constants/governed-exchanges.constants.js +16 -0
  6. package/dist/constants/opra-compliance.constants.d.ts +3 -2
  7. package/dist/constants/opra-compliance.constants.js +3 -2
  8. package/dist/constants/option-venues.constants.d.ts +2 -2
  9. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
  10. package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
  11. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
  12. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
  13. package/dist/constants/venue-presets.constants.d.ts +20 -20
  14. package/dist/constants/venue-presets.constants.js +24 -26
  15. package/dist/host-env.d.ts +21 -5
  16. package/dist/host-env.js +6 -0
  17. package/dist/host-ports.types.d.ts +102 -19
  18. package/dist/index.d.ts +18 -0
  19. package/dist/index.js +18 -0
  20. package/dist/interfaces/cancel-reason.interface.d.ts +1 -1
  21. package/dist/interfaces/cme-realtime.interface.d.ts +16 -9
  22. package/dist/interfaces/cme-realtime.interface.js +6 -3
  23. package/dist/interfaces/kscript-diagnostics.interface.d.ts +12 -0
  24. package/dist/interfaces/opra-realtime.interface.d.ts +1 -5
  25. package/dist/interfaces/prediction-market.interface.d.ts +7 -0
  26. package/dist/interfaces/replay.interface.d.ts +8 -0
  27. package/dist/interfaces/stocks-realtime.interface.d.ts +57 -0
  28. package/dist/interfaces/stocks-realtime.interface.js +32 -0
  29. package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
  30. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +62 -94
  31. package/dist/kscript-data/controls/live-trades-merge.util.js +106 -171
  32. package/dist/market-data/billing.interface.d.ts +174 -36
  33. package/dist/market-data/billing.interface.js +58 -8
  34. package/dist/market-data/venue.d.ts +152 -7
  35. package/dist/market-data/venues/cme.contract.copy.json +66 -0
  36. package/dist/market-data/venues/cme.d.ts +126 -0
  37. package/dist/market-data/venues/cme.js +133 -0
  38. package/dist/market-data/venues/index.d.ts +294 -7
  39. package/dist/market-data/venues/index.js +49 -6
  40. package/dist/market-data/venues/opra.contract.copy.json +3 -2
  41. package/dist/market-data/venues/opra.d.ts +2 -2
  42. package/dist/market-data/venues/opra.js +5 -2
  43. package/dist/market-data/venues/stocks.contract.copy.json +64 -0
  44. package/dist/market-data/venues/stocks.d.ts +130 -0
  45. package/dist/market-data/venues/stocks.js +117 -0
  46. package/dist/settings-templates/footprint-rows.js +35 -2
  47. package/dist/settings-templates/form-rows.d.ts +2 -1
  48. package/dist/settings-templates/index.js +7 -3
  49. package/dist/settings-templates/indicator-fields.d.ts +5 -4
  50. package/dist/settings-templates/indicator-fields.js +79 -10
  51. package/dist/settings-templates/tool-rules.d.ts +32 -15
  52. package/dist/settings-templates/tool-rules.js +33 -11
  53. package/dist/settings-templates/tool-tables.generated.js +95 -31
  54. package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
  55. package/dist/utility/chart/book-live-bucket.util.js +47 -0
  56. package/dist/utility/chart/cme-cache-context.util.d.ts +5 -3
  57. package/dist/utility/chart/cme-cache-context.util.js +10 -6
  58. package/dist/utility/chart/cme-realtime.util.js +10 -0
  59. package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +83 -0
  60. package/dist/utility/chart/cme-user-scripts-gate.util.js +142 -0
  61. package/dist/utility/chart/effective-chart-session.util.d.ts +14 -0
  62. package/dist/utility/chart/effective-chart-session.util.js +39 -0
  63. package/dist/utility/chart/host-bar-placement.util.d.ts +28 -0
  64. package/dist/utility/chart/host-bar-placement.util.js +170 -30
  65. package/dist/utility/chart/index-host-tier.util.d.ts +3 -1
  66. package/dist/utility/chart/index-host-tier.util.js +7 -2
  67. package/dist/utility/chart/index-mode-admission.util.js +30 -3
  68. package/dist/utility/chart/kscript-apply-fingerprint.util.js +1 -1
  69. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
  70. package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
  71. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +9 -7
  72. package/dist/utility/chart/kscript-live-coalesce.util.js +13 -8
  73. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +9 -0
  74. package/dist/utility/chart/kscript-live-source-identity.util.js +10 -1
  75. package/dist/utility/chart/kscript-provenance-keys.util.js +13 -0
  76. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +5 -1
  77. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
  78. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
  79. package/dist/utility/chart/kscript-venue-policy.util.d.ts +156 -43
  80. package/dist/utility/chart/kscript-venue-policy.util.js +249 -59
  81. package/dist/utility/chart/live-bucket.util.d.ts +24 -8
  82. package/dist/utility/chart/live-bucket.util.js +85 -27
  83. package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
  84. package/dist/utility/chart/market-session-schedule.util.js +16 -0
  85. package/dist/utility/chart/marketKind.util.js +5 -0
  86. package/dist/utility/chart/mixed-mode.util.d.ts +7 -0
  87. package/dist/utility/chart/mixed-mode.util.js +14 -0
  88. package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
  89. package/dist/utility/chart/opra-read-access.leaf.js +5 -3
  90. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +11 -16
  91. package/dist/utility/chart/opra-user-scripts-gate.util.js +12 -28
  92. package/dist/utility/chart/rth-session.util.d.ts +12 -10
  93. package/dist/utility/chart/rth-session.util.js +25 -21
  94. package/dist/utility/chart/trading-day.util.d.ts +17 -0
  95. package/dist/utility/chart/trading-day.util.js +59 -0
  96. package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
  97. package/dist/utility/chart/window-geometry.leaf.js +22 -6
  98. package/dist/utility/chart/window-owner.leaf.d.ts +23 -2
  99. package/dist/utility/chart/window-owner.leaf.js +45 -3
  100. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +33 -15
  101. package/dist/utility/chart/wrun-bar-session-facts.util.js +70 -20
  102. package/dist/utility/chart/wrun-run-result.util.d.ts +12 -0
  103. package/dist/utility/chart/wrun-run-result.util.js +141 -6
  104. package/dist/utility/intl-locale.util.js +5 -0
  105. package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
  106. package/dist/utility/options/option-bar-anchor.util.js +340 -0
  107. package/dist/utility/options/option-venue.util.d.ts +18 -0
  108. package/dist/utility/options/option-venue.util.js +27 -0
  109. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +4 -0
  110. package/dist/utility/v2/gate-plane.util.d.ts +12 -3
  111. package/dist/utility/v2/gate-plane.util.js +30 -4
  112. package/dist/utility/v2/gate-session-latch.util.js +1 -1
  113. package/dist/utility/v2/stocks-governed.util.d.ts +16 -0
  114. package/dist/utility/v2/stocks-governed.util.js +34 -0
  115. package/dist/utility/wrun/derived-roots.leaf.d.ts +13 -0
  116. package/dist/utility/wrun/derived-roots.leaf.js +27 -0
  117. package/dist/utility/wrun/derived-roots.util.d.ts +205 -0
  118. package/dist/utility/wrun/derived-roots.util.js +451 -0
  119. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +43 -7
  120. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
  121. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
  122. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
  123. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -2
  124. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -2
  125. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +24 -3
  126. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +46 -10
  127. package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
  128. package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
  129. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
  130. package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
  131. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
  132. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +2 -1
  133. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +3 -0
  134. package/dist/utility/wrun/sources/row-lanes/option_prints.js +19 -4
  135. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
  136. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +52 -13
  137. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +88 -19
  138. package/dist/utility/wrun/sources/row-lanes/option_surface.js +2 -1
  139. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
  140. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +24 -9
  141. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +41 -10
  142. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +111 -0
  143. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +133 -0
  144. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +15 -3
  145. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +22 -3
  146. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -0
  147. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +197 -13
  148. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +761 -27
  149. package/dist/utility/wrun/wrun-browser-sources.leaf.js +1 -2
  150. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
  151. package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
  152. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +60 -16
  153. package/dist/utility/wrun/wrun-chart-market-facts.util.js +113 -61
  154. package/dist/utility/wrun/wrun-color-settings.util.d.ts +9 -0
  155. package/dist/utility/wrun/wrun-color-settings.util.js +33 -0
  156. package/dist/utility/wrun/wrun-download-meter.util.d.ts +15 -0
  157. package/dist/utility/wrun/wrun-download-meter.util.js +14 -2
  158. package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
  159. package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
  160. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
  161. package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
  162. package/dist/utility/wrun/wrun-frames.d.ts +27 -6
  163. package/dist/utility/wrun/wrun-frames.js +73 -10
  164. package/dist/utility/wrun/wrun-handles.util.d.ts +7 -3
  165. package/dist/utility/wrun/wrun-handles.util.js +9 -8
  166. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
  167. package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
  168. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +18 -4
  169. package/dist/utility/wrun/wrun-hud-looks.util.js +45 -13
  170. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +68 -0
  171. package/dist/utility/wrun/wrun-input-requirements.leaf.js +163 -7
  172. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
  173. package/dist/utility/wrun/wrun-leg-close.util.d.ts +59 -23
  174. package/dist/utility/wrun/wrun-leg-close.util.js +186 -28
  175. package/dist/utility/wrun/wrun-live-intake.util.d.ts +35 -15
  176. package/dist/utility/wrun/wrun-live-intake.util.js +243 -126
  177. package/dist/utility/wrun/wrun-live-tick.util.d.ts +13 -5
  178. package/dist/utility/wrun/wrun-live-tick.util.js +279 -99
  179. package/dist/utility/wrun/wrun-market-facts.util.d.ts +13 -3
  180. package/dist/utility/wrun/wrun-market-facts.util.js +13 -3
  181. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +60 -11
  182. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +70 -5
  183. package/dist/utility/wrun/wrun-market-size-defaults.util.js +31 -5
  184. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
  185. package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
  186. package/dist/utility/wrun/wrun-option-book-rows.util.d.ts +56 -0
  187. package/dist/utility/wrun/wrun-option-book-rows.util.js +96 -0
  188. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
  189. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
  190. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +23 -6
  191. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +47 -11
  192. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +86 -19
  193. package/dist/utility/wrun/wrun-option-strike-flow.util.js +168 -62
  194. package/dist/utility/wrun/wrun-option-views.util.d.ts +323 -28
  195. package/dist/utility/wrun/wrun-option-views.util.js +484 -71
  196. package/dist/utility/wrun/wrun-options-chain.util.d.ts +3 -3
  197. package/dist/utility/wrun/wrun-options-chain.util.js +2 -0
  198. package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
  199. package/dist/utility/wrun/wrun-output-style.util.js +20 -2
  200. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +32 -2
  201. package/dist/utility/wrun/wrun-overlay-drivers.util.js +13 -3
  202. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
  203. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
  204. package/dist/utility/wrun/wrun-overlay-recovery.util.js +3 -1
  205. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +160 -42
  206. package/dist/utility/wrun/wrun-overlay-run.util.js +1244 -209
  207. package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
  208. package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
  209. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
  210. package/dist/utility/wrun/wrun-panel-mount.util.js +114 -19
  211. package/dist/utility/wrun/wrun-panel-style.util.d.ts +10 -9
  212. package/dist/utility/wrun/wrun-panel-style.util.js +58 -9
  213. package/dist/utility/wrun/wrun-param-map.util.d.ts +14 -11
  214. package/dist/utility/wrun/wrun-param-map.util.js +10 -5
  215. package/dist/utility/wrun/wrun-param-values.util.d.ts +14 -4
  216. package/dist/utility/wrun/wrun-param-values.util.js +4 -0
  217. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +15 -2
  218. package/dist/utility/wrun/wrun-pin-spelling.util.js +39 -14
  219. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
  220. package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
  221. package/dist/utility/wrun/wrun-refusal.util.d.ts +3 -2
  222. package/dist/utility/wrun/wrun-refusal.util.js +22 -0
  223. package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
  224. package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
  225. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +26 -0
  226. package/dist/utility/wrun/wrun-registry-errors.util.js +34 -0
  227. package/dist/utility/wrun/wrun-replay-lane.util.js +3 -2
  228. package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
  229. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +20 -6
  230. package/dist/utility/wrun/wrun-run-interval-session.util.js +22 -7
  231. package/dist/utility/wrun/wrun-run-interval.util.d.ts +43 -9
  232. package/dist/utility/wrun/wrun-run-interval.util.js +58 -15
  233. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +45 -1
  234. package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
  235. package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
  236. package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
  237. package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
  238. package/dist/utility/wrun/wrun-socket-row-source.js +118 -8
  239. package/dist/utility/wrun/wrun-source-rows.util.d.ts +29 -18
  240. package/dist/utility/wrun/wrun-source-rows.util.js +61 -27
  241. package/dist/utility/wrun/wrun-style-words.util.js +6 -4
  242. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
  243. package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
  244. package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
  245. package/dist/utility/wrun/wrun-tape-per-order.util.js +7 -0
  246. package/dist/utility/wrun/wrun-tape-source.util.d.ts +17 -9
  247. package/dist/utility/wrun/wrun-tape-source.util.js +20 -12
  248. package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
  249. package/dist/utils/replay/replay-buffer-math.js +227 -20
  250. package/dist/workers/constants/socket-slots.d.ts +91 -6
  251. package/dist/workers/constants/socket-slots.js +85 -6
  252. package/package.json +5 -5
@@ -15,11 +15,19 @@
15
15
  * code is unchanged reads it as it reads B: it reaches the package as the class's own block. A fold
16
16
  * (`answer: 'fold'`: totals, boards, the curve) answers rows of another layout, so an input naming one reads a view
17
17
  * block (`wrunOptionInputTupleWidth`: its projections' tuples as `[0, ...tuple]`, then each fold's rows as
18
- * `[layout, ...cells]`, every row padded to the class's `WRUN_OPTION_VIEW_ROW_WIDTHS`). This host reads
19
- * option_contract_state's folds (Top Contracts' totals); a view it does not read yet (`wrunOptionViewUnread`: an
20
- * options_chain fold, whose twin reads class tuples alone, and a state view that follows the chart's close, which
21
- * the state lane does not send) refuses by name before any read (`wrun_option_view_unread`), never an empty or
22
- * misread block.
18
+ * `[layout, ...cells]`, every row padded to the input's row width: the class's `WRUN_OPTION_VIEW_ROW_WIDTHS`, or a
19
+ * declared book fold's own when wider). This host reads option_contract_state's folds (Top Contracts' totals) and
20
+ * options_chain's book folds (below); a view it does not read yet (`wrunOptionViewUnread`: an options_chain fold of
21
+ * the block, which reads the chart's close, and a state view that follows the chart's close, which the state lane
22
+ * does not send) refuses by name before any read (`wrun_option_view_unread`), never an empty or misread block.
23
+ * - The book folds (D-DEDUPE phase 1b; the kit's `WRUN_OPTION_BOOK_VIEWS`, scaffold 105): options_chain's words also
24
+ * name the data plane's folds of the chain page's whole book (`numbers`, `vol_term`, `smile`, `surface`,
25
+ * `strike_profile`), the finished numbers the built-in options panes draw. Their knobs are judged by the kit's rules
26
+ * before any read (`wrunOptionBookViewIssue`), their ask carries each view's declared params alone (no live bar, no
27
+ * hint, no expiries word, no max-contracts size: `wrunOptionViewsReadBlock`), and their answer is laid out as the
28
+ * view block by the kit's reader (`wrunOptionBookViewRows`: one book stamp row, then each fold's rows, at the
29
+ * input's width). The worker reads them through the built-in panes' view state, so a package, a pane and the panel
30
+ * head asking the same folds share one read.
23
31
  * - Hinted views (`hinted`: the window board, the smile and surface reads, and the folds that read the close where a
24
32
  * contract carries no underlying: exposure, strike_table, gex_curve, oi_board) cover every close within
25
33
  * `WRUN_OPTION_VIEW_MARGIN_PCT` of the hint the ask carries, the chart's close at ask time; a run whose close left
@@ -28,9 +36,10 @@
28
36
  * for word by tests/utility/wrun/wrun-option-views.kit-pin.spec.ts.
29
37
  * - The per-bar words (OPTLOAD-CHAIN-PLAN 6.2, 6.3 and 9): `pick` on `option_surface` ("nearest_days" or
30
38
  * "tenor_bracket", the bar's newest 5m bucket picked to the tuples Skew History and Options Sentiment read) and
31
- * `fold` "kit" on `option_strikes` (the bar's newest minute folded to one levels row and the strike rows Spot
32
- * Exposures draws), their params read by the SDK's rules (`WRUN_OPTION_LANE_KNOBS`, `wrunOptionLaneAskOfSource`) and
33
- * asked of the gateway in the lane's fields (`wrunOptionLaneAskFields`, the `OptionReadShape` G5 fields 40 to 51).
39
+ * `fold` "kit" on `option_strikes` (the bar's newest minute folded to one levels row, with `curve` the gamma curve's
40
+ * row after it, and the strike rows Spot Exposures draws), their params read by the SDK's rules
41
+ * (`WRUN_OPTION_LANE_KNOBS`, `wrunOptionLaneAskOfSource`) and asked of the gateway in the lane's fields
42
+ * (`wrunOptionLaneAskFields`, the `OptionReadShape` G5 fields 40 to 53).
34
43
  * The kit fold keeps its expiries with its own `nearest`: an `expiries` word other than "all" beside it is refused
35
44
  * at declaration (kit 0.91.1, `WRUN_OPTION_STRIKES_KIT_EXPIRIES_TAKES`).
36
45
  * - The ask's payload fields (`wrunOptionViewLaneFields`): `<prefix>Views`, the canonical text (`wrunOptionViewsText`:
@@ -53,9 +62,10 @@ import { gateSessionHeldElsewhere } from '../v2/gate-session-latch.util.js';
53
62
  import { refuseWrunPollInput } from './sources/wrun-poll-lane.types.js';
54
63
  import { refuseWrunOptionKnob } from './wrun-option-knobs.util.js';
55
64
  import { wrunPresentHasBit, wrunPresentIsPartial, wrunPresentWithPartial } from './wrun-present-bits.util.js';
56
- import { wrunAuthorRuleSeed } from './wrun-refusal.util.js';
57
- /** Every view word, in section 6.1's order. The worker names each by `OPTION_CHAIN_VIEW_<WORD>` (pb-common
58
- * `OptionChainViewKind`; tests/utility/wrun/wrun-option-views.util.spec.ts pins every name). */
65
+ import { attachWrunRefusal, wrunAuthorRuleSeed } from './wrun-refusal.util.js';
66
+ /** Every view word of the block, in section 6.1's order (the book folds follow on options_chain,
67
+ * `WRUN_OPTION_BOOK_VIEWS`). The worker names each by `OPTION_CHAIN_VIEW_<WORD>` (pb-common `OptionChainViewKind`;
68
+ * tests/utility/wrun/wrun-option-views.util.spec.ts pins every name). */
59
69
  export const WRUN_OPTION_VIEWS = Object.freeze({
60
70
  whole: { cls: 'options_chain', params: {}, answer: 'tuples' },
61
71
  clock: { cls: 'options_chain', params: {}, answer: 'tuples' },
@@ -140,27 +150,34 @@ export const WRUN_OPTION_VIEWS_ONE_ASK_CODE = 'wrun_option_views_one_ask';
140
150
  * B of the gateway, built for one `nearestExpiries`, so an input of another word would read views of another B (the
141
151
  * SDK asks each word apart; one acquisition per word would serve them). */
142
152
  export const WRUN_OPTION_VIEWS_ONE_EXPIRIES_CODE = 'wrun_option_views_one_expiries';
143
- /** A view's spec, or undefined for a word that names none. */
153
+ /** A view's spec, a view of the block or a book fold (the kit's `wrunOptionPageViewSpec`), or undefined for a word
154
+ * that names none. */
144
155
  export function wrunOptionViewSpec(word) {
145
- return typeof word === 'string' && Object.prototype.hasOwnProperty.call(WRUN_OPTION_VIEWS, word)
146
- ? WRUN_OPTION_VIEWS[word]
147
- : undefined;
156
+ if (typeof word === 'string' && Object.prototype.hasOwnProperty.call(WRUN_OPTION_VIEWS, word)) {
157
+ return WRUN_OPTION_VIEWS[word];
158
+ }
159
+ return wrunOptionBookViewSpec(word);
148
160
  }
149
161
  /**
150
162
  * What this host reads of each class's views (web: the `k-options-chain` and `k-option-contract-state` workers and
151
- * their lanes): `folds`, whether the twin reads a fold's rows (option_contract_state's twin reads the answer's fold
152
- * entries as the view block, `optionsChainViewRows`; options_chain's reads class tuples alone); `hint`, whether the
163
+ * their lanes): `folds`, whether the twin reads a fold of the block's rows (option_contract_state's twin reads the
164
+ * answer's fold entries as the view block, `optionsChainViewRows`; options_chain's folds of the block read the chart's
165
+ * close where a contract carries no underlying, and its twin reads none of them); `books`, whether it reads the book
166
+ * folds' rows (options_chain's twin lays them out as the view block, `wrunOptionBookViewRows`); `hint`, whether the
153
167
  * lane sends a hinted view the chart's close (`chainSpotHint`; the state lane sends none, and the gateway and the kit
154
168
  * refuse a hinted view without it).
155
169
  */
156
170
  const WRUN_OPTION_VIEW_HOST_READS = Object.freeze({
157
- options_chain: Object.freeze({ folds: false, hint: true }),
158
- option_contract_state: Object.freeze({ folds: true, hint: false }),
171
+ options_chain: Object.freeze({ folds: false, books: true, hint: true }),
172
+ option_contract_state: Object.freeze({ folds: true, books: false, hint: false }),
159
173
  });
160
174
  /** Why this host does not read a view yet, in a refusal's words, or undefined when it reads it (every projection,
161
- * option_contract_state's folds but `oi_board`, which follows the chart's close). */
175
+ * options_chain's book folds, option_contract_state's folds but `oi_board`, which follows the chart's close). */
162
176
  export function wrunOptionViewUnread(spec) {
163
177
  const reads = WRUN_OPTION_VIEW_HOST_READS[spec.cls];
178
+ if (spec.book === true) {
179
+ return reads.books ? undefined : `it is a book fold, whose rows no ${spec.cls} reader of this host takes`;
180
+ }
164
181
  if (spec.answer === 'fold' && !reads.folds) {
165
182
  return `its answer is a fold, whose rows no ${spec.cls} reader of this host takes yet`;
166
183
  }
@@ -169,12 +186,17 @@ export function wrunOptionViewUnread(spec) {
169
186
  }
170
187
  return undefined;
171
188
  }
189
+ /** Every word of one class in its table's order (the kit's `wrunOptionViewWords`): on options_chain the views of the
190
+ * block, then the book folds. */
191
+ function wrunOptionPageViewWordsOf(cls) {
192
+ const block = Object.keys(WRUN_OPTION_VIEWS).filter((word) => WRUN_OPTION_VIEWS[word].cls === cls);
193
+ return cls === 'options_chain' ? [...block, ...WRUN_OPTION_BOOK_VIEW_WORDS] : block;
194
+ }
172
195
  /** The words of one class, spelled for a refusal. */
173
196
  function wrunOptionViewWordsOf(cls) {
174
- const words = Object.keys(WRUN_OPTION_VIEWS)
175
- .filter((word) => WRUN_OPTION_VIEWS[word].cls === cls)
176
- .map((word) => `"${word}"`);
177
- return `one of ${words.join(', ')}`;
197
+ return `one of ${wrunOptionPageViewWordsOf(cls)
198
+ .map((word) => `"${word}"`)
199
+ .join(', ')}`;
178
200
  }
179
201
  /**
180
202
  * The knobs an input names its views in: `page_view` (one word) or `page_views` (a list), the chain page's views
@@ -222,7 +244,11 @@ function declaredViewWords(source, ctx) {
222
244
  * An input's views, validated (main thread, after the paint seam): undefined when it declares none (today's path),
223
245
  * else the views in canonical order (`canonicalViews`). Refuses by name a word that names no view of the input's
224
246
  * class, a view this host does not read yet (`wrunOptionViewUnread`), and a param that is no finite number (a
225
- * `"@<param>"` the sheet declares no param of stays a string here).
247
+ * `"@<param>"` the sheet declares no param of stays a string here). An input naming a book fold has every word judged
248
+ * first, then its book knobs by the kit's rules (`wrunOptionBookViewIssue`: a value outside what a knob takes on a
249
+ * declared word, a book knob no declared word takes, `nearest` beside `days`, an `expiries` word other than "all"),
250
+ * each refused by its knob (`wrun_option_knob_invalid`) with the kit's words; an input of views of the block alone
251
+ * is read word by word, as before.
226
252
  */
227
253
  export function wrunOptionViewsOfSource(input, ctx, cls) {
228
254
  // A sheet's input source, read by knob name (its knobs are open: the class's own and each view's params).
@@ -230,23 +256,35 @@ export function wrunOptionViewsOfSource(input, ctx, cls) {
230
256
  const words = declaredViewWords(source, ctx);
231
257
  if (words === undefined)
232
258
  return undefined;
233
- const views = [];
234
- for (const word of words) {
259
+ const wordKnob = source[WRUN_OPTION_VIEW_KNOB] !== undefined ? WRUN_OPTION_VIEW_KNOB : WRUN_OPTION_VIEWS_KNOB;
260
+ const specOf = (word) => {
235
261
  const spec = wrunOptionViewSpec(word);
236
- const knob = source[WRUN_OPTION_VIEW_KNOB] !== undefined ? WRUN_OPTION_VIEW_KNOB : WRUN_OPTION_VIEWS_KNOB;
237
262
  if (spec === undefined || spec.cls !== cls) {
238
- return refuseWrunOptionKnob(ctx, knob, word, wrunOptionViewWordsOf(cls));
263
+ return refuseWrunOptionKnob(ctx, wordKnob, word, wrunOptionViewWordsOf(cls));
239
264
  }
240
265
  const unread = wrunOptionViewUnread(spec);
241
266
  if (unread !== undefined) {
242
- return refuseWrunPollInput(ctx, `reads ${cls} with ${knob} "${String(word)}" (${WRUN_OPTION_VIEW_UNREAD_CODE}): ${unread}; declare another ` +
243
- 'view or read the block whole', wrunAuthorRuleSeed(WRUN_OPTION_VIEW_UNREAD_CODE));
267
+ return refuseWrunPollInput(ctx, `reads ${cls} with ${wordKnob} "${String(word)}" (${WRUN_OPTION_VIEW_UNREAD_CODE}): ${unread}; declare ` +
268
+ 'another view or read the block whole', wrunAuthorRuleSeed(WRUN_OPTION_VIEW_UNREAD_CODE));
244
269
  }
270
+ return spec;
271
+ };
272
+ if (words.some(wrunOptionPageViewIsBook)) {
273
+ for (const word of words)
274
+ specOf(word);
275
+ const issue = wrunOptionBookViewIssue(source, words);
276
+ if (issue !== undefined)
277
+ return refuseWrunOptionKnob(ctx, issue.knob, issue.value, issue.takes);
278
+ }
279
+ const views = [];
280
+ for (const word of words) {
281
+ const spec = specOf(word);
245
282
  const params = {};
246
283
  for (const [knob, wire] of Object.entries(spec.params)) {
247
284
  const value = source[knob];
248
285
  if (value === undefined)
249
286
  continue;
287
+ // A book fold's knob reached here judged already: a number its knob takes on every declared word.
250
288
  if (typeof value !== 'number' || !Number.isFinite(value)) {
251
289
  return refuseWrunOptionKnob(ctx, knob, value, `a finite number, or "@<param>" naming a number param the sheet declares (view "${String(word)}")`);
252
290
  }
@@ -266,9 +304,35 @@ function canonicalViews(views) {
266
304
  }
267
305
  return [...byText.entries()].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(([, view]) => view);
268
306
  }
269
- /** The union of several inputs' views, canonical. */
307
+ /** The most views one ask names: the data plane's `MaxViews` (it refuses an ask naming more). */
308
+ export const WRUN_OPTION_VIEWS_MAX_PER_ASK = 16;
309
+ /** The plan's refusal of one lane whose inputs' views make an ask of more views than the data plane answers. */
310
+ export const WRUN_OPTION_VIEWS_TOO_MANY_CODE = 'wrun_option_views_too_many';
311
+ /** The plan's refusal of one options_chain lane whose view inputs read a book fold and different views: the lane asks
312
+ * their union ONCE, and a book fold's rows name no input, so each input would read every other input's book rows (two
313
+ * `numbers` asks' scope and expiry rows twice over), and an input narrower than the union's widest word would read
314
+ * none of them (an input's reader keeps the rows of its own width alone). */
315
+ export const WRUN_OPTION_BOOK_VIEWS_ONE_ASK_CODE = 'wrun_option_book_views_one_ask';
316
+ /**
317
+ * The union of several inputs' views, canonical: the views one lane asks for every input it serves. Refused by name
318
+ * before any read: inputs that read a book fold and different views (`WRUN_OPTION_BOOK_VIEWS_ONE_ASK_CODE`; one input
319
+ * may name several words), and a union of more views than one ask may name (`WRUN_OPTION_VIEWS_MAX_PER_ASK`). One
320
+ * input's views never pass the cap (each word once).
321
+ */
270
322
  export function wrunOptionViewsUnion(sets) {
271
- return canonicalViews(sets.flat());
323
+ const texts = new Set(sets.map((views) => wrunOptionViewsText(views)));
324
+ if (texts.size > 1 && sets.some((views) => views.some((view) => wrunOptionPageViewIsBook(view.view)))) {
325
+ throw attachWrunRefusal(new Error(`options_chain inputs of one lane read a book fold and different views (${WRUN_OPTION_BOOK_VIEWS_ONE_ASK_CODE}): ` +
326
+ "the lane asks their views once, and a book fold's rows name no input; declare the book folds and the " +
327
+ 'views beside them on one input (an input may name several words), or the same views on every view input'), wrunAuthorRuleSeed(WRUN_OPTION_BOOK_VIEWS_ONE_ASK_CODE));
328
+ }
329
+ const union = canonicalViews(sets.flat());
330
+ if (union.length > WRUN_OPTION_VIEWS_MAX_PER_ASK) {
331
+ throw attachWrunRefusal(new Error(`the inputs' views make one ask of ${union.length} views (${WRUN_OPTION_VIEWS_TOO_MANY_CODE}): the market ` +
332
+ `data server answers at most ${WRUN_OPTION_VIEWS_MAX_PER_ASK} views an ask; declare fewer views, or fewer ` +
333
+ 'values of one view across the inputs'), wrunAuthorRuleSeed(WRUN_OPTION_VIEWS_TOO_MANY_CODE));
334
+ }
335
+ return union;
272
336
  }
273
337
  /** The canonical text of a set of views (the payload's `<prefix>Views`). */
274
338
  export function wrunOptionViewsText(views) {
@@ -321,16 +385,17 @@ const WRUN_OPTION_VIEW_PREFIX = Object.freeze({
321
385
  options_chain: 'chain',
322
386
  option_contract_state: 'state',
323
387
  });
324
- /** A view ask's payload fields (see the module doc). */
388
+ /** A view ask's payload fields (see the module doc). The gateway's scope inputs size B: an options_chain ask naming
389
+ * book folds alone reads no B, so it carries neither (`wrunOptionViewsReadBlock`), nor the hint margin (no book fold
390
+ * is hinted); a mixed ask keeps them for the views of the block. */
325
391
  export function wrunOptionViewLaneFields(cls, views, scope = {}) {
326
392
  const prefix = WRUN_OPTION_VIEW_PREFIX[cls];
393
+ const sizesBlock = cls === 'options_chain' && wrunOptionViewsReadBlock(views);
327
394
  return {
328
395
  [`${prefix}Views`]: wrunOptionViewsText(views),
329
396
  ...(wrunOptionViewsHinted(views) ? { [`${prefix}SpotMarginPct`]: WRUN_OPTION_VIEW_MARGIN_PCT } : {}),
330
- ...(cls === 'options_chain' && scope.nearestExpiries !== undefined
331
- ? { chainNearestExpiries: scope.nearestExpiries }
332
- : {}),
333
- ...(cls === 'options_chain' && scope.maxContracts !== undefined ? { chainMaxContracts: scope.maxContracts } : {}),
397
+ ...(sizesBlock && scope.nearestExpiries !== undefined ? { chainNearestExpiries: scope.nearestExpiries } : {}),
398
+ ...(sizesBlock && scope.maxContracts !== undefined ? { chainMaxContracts: scope.maxContracts } : {}),
334
399
  };
335
400
  }
336
401
  /** The view fields of a payload, as they ride (a K control copies them onto the request it builds). */
@@ -410,10 +475,12 @@ export function wrunOptionViewAskFieldsOf(cls, payload) {
410
475
  const hinted = wrunOptionViewsHinted(views);
411
476
  const spotHint = hinted ? positiveNumber(payload[`${prefix}SpotHint`]) : undefined;
412
477
  const spotMarginPct = hinted ? positiveNumber(payload[`${prefix}SpotMarginPct`]) : undefined;
478
+ // B's facts ride an ask that reads B: book folds alone read the page's book, keyed as the built-in panes key them.
479
+ const sizesBlock = wrunOptionViewsReadBlock(views);
413
480
  return {
414
481
  views,
415
- ...(nearestExpiries !== undefined ? { nearestExpiries } : {}),
416
- ...(maxContracts !== undefined ? { maxContracts } : {}),
482
+ ...(sizesBlock && nearestExpiries !== undefined ? { nearestExpiries } : {}),
483
+ ...(sizesBlock && maxContracts !== undefined ? { maxContracts } : {}),
417
484
  ...(spotHint !== undefined ? { spotHint } : {}),
418
485
  ...(spotHint !== undefined && spotMarginPct !== undefined ? { spotMarginPct } : {}),
419
486
  };
@@ -519,7 +586,7 @@ export function wrunOptionLaneParamKnobs(cls) {
519
586
  }
520
587
  return [...knobs];
521
588
  }
522
- /** Whether a number is a legal value of a per-bar knob, a flag's 0 or 1 included (the SDK's
589
+ /** Whether a number is a legal value of a per-bar or book fold knob, a flag's 0 or 1 included (the SDK's
523
590
  * `wrunOptionKnobSpecLegal`). */
524
591
  export function wrunOptionKnobSpecLegal(spec, value) {
525
592
  if (!Number.isFinite(value))
@@ -528,6 +595,8 @@ export function wrunOptionKnobSpecLegal(spec, value) {
528
595
  return value === 0 || value === 1;
529
596
  if (spec.codes !== undefined)
530
597
  return Object.prototype.hasOwnProperty.call(spec.codes, String(value));
598
+ if (spec.zero === true && value === 0)
599
+ return true;
531
600
  if (spec.kind === 'whole' && !Number.isInteger(value))
532
601
  return false;
533
602
  if (spec.min !== undefined && (spec.above === true ? !(value > spec.min) : value < spec.min))
@@ -536,7 +605,7 @@ export function wrunOptionKnobSpecLegal(spec, value) {
536
605
  return false;
537
606
  return true;
538
607
  }
539
- /** What a per-bar knob takes, as a refusal spells it (the SDK's `wrunOptionKnobSpecTakes`). */
608
+ /** What a per-bar or book fold knob takes, as a refusal spells it (the SDK's `wrunOptionKnobSpecTakes`). */
540
609
  export function wrunOptionKnobSpecTakes(spec) {
541
610
  if (spec.kind === 'flag')
542
611
  return `true or false (${spec.what})`;
@@ -548,7 +617,8 @@ export function wrunOptionKnobSpecTakes(spec) {
548
617
  const hi = spec.max === undefined ? '' : `${spec.below === true ? 'below' : 'up to'} ${spec.max}`;
549
618
  const span = [lo, hi].filter((part) => part !== '').join(', ');
550
619
  const kind = spec.kind === 'whole' ? 'a whole number' : spec.kind === 'time' ? 'an instant in epoch seconds' : 'a number';
551
- return `${spec.what}, ${kind}${span === '' ? '' : ` ${span}`}, or "@<param>" naming a declared setting`;
620
+ const zero = spec.zero === true ? '0 or ' : '';
621
+ return `${spec.what}, ${zero}${kind}${span === '' ? '' : ` ${span}`}, or "@<param>" naming a declared setting`;
552
622
  }
553
623
  /**
554
624
  * ONE reader of a per-bar class's knobs, the SDK's `wrunOptionViewAskOf` for `option_surface` and `option_strikes`
@@ -635,6 +705,239 @@ export function wrunOptionLaneAskOfSource(source, ctx) {
635
705
  return refuseWrunOptionKnob(ctx, read.issue.knob, read.issue.value, read.issue.takes);
636
706
  return read.ask;
637
707
  }
708
+ /** A book fold's scope: the nearest live expiries (0, its default, every one). */
709
+ const BOOK_NEAREST = Object.freeze({
710
+ kind: 'whole',
711
+ min: 0,
712
+ max: 64,
713
+ what: 'the nearest live expiries (0: every one)',
714
+ });
715
+ /** A book fold's scope: the live expiries whose stamp is at most this many days after the book's instant. */
716
+ const BOOK_DAYS = Object.freeze({
717
+ ...DAYS_SPEC,
718
+ what: 'the live expiries whose stamp is at most this many days away',
719
+ });
720
+ /** A smile's or a surface's strike window about S0. */
721
+ const BOOK_WINDOW = Object.freeze({
722
+ kind: 'number',
723
+ min: 0,
724
+ max: 100,
725
+ above: true,
726
+ what: "the strikes within this percent of S0 (the book's spot) each side",
727
+ });
728
+ /** Every book fold, in kind order (the kit's `WRUN_OPTION_BOOK_VIEWS`): the wire's kind is OPTION_CHAIN_VIEW_<WORD>
729
+ * (numbers 20, vol_term 22, smile 23, surface 24, strike_profile 25). Their words follow the views of the block on
730
+ * options_chain. */
731
+ export const WRUN_OPTION_BOOK_VIEWS = Object.freeze({
732
+ numbers: {
733
+ cls: 'options_chain',
734
+ answer: 'fold',
735
+ book: true,
736
+ kind: 20,
737
+ params: { nearest: 'nearest', days: 'days' },
738
+ knobs: { nearest: BOOK_NEAREST, days: BOOK_DAYS },
739
+ defaults: { nearest: 0, days: 0 },
740
+ layouts: ['numbers'],
741
+ },
742
+ vol_term: {
743
+ cls: 'options_chain',
744
+ answer: 'fold',
745
+ book: true,
746
+ kind: 22,
747
+ params: {},
748
+ knobs: {},
749
+ defaults: {},
750
+ layouts: ['vol_term'],
751
+ },
752
+ smile: {
753
+ cls: 'options_chain',
754
+ answer: 'fold',
755
+ book: true,
756
+ kind: 23,
757
+ params: { count: 'count', window_pct: 'windowPct' },
758
+ knobs: {
759
+ count: Object.freeze({
760
+ kind: 'whole',
761
+ min: 1,
762
+ max: 3,
763
+ what: "the smile's series (the expiries nearest today, 7 and 30 days out, the first N)",
764
+ }),
765
+ window_pct: BOOK_WINDOW,
766
+ },
767
+ defaults: { count: 3, windowPct: 40 },
768
+ layouts: ['smile_series', 'smile_point'],
769
+ },
770
+ surface: {
771
+ cls: 'options_chain',
772
+ answer: 'fold',
773
+ book: true,
774
+ kind: 24,
775
+ params: { lens: 'lens', window_pct: 'windowPct', columns: 'columns', rows: 'rows' },
776
+ knobs: {
777
+ lens: Object.freeze({
778
+ kind: 'whole',
779
+ codes: Object.freeze({ 0: 'gex', 1: 'oi', 2: 'iv', 3: 'dex', 4: 'vex' }),
780
+ what: 'the lens',
781
+ }),
782
+ window_pct: BOOK_WINDOW,
783
+ columns: Object.freeze({ kind: 'whole', min: 1, max: 16, what: 'the expiry columns' }),
784
+ rows: Object.freeze({ kind: 'whole', min: 1, max: 64, what: 'the strike rows' }),
785
+ },
786
+ defaults: { lens: 0, windowPct: 20, columns: 8, rows: 21 },
787
+ layouts: ['surface_cell'],
788
+ },
789
+ strike_profile: {
790
+ cls: 'options_chain',
791
+ answer: 'fold',
792
+ book: true,
793
+ kind: 25,
794
+ params: {
795
+ nearest: 'nearest',
796
+ days: 'days',
797
+ window_pct: 'windowPct',
798
+ strikes: 'strikes',
799
+ points: 'points',
800
+ half_pct: 'halfPct',
801
+ },
802
+ knobs: {
803
+ nearest: BOOK_NEAREST,
804
+ days: BOOK_DAYS,
805
+ window_pct: Object.freeze({
806
+ kind: 'number',
807
+ min: 0,
808
+ max: 100,
809
+ what: 'the strike rows within this percent of S0 (0: every strike)',
810
+ }),
811
+ strikes: Object.freeze({
812
+ kind: 'whole',
813
+ codes: Object.freeze({ 0: 'no strike rows', 1: 'a row a strike' }),
814
+ what: 'the strike rows',
815
+ }),
816
+ points: Object.freeze({ kind: 'whole', min: 2, max: 1000, zero: true, what: "the curve's points (0: no curve)" }),
817
+ half_pct: Object.freeze({
818
+ kind: 'number',
819
+ min: 0,
820
+ max: 50,
821
+ above: true,
822
+ what: "the curve's reach, a percent of S0 each side",
823
+ }),
824
+ },
825
+ defaults: { nearest: 0, days: 0, windowPct: 0, strikes: 1, points: 0, halfPct: 15 },
826
+ layouts: ['profile_strike', 'profile_levels', 'profile_point'],
827
+ },
828
+ });
829
+ /** The book folds' words, in kind order. */
830
+ export const WRUN_OPTION_BOOK_VIEW_WORDS = Object.freeze(Object.keys(WRUN_OPTION_BOOK_VIEWS));
831
+ /** f64s per view block row of each book word (the kit's `WRUN_OPTION_BOOK_VIEW_ROW_WIDTHS`): the layout column, then
832
+ * the wider of its widest layout and the book stamp (ten cells, riding every book answer). An input's rows are the
833
+ * widest of its words (`wrunOptionViewWordsRowWidth`), never narrower than the class's view row. */
834
+ export const WRUN_OPTION_BOOK_VIEW_ROW_WIDTHS = Object.freeze({
835
+ numbers: 12,
836
+ vol_term: 16,
837
+ smile: 11,
838
+ surface: 11,
839
+ strike_profile: 13,
840
+ });
841
+ /** What options_chain's `expiries` takes beside a book fold (the kit's `WRUN_OPTION_BOOK_EXPIRIES_TAKES`): its default
842
+ * alone. A book fold reads the whole book, so any other word would be dropped unseen. */
843
+ export const WRUN_OPTION_BOOK_EXPIRIES_TAKES = '"all" (or no expiries) beside a book fold (numbers, vol_term, smile, surface, strike_profile): it reads the whole book; a fold\'s own nearest or days scopes it';
844
+ /** What a book fold's `days` takes beside `nearest` on a word that takes both (the kit's
845
+ * `WRUN_OPTION_BOOK_SCOPE_TAKES`): nothing (the data plane refuses two scopes). */
846
+ export const WRUN_OPTION_BOOK_SCOPE_TAKES = 'one scope of a book fold\'s expiries, "nearest" or "days", never both';
847
+ /** The knobs a view of the block shares with a book fold on options_chain, as that view takes them (the kit's
848
+ * `WRUN_OPTION_PAGE_VIEW_KNOBS` rows): a shared knob takes one value for every declared word and must be legal on
849
+ * each (`wrunOptionBookViewIssue`), so `nearest` 0 refuses beside `exposure`, `lens` 5 and 6 beside `surface`, and
850
+ * `points` 0 beside `horizon_otm` and `gex_curve`. */
851
+ export const WRUN_OPTION_BOOK_SHARED_KNOBS = Object.freeze({
852
+ horizon_otm: Object.freeze({
853
+ points: Object.freeze({ kind: 'whole', min: 2, max: 1000, what: "the grid's strikes" }),
854
+ }),
855
+ exposure: Object.freeze({
856
+ lens: Object.freeze({
857
+ kind: 'whole',
858
+ codes: Object.freeze({ 0: 'gamma', 1: 'delta', 2: 'vanna', 3: 'charm', 4: 'vega', 5: 'iv_x_oi', 6: 'oi' }),
859
+ what: 'the lens',
860
+ }),
861
+ nearest: Object.freeze({ kind: 'whole', min: 1, max: 64, what: 'the nearest expiries counted' }),
862
+ }),
863
+ gex_curve: Object.freeze({
864
+ points: Object.freeze({ kind: 'whole', min: 2, max: 1000, what: "the grid's spots" }),
865
+ }),
866
+ });
867
+ /** A book fold's spec, or undefined for a word that names none. */
868
+ export function wrunOptionBookViewSpec(word) {
869
+ return typeof word === 'string' && Object.prototype.hasOwnProperty.call(WRUN_OPTION_BOOK_VIEWS, word)
870
+ ? WRUN_OPTION_BOOK_VIEWS[word]
871
+ : undefined;
872
+ }
873
+ /** Whether a word names a book fold. */
874
+ export function wrunOptionPageViewIsBook(word) {
875
+ return wrunOptionBookViewSpec(word) !== undefined;
876
+ }
877
+ /** Whether an ask's views read the block B (the kit's `wrunOptionViewsReadBlock`): any view but a book fold. Only such
878
+ * an ask carries B's facts (the live bar's open on each view of B, the expiries word and the max-contracts size B is
879
+ * shaped by, the spot hint of a hinted view); an ask naming book folds alone carries each view's kind and its own
880
+ * params, nothing else. */
881
+ export function wrunOptionViewsReadBlock(views) {
882
+ return views.some(({ view }) => !wrunOptionPageViewIsBook(view));
883
+ }
884
+ /** Whether a word of options_chain takes a knob: a book fold its own knobs, a view of the block its params. */
885
+ function chainWordTakes(word, knob) {
886
+ const book = wrunOptionBookViewSpec(word);
887
+ if (book !== undefined)
888
+ return Object.prototype.hasOwnProperty.call(book.knobs, knob);
889
+ const spec = wrunOptionViewSpec(word);
890
+ return spec?.cls === 'options_chain' && Object.prototype.hasOwnProperty.call(spec.params, knob);
891
+ }
892
+ /** The book knobs in the kit's order (`wrunOptionViewParamKnobsOf("options_chain")`: each word's knobs in the class's
893
+ * word order, the views of the block first, each knob once): the order their issues are judged in. */
894
+ const WRUN_OPTION_BOOK_KNOB_ORDER = Object.freeze(wrunOptionPageViewWordsOf('options_chain')
895
+ .flatMap((word) => Object.keys(wrunOptionBookViewSpec(word)?.knobs ?? wrunOptionViewSpec(word)?.params ?? {}))
896
+ .filter((knob, at, knobs) => knobs.indexOf(knob) === at)
897
+ .filter((knob) => WRUN_OPTION_BOOK_VIEW_WORDS.some((word) => chainWordTakes(word, knob))));
898
+ /**
899
+ * The first issue of an options_chain input's book knobs, the kit's rules (`wrunOptionViewAskOf`) in its order, or
900
+ * undefined (also for words naming no book fold: an input of views of the block alone keeps its reads): each declared
901
+ * knob a book fold takes, legal on every declared word that takes it (a book fold's own spec, a view of the block's
902
+ * shared one, `WRUN_OPTION_BOOK_SHARED_KNOBS`), else refused with what it takes there and the word; such a knob beside
903
+ * no declared word that takes it (`a param of "<word>" only`); `nearest` beside `days` on a word that takes both
904
+ * (`WRUN_OPTION_BOOK_SCOPE_TAKES`); the class's `expiries` other than "all" (`WRUN_OPTION_BOOK_EXPIRIES_TAKES`). A
905
+ * view of the block's own knobs are the kit planner's where the rows are built.
906
+ */
907
+ export function wrunOptionBookViewIssue(source, words) {
908
+ const books = words.filter(wrunOptionPageViewIsBook);
909
+ if (books.length === 0)
910
+ return undefined;
911
+ for (const knob of WRUN_OPTION_BOOK_KNOB_ORDER) {
912
+ const value = source[knob];
913
+ if (value === undefined)
914
+ continue;
915
+ const takers = words.filter((word) => chainWordTakes(word, knob));
916
+ if (takers.length === 0) {
917
+ const owners = wrunOptionPageViewWordsOf('options_chain').filter((word) => chainWordTakes(word, knob));
918
+ return { knob, value, takes: `a param of ${owners.map((owner) => `"${owner}"`).join(', ')} only` };
919
+ }
920
+ for (const word of takers) {
921
+ const spec = wrunOptionBookViewSpec(word)?.knobs[knob] ?? WRUN_OPTION_BOOK_SHARED_KNOBS[word]?.[knob];
922
+ if (spec === undefined)
923
+ continue;
924
+ if (typeof value !== 'number' || !wrunOptionKnobSpecLegal(spec, value)) {
925
+ return { knob, value, takes: `${wrunOptionKnobSpecTakes(spec)} (${word})` };
926
+ }
927
+ }
928
+ }
929
+ const scoped = books.find((word) => {
930
+ const { knobs } = WRUN_OPTION_BOOK_VIEWS[word];
931
+ return (Object.prototype.hasOwnProperty.call(knobs, 'nearest') && Object.prototype.hasOwnProperty.call(knobs, 'days'));
932
+ });
933
+ if (scoped !== undefined && source.nearest !== undefined && source.days !== undefined) {
934
+ return { knob: 'days', value: source.days, takes: `${WRUN_OPTION_BOOK_SCOPE_TAKES} (${scoped})` };
935
+ }
936
+ if (source.expiries !== undefined && source.expiries !== 'all') {
937
+ return { knob: 'expiries', value: source.expiries, takes: WRUN_OPTION_BOOK_EXPIRIES_TAKES };
938
+ }
939
+ return undefined;
940
+ }
638
941
  /** f64s per row of a view block (the page views' folds) and of the strike kit fold (the SDK's
639
942
  * `WRUN_OPTION_VIEW_ROW_WIDTHS`): the layout, then the widest layout's fields. */
640
943
  export const WRUN_OPTION_VIEW_ROW_WIDTHS = Object.freeze({
@@ -648,28 +951,106 @@ export const WRUN_OPTION_STRIKES_KIT_LAYOUTS = Object.freeze({ strike: 0, levels
648
951
  /** The column of a kit levels row that says the bar was refused (its newest minute held more rows than the input's
649
952
  * `max_cells`): 1 refused, 0 served. */
650
953
  export const WRUN_OPTION_STRIKES_KIT_REFUSED_COLUMN = 13;
651
- /** Whether page view words name a fold of `cls` (the SDK's `wrunOptionViewWordsFold` on a page view class). */
652
- function pageViewWordsFold(cls, words) {
954
+ /**
955
+ * `option_strikes`' strike velocity knob (contract H; the om schema takes the knob by this name and shape): a literal
956
+ * list of 1 to 7 distinct windows in minutes, each one of `WRUN_OPTION_STRIKES_VELOCITY_WINDOWS`, in the order its
957
+ * columns take. A setting's handle (`"@param"`) never names it: the windows size the block, and a setting never
958
+ * resizes one (`wrunOptionInputTupleWidth`).
959
+ */
960
+ export const WRUN_OPTION_STRIKES_VELOCITY_KNOB = 'velocity_windows';
961
+ /** The windows the gateway answers velocity over (tsdb-gateway `optionStrikeVelocityWindows`), in minutes. */
962
+ export const WRUN_OPTION_STRIKES_VELOCITY_WINDOWS = Object.freeze([1, 5, 10, 15, 60, 240, 1440]);
963
+ /** What `velocity_windows` takes, for a refusal. */
964
+ export const WRUN_OPTION_STRIKES_VELOCITY_TAKES = 'a list of 1 to 7 distinct windows in minutes, each one of 1, 5, 10, 15, 60, 240 and 1440';
965
+ /** The ask's field the windows ride (the K control copies it, the worker twin reads it), in the knob's order. */
966
+ export const WRUN_OPTION_STRIKES_VELOCITY_FIELD = 'strikeVelocityWindowsMin';
967
+ /**
968
+ * The velocity lists a tuple appends after `underlying` when the knob is set, in this order, each one entry per window
969
+ * in the knob's order: the change of net GEX, net DEX, net VEX, and the open interest (calls plus puts, in contracts).
970
+ */
971
+ export const WRUN_OPTION_STRIKES_VELOCITY_LISTS = Object.freeze([
972
+ 'net_gex_velocity',
973
+ 'net_dex_velocity',
974
+ 'net_vex_velocity',
975
+ 'oi_velocity',
976
+ ]);
977
+ /** A `velocity_windows` value's windows in its own order, or undefined for a value outside the knob's words. */
978
+ export function wrunOptionStrikesVelocityWindows(value) {
979
+ if (!Array.isArray(value) || value.length < 1 || value.length > WRUN_OPTION_STRIKES_VELOCITY_WINDOWS.length) {
980
+ return undefined;
981
+ }
982
+ if (!value.every((window) => typeof window === 'number' && WRUN_OPTION_STRIKES_VELOCITY_WINDOWS.includes(window))) {
983
+ return undefined;
984
+ }
985
+ return new Set(value).size === value.length ? [...value] : undefined;
986
+ }
987
+ /** The f64s per tuple of a velocity read: the class's tuple, then one value per list per window. */
988
+ export function wrunOptionStrikesVelocityWidth(classWidth, windows) {
989
+ return classWidth + WRUN_OPTION_STRIKES_VELOCITY_LISTS.length * windows.length;
990
+ }
991
+ /** Whether a class's words name a fold (the kit's `wrunOptionViewWordsFold`): the strike kit fold, or a page view fold
992
+ * of the class (a fold of the block or a book fold); its block is then a view block. */
993
+ function wrunOptionViewWordsFold(sourceClass, words) {
994
+ if (sourceClass === 'option_strikes')
995
+ return words.includes('kit');
996
+ if (sourceClass === 'option_surface')
997
+ return false;
653
998
  return words.some((word) => {
654
999
  const spec = wrunOptionViewSpec(word);
655
- return spec?.cls === cls && spec.answer === 'fold';
1000
+ return spec?.cls === sourceClass && spec.answer === 'fold';
656
1001
  });
657
1002
  }
1003
+ /**
1004
+ * The f64s per row of a block whose words are `words` (the kit's `wrunOptionViewWordsRowWidth`, each a word of the
1005
+ * class or not): the class's own width (`classWidth`) when no word names a fold; else the widest row a declared word
1006
+ * answers, the class's view row (`WRUN_OPTION_VIEW_ROW_WIDTHS`) widened to a declared book fold's own
1007
+ * (`WRUN_OPTION_BOOK_VIEW_ROW_WIDTHS`). The words alone decide it, never a param, so a setting never resizes a block:
1008
+ * the one rule an input's width (`wrunOptionInputTupleWidth`) and an instance's (`wrunOptionLaneTupleWidth`) read.
1009
+ */
1010
+ export function wrunOptionViewWordsRowWidth(sourceClass, words, classWidth) {
1011
+ if (sourceClass === 'option_surface' || !wrunOptionViewWordsFold(sourceClass, words))
1012
+ return classWidth;
1013
+ let width = WRUN_OPTION_VIEW_ROW_WIDTHS[sourceClass];
1014
+ if (sourceClass !== 'options_chain')
1015
+ return width;
1016
+ for (const word of words) {
1017
+ if (wrunOptionPageViewIsBook(word))
1018
+ width = Math.max(width, WRUN_OPTION_BOOK_VIEW_ROW_WIDTHS[word]);
1019
+ }
1020
+ return width;
1021
+ }
1022
+ /** The f64s per row a class's view block may take, ascending (the kit's `wrunOptionViewRowWidthsOf`): its view row,
1023
+ * and on options_chain each book fold's own (never the class's tuple width). A host tells a view block from class
1024
+ * tuples by the width alone (the kit's `wrunCellBlockIsViewRows`). */
1025
+ export function wrunOptionViewRowWidthsOf(sourceClass) {
1026
+ if (sourceClass === 'option_surface')
1027
+ return [];
1028
+ const widths = new Set([WRUN_OPTION_VIEW_ROW_WIDTHS[sourceClass]]);
1029
+ if (sourceClass === 'options_chain') {
1030
+ for (const width of Object.values(WRUN_OPTION_BOOK_VIEW_ROW_WIDTHS))
1031
+ widths.add(width);
1032
+ }
1033
+ return [...widths].sort((a, b) => a - b);
1034
+ }
658
1035
  /**
659
1036
  * The f64s per tuple one input's block carries (the SDK's `wrunOptionInputTupleWidth`, the one rule every host sizes
660
- * by): a view block's row width when its words name a fold (a page view fold, the strike kit fold), else the class's
661
- * own width. The words alone decide it, never a param, so a setting never resizes a block.
1037
+ * by): a view block's row width when its words name a fold (`wrunOptionViewWordsRowWidth`: a page view fold, a book
1038
+ * fold's own width when wider, the strike kit fold), the class's tuple and its velocity lists when an `option_strikes`
1039
+ * input names `velocity_windows` (`wrunOptionStrikesVelocityWidth`; the kit sizes it so from the om schema's knob on,
1040
+ * `WRUN_OPTION_STRIKES_VELOCITY_SERVED`), else the class's own width. The words alone decide it, never a param, so a
1041
+ * setting never resizes a block.
662
1042
  */
663
1043
  export function wrunOptionInputTupleWidth(source, classWidth) {
664
1044
  const cls = source.source;
665
1045
  if (cls === 'option_strikes') {
666
- return source[WRUN_OPTION_LANE_WORDS.option_strikes.knob] === 'kit'
667
- ? WRUN_OPTION_VIEW_ROW_WIDTHS.option_strikes
668
- : classWidth;
1046
+ if (source[WRUN_OPTION_LANE_WORDS.option_strikes.knob] === 'kit')
1047
+ return WRUN_OPTION_VIEW_ROW_WIDTHS.option_strikes;
1048
+ const windows = wrunOptionStrikesVelocityWindows(source[WRUN_OPTION_STRIKES_VELOCITY_KNOB]);
1049
+ return windows === undefined ? classWidth : wrunOptionStrikesVelocityWidth(classWidth, windows);
669
1050
  }
670
1051
  if (cls !== 'options_chain' && cls !== 'option_contract_state')
671
1052
  return classWidth;
672
- return pageViewWordsFold(cls, wrunOptionViewWordsDeclared(source)) ? WRUN_OPTION_VIEW_ROW_WIDTHS[cls] : classWidth;
1053
+ return wrunOptionViewWordsRowWidth(cls, wrunOptionViewWordsDeclared(source), classWidth);
673
1054
  }
674
1055
  /** pb-common `OptionSurfacePick` by word (the gateway decodes numbers, never names). */
675
1056
  export const WRUN_OPTION_SURFACE_PICK_CODES = Object.freeze({
@@ -679,13 +1060,15 @@ export const WRUN_OPTION_SURFACE_PICK_CODES = Object.freeze({
679
1060
  /** pb-common `StrikeMetric` by the kit fold's lens code (0 gamma, 1 delta, 2 vega): NET_GEX, DEX, VEX. */
680
1061
  export const WRUN_OPTION_STRIKES_KIT_METRICS = Object.freeze({ 0: 1, 1: 2, 2: 3 });
681
1062
  /**
682
- * The `OptionReadShape` G5 fields (pb-common 12.72.0, fields 40 to 51) a per-bar ask names, as they ride the lane's
1063
+ * The `OptionReadShape` G5 fields (pb-common 12.74.0, fields 40 to 53) a per-bar ask names, as they ride the lane's
683
1064
  * payload and the gateway reads them (JSON names, enums as numbers):
684
1065
  * - the surface pick: `surfacePick` (1 nearest_days, 2 tenor_bracket) with `surfaceDays` and `surfaceDelta` (25 or
685
1066
  * 10, the wings) or `surfaceTenorDays`;
686
1067
  * - the strike kit fold: `strikeKitFold`, `strikeNearest`, `strikeKitWindowPct`, `strikeStepRows`, `strikeCarryNext`,
687
1068
  * `strikeLevels`, `strikeMaxCells` (the input's `max_cells`: a minute with more rows answers a refused levels row)
688
- * and `strikeKitMetric` (the lens).
1069
+ * and `strikeKitMetric` (the lens); with `curve` (OPTLOAD W3 U4) `strikeKitCurve` and `strikeKitMultiplier` (the
1070
+ * chart's `market.option_multiplier()`, `facts.optionMultiplier`; 0, which the gateway reads as 1, when unknown),
1071
+ * both or neither, so an input without `curve` asks exactly what it asked before.
689
1072
  * The fields key the lane instance, so two inputs asking two picks are two reads, and an input declaring no word asks
690
1073
  * none of them (today's read).
691
1074
  */
@@ -709,6 +1092,7 @@ export function wrunOptionLaneAskFields(ask, facts = {}) {
709
1092
  strikeLevels: params.levels === 1,
710
1093
  ...(facts.maxCells !== undefined ? { strikeMaxCells: facts.maxCells } : {}),
711
1094
  strikeKitMetric: WRUN_OPTION_STRIKES_KIT_METRICS[params.lens] ?? WRUN_OPTION_STRIKES_KIT_METRICS[0],
1095
+ ...(params.curve === 1 ? { strikeKitCurve: true, strikeKitMultiplier: facts.optionMultiplier ?? 0 } : {}),
712
1096
  };
713
1097
  }
714
1098
  /** The payload fields of a per-bar ask, by class (the K controls copy exactly these onto the request they build). */
@@ -723,6 +1107,8 @@ const WRUN_OPTION_LANE_PAYLOAD_FIELDS = Object.freeze({
723
1107
  'strikeLevels',
724
1108
  'strikeMaxCells',
725
1109
  'strikeKitMetric',
1110
+ 'strikeKitCurve',
1111
+ 'strikeKitMultiplier',
726
1112
  ]),
727
1113
  });
728
1114
  /** A per-bar ask's fields of a payload, as they ride (a K control copies them onto the request it builds). */
@@ -772,6 +1158,11 @@ export function wrunOptionLaneAskOfPayload(cls, payload) {
772
1158
  }
773
1159
  read.strikeCarryNext = payload.strikeCarryNext === true;
774
1160
  read.strikeLevels = payload.strikeLevels === true;
1161
+ // The curve rides with its multiplier, both or neither (a multiplier without the curve is no ask of it).
1162
+ if (payload.strikeKitCurve === true) {
1163
+ read.strikeKitCurve = true;
1164
+ read.strikeKitMultiplier = finiteOrUndefined(payload.strikeKitMultiplier) ?? 0;
1165
+ }
775
1166
  return read;
776
1167
  }
777
1168
  /** The kit fold's params by knob (the SDK reference's names) off a payload's ask, the lens back to its code. */
@@ -784,6 +1175,7 @@ export function wrunOptionStrikesKitParamsOf(read) {
784
1175
  step_rows: read.strikeStepRows ?? 48,
785
1176
  carry: read.strikeCarryNext === true ? 1 : 0,
786
1177
  levels: read.strikeLevels === true ? 1 : 0,
1178
+ curve: read.strikeKitCurve === true ? 1 : 0,
787
1179
  };
788
1180
  }
789
1181
  /** Whether a lane instance's acquisition asks a per-bar word (a pick or the kit fold): its rows are landed on the
@@ -810,17 +1202,22 @@ export function wrunOptionKitBarHasRows(tuples) {
810
1202
  /**
811
1203
  * The f64s per row an instance's rows carry, by its facets (the SDK's `wrunAskTupleWidth`, the ask's side of
812
1204
  * `wrunOptionInputTupleWidth`: the views ride the instance's key, so every input it serves shares its width): the kit
813
- * fold's rows on an instance asking it, a view block's rows on one whose views (`<prefix>Views`) name a fold of its
814
- * class (Top Contracts' totals), else the class's own tuple (`classWidth`).
1205
+ * fold's rows on an instance asking it, the class's tuple and its velocity lists on an `option_strikes` instance asking
1206
+ * velocity windows (`WRUN_OPTION_STRIKES_VELOCITY_FIELD`), a view block's rows on one whose views (`<prefix>Views`) name
1207
+ * a fold of its class (Top Contracts' totals; a book fold, at the widest of its words,
1208
+ * `wrunOptionViewWordsRowWidth`), else the class's own tuple (`classWidth`).
815
1209
  */
816
1210
  export function wrunOptionLaneTupleWidth(sourceClass, acquisition, classWidth) {
817
1211
  if (sourceClass === 'option_strikes') {
818
- return acquisition.strikeKitFold === true ? WRUN_OPTION_VIEW_ROW_WIDTHS.option_strikes : classWidth;
1212
+ if (acquisition.strikeKitFold === true)
1213
+ return WRUN_OPTION_VIEW_ROW_WIDTHS.option_strikes;
1214
+ const windows = wrunOptionStrikesVelocityWindows(acquisition[WRUN_OPTION_STRIKES_VELOCITY_FIELD]);
1215
+ return windows === undefined ? classWidth : wrunOptionStrikesVelocityWidth(classWidth, windows);
819
1216
  }
820
1217
  if (sourceClass !== 'options_chain' && sourceClass !== 'option_contract_state')
821
1218
  return classWidth;
822
1219
  const text = acquisition[`${WRUN_OPTION_VIEW_PREFIX[sourceClass]}Views`];
823
- return pageViewWordsFold(sourceClass, viewWordsOfText(text)) ? WRUN_OPTION_VIEW_ROW_WIDTHS[sourceClass] : classWidth;
1220
+ return wrunOptionViewWordsRowWidth(sourceClass, viewWordsOfText(text), classWidth);
824
1221
  }
825
1222
  /** The view words a `<prefix>Views` text names, unvalidated (the width reads the words alone, as the SDK's
826
1223
  * `wrunAskTupleWidth` does); none for a text that is no list of views. */
@@ -838,11 +1235,12 @@ function viewWordsOfText(text) {
838
1235
  ? parsed.map((view) => (view !== null && typeof view === 'object' ? view.view : undefined))
839
1236
  : [];
840
1237
  }
841
- /** The rows a strike kit fold bar is projected to hold for the first paint: the levels row, the window's strikes
842
- * within `step_rows` + 1 finest steps each side of the centre, the finest pair and the two edges. */
1238
+ /** The rows a strike kit fold bar is projected to hold for the first paint: the levels row (and the curve row on an
1239
+ * ask naming it), the window's strikes within `step_rows` + 1 finest steps each side of the centre, the finest pair
1240
+ * and the two edges. */
843
1241
  function wrunOptionStrikesKitBarRows(acquisition) {
844
1242
  const stepRows = finiteOrUndefined(acquisition.strikeStepRows) ?? 48;
845
- return 1 + 2 * (Math.max(0, stepRows) + 1) + 1 + 4;
1243
+ return (acquisition.strikeKitCurve === true ? 2 : 1) + 2 * (Math.max(0, stepRows) + 1) + 1 + 4;
846
1244
  }
847
1245
  /**
848
1246
  * The row budget the first-paint slice sizes an instance asking a per-bar word by (wrun-row-lane-first-paint.util, the
@@ -954,23 +1352,38 @@ export function wrunOptionSurfacePickTuples(tuples, word, params) {
954
1352
  }
955
1353
  /**
956
1354
  * The chart's chain on the OPRA plane by coin, held in place of the chain directory's answer (section 8, O1): the
957
- * chain `wrunLaneOpraPlaneChain` reads for the chart's coin when the chart's options ride the OPRA plane (the
958
- * planner's verdict when the lane context carries it, `opraPlane`, else the run's own rule over the chart's exchange,
959
- * `governedOptionPlane`, the predicate the planners' `isOpraPlaneExchange` is). Undefined off the plane, for a chart
960
- * naming no coin, and while another screen holds the plane's session (the directory resolution then stops by that
961
- * name before any read). Main thread only; the lane resolver loads lazily (this module stays light: the paint seam
962
- * reads its view table).
1355
+ * chain `wrunLaneOpraPlaneChain` reads for the coin when the chart's options ride the OPRA plane. With the planner's
1356
+ * verdict (`opraPlane`, which the lane context carries: a stock twin's context names its stock's ticker as the coin) the
1357
+ * coin is read as given; without one the market is judged through the options seam (the gate port's
1358
+ * `chartOptionsMarket`, then `governedOptionPlane` over the market it answers, exchange and `symbol` both: the
1359
+ * predicate the planners' `isOpraPlaneExchange` is), and a stock twin's chain is its stock's, by the twin's ticker,
1360
+ * never the chart's own coin, naming the chart market (`stockTwinOf`). Undefined off the plane, for a chart naming no
1361
+ * coin, and while another screen holds the plane's session (the directory resolution then stops by that name before
1362
+ * any read). Main thread only; the lane resolver loads lazily (this module stays light: the paint seam reads its view
1363
+ * table).
963
1364
  */
964
- export async function wrunHeldOpraPlaneChain(exchange, coin, opraPlane) {
1365
+ export async function wrunHeldOpraPlaneChain(exchange, coin, opraPlane, symbol) {
965
1366
  if (typeof coin !== 'string' || coin.trim() === '' || gateSessionHeldElsewhere('opra'))
966
1367
  return undefined;
967
1368
  let onPlane = opraPlane;
1369
+ let heldCoin = coin;
1370
+ let stockTwinOf;
968
1371
  if (onPlane === undefined) {
969
- const { governedOptionPlane } = await wrunChartHostEnv().market.loadOptionsGate();
970
- onPlane = governedOptionPlane({ exchange: typeof exchange === 'string' ? exchange : undefined }) === 'opra';
1372
+ const gate = await wrunChartHostEnv().market.loadOptionsGate();
1373
+ const chart = {
1374
+ exchange: typeof exchange === 'string' ? exchange : undefined,
1375
+ symbol: typeof symbol === 'string' ? symbol : undefined,
1376
+ coin,
1377
+ };
1378
+ const market = gate.chartOptionsMarket?.(chart) ?? chart;
1379
+ onPlane = gate.governedOptionPlane(market) === 'opra';
1380
+ if (market.twinOf !== undefined && typeof market.coin === 'string' && market.coin.trim() !== '') {
1381
+ heldCoin = market.coin;
1382
+ stockTwinOf = market.twinOf;
1383
+ }
971
1384
  }
972
1385
  if (!onPlane)
973
1386
  return undefined;
974
1387
  const { wrunLaneOpraPlaneChain } = await import('./sources/opra-option-lanes.util.js');
975
- return wrunLaneOpraPlaneChain(coin);
1388
+ return wrunLaneOpraPlaneChain(heldCoin, stockTwinOf);
976
1389
  }