@orangecharts/wrun-chart-host 0.9.0 → 0.10.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 (170) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/feature-flags.constants.d.ts +6 -1
  3. package/dist/constants/feature-flags.constants.js +67 -24
  4. package/dist/constants/opra-compliance.constants.d.ts +3 -2
  5. package/dist/constants/opra-compliance.constants.js +3 -2
  6. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
  7. package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
  8. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
  9. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
  10. package/dist/constants/venue-presets.constants.d.ts +20 -20
  11. package/dist/constants/venue-presets.constants.js +24 -26
  12. package/dist/host-env.d.ts +29 -5
  13. package/dist/host-env.js +6 -0
  14. package/dist/host-ports.types.d.ts +69 -15
  15. package/dist/index.d.ts +13 -0
  16. package/dist/index.js +13 -0
  17. package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
  18. package/dist/interfaces/replay.interface.d.ts +8 -0
  19. package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
  20. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +41 -4
  21. package/dist/kscript-data/controls/live-trades-merge.util.js +52 -7
  22. package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
  23. package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
  24. package/dist/market-data/billing.interface.d.ts +95 -31
  25. package/dist/market-data/billing.interface.js +36 -5
  26. package/dist/market-data/venue.d.ts +88 -6
  27. package/dist/market-data/venues/cme.contract.copy.json +66 -0
  28. package/dist/market-data/venues/cme.d.ts +126 -0
  29. package/dist/market-data/venues/cme.js +133 -0
  30. package/dist/market-data/venues/index.d.ts +162 -5
  31. package/dist/market-data/venues/index.js +48 -6
  32. package/dist/settings-templates/index.js +7 -3
  33. package/dist/settings-templates/indicator-fields.d.ts +5 -4
  34. package/dist/settings-templates/indicator-fields.js +45 -6
  35. package/dist/settings-templates/tool-rules.d.ts +27 -17
  36. package/dist/settings-templates/tool-rules.js +27 -11
  37. package/dist/settings-templates/tool-tables.generated.js +91 -31
  38. package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
  39. package/dist/utility/chart/book-live-bucket.util.js +47 -0
  40. package/dist/utility/chart/index-mode-admission.util.js +15 -2
  41. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
  42. package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
  43. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +7 -2
  44. package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
  45. package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
  46. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
  47. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
  48. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
  49. package/dist/utility/chart/kscript-venue-policy.util.d.ts +54 -35
  50. package/dist/utility/chart/kscript-venue-policy.util.js +78 -42
  51. package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
  52. package/dist/utility/chart/market-session-schedule.util.js +16 -0
  53. package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
  54. package/dist/utility/chart/opra-read-access.leaf.js +5 -3
  55. package/dist/utility/chart/rth-session.util.d.ts +3 -2
  56. package/dist/utility/chart/rth-session.util.js +2 -1
  57. package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
  58. package/dist/utility/chart/window-geometry.leaf.js +22 -6
  59. package/dist/utility/chart/wrun-run-result.util.d.ts +12 -0
  60. package/dist/utility/chart/wrun-run-result.util.js +141 -6
  61. package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
  62. package/dist/utility/options/option-bar-anchor.util.js +340 -0
  63. package/dist/utility/options/option-venue.util.d.ts +18 -0
  64. package/dist/utility/options/option-venue.util.js +27 -0
  65. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
  66. package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
  67. package/dist/utility/wrun/derived-roots.util.js +471 -0
  68. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
  69. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
  70. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
  71. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
  72. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -2
  73. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -2
  74. package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
  75. package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
  76. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
  77. package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
  78. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
  79. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +2 -1
  80. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +3 -0
  81. package/dist/utility/wrun/sources/row-lanes/option_prints.js +19 -4
  82. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
  83. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +52 -13
  84. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +88 -19
  85. package/dist/utility/wrun/sources/row-lanes/option_surface.js +2 -1
  86. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
  87. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +24 -9
  88. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +39 -10
  89. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
  90. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -0
  91. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +15 -3
  92. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +22 -3
  93. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -0
  94. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +174 -13
  95. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +685 -27
  96. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
  97. package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
  98. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +53 -12
  99. package/dist/utility/wrun/wrun-chart-market-facts.util.js +101 -53
  100. package/dist/utility/wrun/wrun-download-meter.util.d.ts +15 -0
  101. package/dist/utility/wrun/wrun-download-meter.util.js +14 -2
  102. package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
  103. package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
  104. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
  105. package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
  106. package/dist/utility/wrun/wrun-frames.d.ts +27 -6
  107. package/dist/utility/wrun/wrun-frames.js +73 -10
  108. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
  109. package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
  110. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +18 -4
  111. package/dist/utility/wrun/wrun-hud-looks.util.js +45 -13
  112. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
  113. package/dist/utility/wrun/wrun-live-intake.util.d.ts +13 -7
  114. package/dist/utility/wrun/wrun-live-intake.util.js +82 -29
  115. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
  116. package/dist/utility/wrun/wrun-live-tick.util.js +158 -14
  117. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +49 -10
  118. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +65 -5
  119. package/dist/utility/wrun/wrun-market-size-defaults.util.js +31 -5
  120. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
  121. package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
  122. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
  123. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
  124. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +23 -6
  125. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +47 -11
  126. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +86 -19
  127. package/dist/utility/wrun/wrun-option-strike-flow.util.js +168 -62
  128. package/dist/utility/wrun/wrun-option-views.util.d.ts +47 -13
  129. package/dist/utility/wrun/wrun-option-views.util.js +98 -26
  130. package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
  131. package/dist/utility/wrun/wrun-output-style.util.js +20 -2
  132. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +17 -0
  133. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
  134. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
  135. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +100 -31
  136. package/dist/utility/wrun/wrun-overlay-run.util.js +733 -114
  137. package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
  138. package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
  139. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
  140. package/dist/utility/wrun/wrun-panel-mount.util.js +63 -13
  141. package/dist/utility/wrun/wrun-panel-style.util.d.ts +10 -9
  142. package/dist/utility/wrun/wrun-panel-style.util.js +58 -9
  143. package/dist/utility/wrun/wrun-param-map.util.d.ts +14 -11
  144. package/dist/utility/wrun/wrun-param-map.util.js +10 -5
  145. package/dist/utility/wrun/wrun-param-values.util.d.ts +14 -4
  146. package/dist/utility/wrun/wrun-param-values.util.js +4 -0
  147. package/dist/utility/wrun/wrun-pin-spelling.util.js +12 -11
  148. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
  149. package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
  150. package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
  151. package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
  152. package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
  153. package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
  154. package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
  155. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +45 -1
  156. package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
  157. package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
  158. package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
  159. package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
  160. package/dist/utility/wrun/wrun-socket-row-source.js +113 -8
  161. package/dist/utility/wrun/wrun-source-rows.util.d.ts +5 -1
  162. package/dist/utility/wrun/wrun-source-rows.util.js +16 -3
  163. package/dist/utility/wrun/wrun-style-words.util.js +6 -4
  164. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
  165. package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
  166. package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
  167. package/dist/utility/wrun/wrun-tape-per-order.util.js +26 -0
  168. package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
  169. package/dist/utils/replay/replay-buffer-math.js +227 -20
  170. package/package.json +11 -11
@@ -28,9 +28,10 @@
28
28
  * for word by tests/utility/wrun/wrun-option-views.kit-pin.spec.ts.
29
29
  * - The per-bar words (OPTLOAD-CHAIN-PLAN 6.2, 6.3 and 9): `pick` on `option_surface` ("nearest_days" or
30
30
  * "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).
31
+ * `fold` "kit" on `option_strikes` (the bar's newest minute folded to one levels row, with `curve` the gamma curve's
32
+ * row after it, and the strike rows Spot Exposures draws), their params read by the SDK's rules
33
+ * (`WRUN_OPTION_LANE_KNOBS`, `wrunOptionLaneAskOfSource`) and asked of the gateway in the lane's fields
34
+ * (`wrunOptionLaneAskFields`, the `OptionReadShape` G5 fields 40 to 53).
34
35
  * The kit fold keeps its expiries with its own `nearest`: an `expiries` word other than "all" beside it is refused
35
36
  * at declaration (kit 0.91.1, `WRUN_OPTION_STRIKES_KIT_EXPIRIES_TAKES`).
36
37
  * - The ask's payload fields (`wrunOptionViewLaneFields`): `<prefix>Views`, the canonical text (`wrunOptionViewsText`:
@@ -648,6 +649,43 @@ export const WRUN_OPTION_STRIKES_KIT_LAYOUTS = Object.freeze({ strike: 0, levels
648
649
  /** The column of a kit levels row that says the bar was refused (its newest minute held more rows than the input's
649
650
  * `max_cells`): 1 refused, 0 served. */
650
651
  export const WRUN_OPTION_STRIKES_KIT_REFUSED_COLUMN = 13;
652
+ /**
653
+ * `option_strikes`' strike velocity knob (contract H; the om schema takes the knob by this name and shape): a literal
654
+ * list of 1 to 7 distinct windows in minutes, each one of `WRUN_OPTION_STRIKES_VELOCITY_WINDOWS`, in the order its
655
+ * columns take. A setting's handle (`"@param"`) never names it: the windows size the block, and a setting never
656
+ * resizes one (`wrunOptionInputTupleWidth`).
657
+ */
658
+ export const WRUN_OPTION_STRIKES_VELOCITY_KNOB = 'velocity_windows';
659
+ /** The windows the gateway answers velocity over (tsdb-gateway `optionStrikeVelocityWindows`), in minutes. */
660
+ export const WRUN_OPTION_STRIKES_VELOCITY_WINDOWS = Object.freeze([1, 5, 10, 15, 60, 240, 1440]);
661
+ /** What `velocity_windows` takes, for a refusal. */
662
+ 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';
663
+ /** The ask's field the windows ride (the K control copies it, the worker twin reads it), in the knob's order. */
664
+ export const WRUN_OPTION_STRIKES_VELOCITY_FIELD = 'strikeVelocityWindowsMin';
665
+ /**
666
+ * The velocity lists a tuple appends after `underlying` when the knob is set, in this order, each one entry per window
667
+ * in the knob's order: the change of net GEX, net DEX, net VEX, and the open interest (calls plus puts, in contracts).
668
+ */
669
+ export const WRUN_OPTION_STRIKES_VELOCITY_LISTS = Object.freeze([
670
+ 'net_gex_velocity',
671
+ 'net_dex_velocity',
672
+ 'net_vex_velocity',
673
+ 'oi_velocity',
674
+ ]);
675
+ /** A `velocity_windows` value's windows in its own order, or undefined for a value outside the knob's words. */
676
+ export function wrunOptionStrikesVelocityWindows(value) {
677
+ if (!Array.isArray(value) || value.length < 1 || value.length > WRUN_OPTION_STRIKES_VELOCITY_WINDOWS.length) {
678
+ return undefined;
679
+ }
680
+ if (!value.every((window) => typeof window === 'number' && WRUN_OPTION_STRIKES_VELOCITY_WINDOWS.includes(window))) {
681
+ return undefined;
682
+ }
683
+ return new Set(value).size === value.length ? [...value] : undefined;
684
+ }
685
+ /** The f64s per tuple of a velocity read: the class's tuple, then one value per list per window. */
686
+ export function wrunOptionStrikesVelocityWidth(classWidth, windows) {
687
+ return classWidth + WRUN_OPTION_STRIKES_VELOCITY_LISTS.length * windows.length;
688
+ }
651
689
  /** Whether page view words name a fold of `cls` (the SDK's `wrunOptionViewWordsFold` on a page view class). */
652
690
  function pageViewWordsFold(cls, words) {
653
691
  return words.some((word) => {
@@ -657,15 +695,18 @@ function pageViewWordsFold(cls, words) {
657
695
  }
658
696
  /**
659
697
  * 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.
698
+ * by): a view block's row width when its words name a fold (a page view fold, the strike kit fold), the class's tuple
699
+ * and its velocity lists when an `option_strikes` input names `velocity_windows` (`wrunOptionStrikesVelocityWidth`;
700
+ * the kit sizes it so from the om schema's knob on, `WRUN_OPTION_STRIKES_VELOCITY_SERVED`), else the class's own
701
+ * width. The words alone decide it, never a param, so a setting never resizes a block.
662
702
  */
663
703
  export function wrunOptionInputTupleWidth(source, classWidth) {
664
704
  const cls = source.source;
665
705
  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;
706
+ if (source[WRUN_OPTION_LANE_WORDS.option_strikes.knob] === 'kit')
707
+ return WRUN_OPTION_VIEW_ROW_WIDTHS.option_strikes;
708
+ const windows = wrunOptionStrikesVelocityWindows(source[WRUN_OPTION_STRIKES_VELOCITY_KNOB]);
709
+ return windows === undefined ? classWidth : wrunOptionStrikesVelocityWidth(classWidth, windows);
669
710
  }
670
711
  if (cls !== 'options_chain' && cls !== 'option_contract_state')
671
712
  return classWidth;
@@ -679,13 +720,15 @@ export const WRUN_OPTION_SURFACE_PICK_CODES = Object.freeze({
679
720
  /** pb-common `StrikeMetric` by the kit fold's lens code (0 gamma, 1 delta, 2 vega): NET_GEX, DEX, VEX. */
680
721
  export const WRUN_OPTION_STRIKES_KIT_METRICS = Object.freeze({ 0: 1, 1: 2, 2: 3 });
681
722
  /**
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
723
+ * 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
724
  * payload and the gateway reads them (JSON names, enums as numbers):
684
725
  * - the surface pick: `surfacePick` (1 nearest_days, 2 tenor_bracket) with `surfaceDays` and `surfaceDelta` (25 or
685
726
  * 10, the wings) or `surfaceTenorDays`;
686
727
  * - the strike kit fold: `strikeKitFold`, `strikeNearest`, `strikeKitWindowPct`, `strikeStepRows`, `strikeCarryNext`,
687
728
  * `strikeLevels`, `strikeMaxCells` (the input's `max_cells`: a minute with more rows answers a refused levels row)
688
- * and `strikeKitMetric` (the lens).
729
+ * and `strikeKitMetric` (the lens); with `curve` (OPTLOAD W3 U4) `strikeKitCurve` and `strikeKitMultiplier` (the
730
+ * chart's `market.option_multiplier()`, `facts.optionMultiplier`; 0, which the gateway reads as 1, when unknown),
731
+ * both or neither, so an input without `curve` asks exactly what it asked before.
689
732
  * The fields key the lane instance, so two inputs asking two picks are two reads, and an input declaring no word asks
690
733
  * none of them (today's read).
691
734
  */
@@ -709,6 +752,7 @@ export function wrunOptionLaneAskFields(ask, facts = {}) {
709
752
  strikeLevels: params.levels === 1,
710
753
  ...(facts.maxCells !== undefined ? { strikeMaxCells: facts.maxCells } : {}),
711
754
  strikeKitMetric: WRUN_OPTION_STRIKES_KIT_METRICS[params.lens] ?? WRUN_OPTION_STRIKES_KIT_METRICS[0],
755
+ ...(params.curve === 1 ? { strikeKitCurve: true, strikeKitMultiplier: facts.optionMultiplier ?? 0 } : {}),
712
756
  };
713
757
  }
714
758
  /** The payload fields of a per-bar ask, by class (the K controls copy exactly these onto the request they build). */
@@ -723,6 +767,8 @@ const WRUN_OPTION_LANE_PAYLOAD_FIELDS = Object.freeze({
723
767
  'strikeLevels',
724
768
  'strikeMaxCells',
725
769
  'strikeKitMetric',
770
+ 'strikeKitCurve',
771
+ 'strikeKitMultiplier',
726
772
  ]),
727
773
  });
728
774
  /** A per-bar ask's fields of a payload, as they ride (a K control copies them onto the request it builds). */
@@ -772,6 +818,11 @@ export function wrunOptionLaneAskOfPayload(cls, payload) {
772
818
  }
773
819
  read.strikeCarryNext = payload.strikeCarryNext === true;
774
820
  read.strikeLevels = payload.strikeLevels === true;
821
+ // The curve rides with its multiplier, both or neither (a multiplier without the curve is no ask of it).
822
+ if (payload.strikeKitCurve === true) {
823
+ read.strikeKitCurve = true;
824
+ read.strikeKitMultiplier = finiteOrUndefined(payload.strikeKitMultiplier) ?? 0;
825
+ }
775
826
  return read;
776
827
  }
777
828
  /** 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 +835,7 @@ export function wrunOptionStrikesKitParamsOf(read) {
784
835
  step_rows: read.strikeStepRows ?? 48,
785
836
  carry: read.strikeCarryNext === true ? 1 : 0,
786
837
  levels: read.strikeLevels === true ? 1 : 0,
838
+ curve: read.strikeKitCurve === true ? 1 : 0,
787
839
  };
788
840
  }
789
841
  /** Whether a lane instance's acquisition asks a per-bar word (a pick or the kit fold): its rows are landed on the
@@ -810,12 +862,16 @@ export function wrunOptionKitBarHasRows(tuples) {
810
862
  /**
811
863
  * The f64s per row an instance's rows carry, by its facets (the SDK's `wrunAskTupleWidth`, the ask's side of
812
864
  * `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`).
865
+ * fold's rows on an instance asking it, the class's tuple and its velocity lists on an `option_strikes` instance asking
866
+ * velocity windows (`WRUN_OPTION_STRIKES_VELOCITY_FIELD`), a view block's rows on one whose views (`<prefix>Views`) name
867
+ * a fold of its class (Top Contracts' totals), else the class's own tuple (`classWidth`).
815
868
  */
816
869
  export function wrunOptionLaneTupleWidth(sourceClass, acquisition, classWidth) {
817
870
  if (sourceClass === 'option_strikes') {
818
- return acquisition.strikeKitFold === true ? WRUN_OPTION_VIEW_ROW_WIDTHS.option_strikes : classWidth;
871
+ if (acquisition.strikeKitFold === true)
872
+ return WRUN_OPTION_VIEW_ROW_WIDTHS.option_strikes;
873
+ const windows = wrunOptionStrikesVelocityWindows(acquisition[WRUN_OPTION_STRIKES_VELOCITY_FIELD]);
874
+ return windows === undefined ? classWidth : wrunOptionStrikesVelocityWidth(classWidth, windows);
819
875
  }
820
876
  if (sourceClass !== 'options_chain' && sourceClass !== 'option_contract_state')
821
877
  return classWidth;
@@ -838,11 +894,12 @@ function viewWordsOfText(text) {
838
894
  ? parsed.map((view) => (view !== null && typeof view === 'object' ? view.view : undefined))
839
895
  : [];
840
896
  }
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. */
897
+ /** The rows a strike kit fold bar is projected to hold for the first paint: the levels row (and the curve row on an
898
+ * ask naming it), the window's strikes within `step_rows` + 1 finest steps each side of the centre, the finest pair
899
+ * and the two edges. */
843
900
  function wrunOptionStrikesKitBarRows(acquisition) {
844
901
  const stepRows = finiteOrUndefined(acquisition.strikeStepRows) ?? 48;
845
- return 1 + 2 * (Math.max(0, stepRows) + 1) + 1 + 4;
902
+ return (acquisition.strikeKitCurve === true ? 2 : 1) + 2 * (Math.max(0, stepRows) + 1) + 1 + 4;
846
903
  }
847
904
  /**
848
905
  * 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 +1011,38 @@ export function wrunOptionSurfacePickTuples(tuples, word, params) {
954
1011
  }
955
1012
  /**
956
1013
  * 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).
1014
+ * chain `wrunLaneOpraPlaneChain` reads for the coin when the chart's options ride the OPRA plane. With the planner's
1015
+ * verdict (`opraPlane`, which the lane context carries: a stock twin's context names its stock's ticker as the coin) the
1016
+ * coin is read as given; without one the market is judged through the options seam (the gate port's
1017
+ * `chartOptionsMarket`, then `governedOptionPlane` over the market it answers, exchange and `symbol` both: the
1018
+ * predicate the planners' `isOpraPlaneExchange` is), and a stock twin's chain is its stock's, by the twin's ticker,
1019
+ * never the chart's own coin, naming the chart market (`stockTwinOf`). Undefined off the plane, for a chart naming no
1020
+ * coin, and while another screen holds the plane's session (the directory resolution then stops by that name before
1021
+ * any read). Main thread only; the lane resolver loads lazily (this module stays light: the paint seam reads its view
1022
+ * table).
963
1023
  */
964
- export async function wrunHeldOpraPlaneChain(exchange, coin, opraPlane) {
1024
+ export async function wrunHeldOpraPlaneChain(exchange, coin, opraPlane, symbol) {
965
1025
  if (typeof coin !== 'string' || coin.trim() === '' || gateSessionHeldElsewhere('opra'))
966
1026
  return undefined;
967
1027
  let onPlane = opraPlane;
1028
+ let heldCoin = coin;
1029
+ let stockTwinOf;
968
1030
  if (onPlane === undefined) {
969
- const { governedOptionPlane } = await wrunChartHostEnv().market.loadOptionsGate();
970
- onPlane = governedOptionPlane({ exchange: typeof exchange === 'string' ? exchange : undefined }) === 'opra';
1031
+ const gate = await wrunChartHostEnv().market.loadOptionsGate();
1032
+ const chart = {
1033
+ exchange: typeof exchange === 'string' ? exchange : undefined,
1034
+ symbol: typeof symbol === 'string' ? symbol : undefined,
1035
+ coin,
1036
+ };
1037
+ const market = gate.chartOptionsMarket?.(chart) ?? chart;
1038
+ onPlane = gate.governedOptionPlane(market) === 'opra';
1039
+ if (market.twinOf !== undefined && typeof market.coin === 'string' && market.coin.trim() !== '') {
1040
+ heldCoin = market.coin;
1041
+ stockTwinOf = market.twinOf;
1042
+ }
971
1043
  }
972
1044
  if (!onPlane)
973
1045
  return undefined;
974
1046
  const { wrunLaneOpraPlaneChain } = await import('./sources/opra-option-lanes.util.js');
975
- return wrunLaneOpraPlaneChain(coin);
1047
+ return wrunLaneOpraPlaneChain(heldCoin, stockTwinOf);
976
1048
  }
@@ -29,6 +29,9 @@ export declare const WRUN_CANDLE_STYLES: readonly ["candle", "hollow", "ohlc", "
29
29
  export declare const WRUN_BAR_GRADINGS: readonly ["linear", "square"];
30
30
  /** The on-line label pill of a guide (OT10). */
31
31
  export declare const WRUN_PILL_STYLES: readonly ["filled", "outlined"];
32
+ /** The axis tag look of a guide with `axis_label: true` (kit scaffold 102,
33
+ * the kit's `WRUN_OUTPUT_AXIS_LOOKS`). */
34
+ export declare const WRUN_AXIS_LOOKS: readonly ["pill", "quiet", "words"];
32
35
  /** The pane's value scale (OT18) and the engine value mode it maps to. */
33
36
  export declare const WRUN_PANE_SCALES: readonly ["linear", "log", "percent", "indexed"];
34
37
  /** Where a pane sits (OT24). */
@@ -110,8 +113,9 @@ export declare function wrunOutputLookPatch(output: WrunMetadataOutput, mount: W
110
113
  /** The hline fields a `role: "guide"` output adds (OT10): the on-line label
111
114
  * (`align` places the output's `label`, `pill_style` and `font_size` dress
112
115
  * it), the axis pill (`axis_label: true` puts value + label on the axis
113
- * instead), the constant `value` and the paint order. `lastValue` is the
114
- * output's last finite value (NaN when the run never gave one). */
116
+ * instead, `axis_look` picks the tag's look as `axisTagLook`), the constant
117
+ * `value` and the paint order. `lastValue` is the output's last finite value
118
+ * (NaN when the run never gave one). */
115
119
  export declare function wrunGuideLook(output: WrunMetadataOutput, lastValue: number, label: string): Record<string, unknown>;
116
120
  /** The candle look a group's first output declares (OT17): the body style
117
121
  * as the engine plot kind, the border and wick pairs (faded by the group's
@@ -52,6 +52,9 @@ const WRUN_CANDLE_PLOT_TYPES = {
52
52
  export const WRUN_BAR_GRADINGS = ['linear', 'square'];
53
53
  /** The on-line label pill of a guide (OT10). */
54
54
  export const WRUN_PILL_STYLES = ['filled', 'outlined'];
55
+ /** The axis tag look of a guide with `axis_label: true` (kit scaffold 102,
56
+ * the kit's `WRUN_OUTPUT_AXIS_LOOKS`). */
57
+ export const WRUN_AXIS_LOOKS = ['pill', 'quiet', 'words'];
55
58
  const WRUN_GUIDE_ALIGNS = ['left', 'center', 'right'];
56
59
  const WRUN_GRADIENT_MODES = ['pane', 'fill', 'line'];
57
60
  const WRUN_LINE_STYLE_WORDS = ['solid', 'dashed', 'dotted'];
@@ -421,6 +424,9 @@ export function wrunOutputLookPatch(output, mount, ctx) {
421
424
  if (output.price_line)
422
425
  patch.showLastValueLine = true;
423
426
  }
427
+ // A guide's axis tag look (scaffold 102): wrunGuideLook maps it, any other output refuses it by name.
428
+ if (output.axis_look !== undefined && !guide)
429
+ throw refusal(sheetId, subject, 'axis_look needs role "guide"');
424
430
  // OT04, OT16, OT32.
425
431
  Object.assign(patch, zOrderPatch(output.z, subject, sheetId));
426
432
  Object.assign(patch, glowPatch(output.glow, subject, sheetId));
@@ -569,8 +575,9 @@ export function wrunOutputLookPatch(output, mount, ctx) {
569
575
  /** The hline fields a `role: "guide"` output adds (OT10): the on-line label
570
576
  * (`align` places the output's `label`, `pill_style` and `font_size` dress
571
577
  * it), the axis pill (`axis_label: true` puts value + label on the axis
572
- * instead), the constant `value` and the paint order. `lastValue` is the
573
- * output's last finite value (NaN when the run never gave one). */
578
+ * instead, `axis_look` picks the tag's look as `axisTagLook`), the constant
579
+ * `value` and the paint order. `lastValue` is the output's last finite value
580
+ * (NaN when the run never gave one). */
574
581
  export function wrunGuideLook(output, lastValue, label) {
575
582
  const subject = `output '${output.name}'`;
576
583
  const patch = { value: lastValue };
@@ -609,6 +616,17 @@ export function wrunGuideLook(output, lastValue, label) {
609
616
  patch.axisLabel = true;
610
617
  patch.label = label;
611
618
  }
619
+ // The look of the tag `axis_label: true` puts on the axis (kit scaffold 102). An engine that predates the field
620
+ // ignores it and draws today's pill.
621
+ if (output.axis_look !== undefined) {
622
+ if (!isWord(WRUN_AXIS_LOOKS, output.axis_look)) {
623
+ throw refusal(undefined, subject, `axis_look must be one of ${wordList(WRUN_AXIS_LOOKS)}`);
624
+ }
625
+ if (output.axis_label !== true) {
626
+ throw refusal(undefined, subject, "axis_look needs axis_label: true (the look of the guide's axis tag)");
627
+ }
628
+ patch.axisTagLook = output.axis_look;
629
+ }
612
630
  Object.assign(patch, zOrderPatch(output.z, subject, undefined));
613
631
  return patch;
614
632
  }
@@ -80,6 +80,7 @@ import { type WrunRefusalAttemptToken } from './wrun-refusal.util.js';
80
80
  import type { WrunIndicatorMetadata, WrunModuleHandle, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
81
81
  import type { WrunCandleGroup, WrunFillPair } from '../chart/wrun-run-result.util.js';
82
82
  import type { WrunLaneAcquisition, WrunLiveLane } from './wrun-live-intake.util.js';
83
+ import type { WrunOpraServedReceipt } from './wrun-opra-lane.util.js';
83
84
  import type { WrunPollLaneInstance } from './sources/wrun-poll-lane.types.js';
84
85
  import type { WrunRowLaneInstance } from './sources/wrun-row-lane.types.js';
85
86
  import type { WrunLiveApplied } from './wrun-live-patch.util.js';
@@ -156,6 +157,15 @@ export interface WrunOverlayLiveContext {
156
157
  * an arm of the same identity; a save leaves the previous context until the rerun installs its
157
158
  * own. Absent on contexts stored before this field existed and on a draft: never sent. */
158
159
  computeIdentity?: string;
160
+ /** The registry version the installing run executed (its target's `version`): a session fallback
161
+ * (pinForThisSession) may run an older version than the row's saved pin, which `computeIdentity`
162
+ * cannot tell, so the workspace switch's stand-in capture (kscript-standin-switch.util) stores the
163
+ * shown picture only under the pin this session ran. Absent for a lane with no registry version. */
164
+ version?: string;
165
+ /** The settings revision the run computed with (`computed.generation`, C1: a compute-relevant save bumps it, a
166
+ * style save never): the switch's stand-in capture stores the shown picture only while the row still carries it,
167
+ * since a save moves the row at once and the session shows the previous computation until the rerun lands. */
168
+ settingsRevision?: number;
159
169
  /** An editor draft (isWrunDraftOverlaySettings): the run seam raised its run-health
160
170
  * verdict (wrun-run-health.util) and the live session keeps it honest. */
161
171
  draft: boolean;
@@ -300,6 +310,13 @@ export interface WrunOverlayLiveContext {
300
310
  /** Per lane, the SAME payload object the history fetch used (units, quote,
301
311
  * ladder identity), so a live fold lands in the history lane's units. */
302
312
  acquisition: Partial<Record<WrunLiveLane, WrunLaneAcquisition>>;
313
+ /** A Cloud session's: the receipt of the OPRA rows its newest answer was computed from (contract
314
+ * opra-server-lanes C4), the tier its legend's served word names on every tick; absent when the session reads no
315
+ * OPRA, or its newest answer named no tier (no word then, never the account's tier). */
316
+ cloudOpraServed?: WrunOpraServedReceipt;
317
+ /** The session reads OPRA data (the console provenance of the run that installed it, `computed.opra`; a cloud
318
+ * frame carrying the OPRA mark raises it): every debug line its ticks and reseeds publish states it. */
319
+ opraRead?: true;
303
320
  /** The carry-forward state after every input row strictly before
304
321
  * `lastRowTs` (the seed the tail builder resumes from): the forward-fill
305
322
  * scalars, the forming buckets and the pinned legs' confirmed cursors. */
@@ -29,6 +29,15 @@
29
29
  * paints, fresh replaces"): the kScript runner's arm, take, bypass-token and
30
30
  * restore rules under the wrun id.
31
31
  *
32
+ * A chart that holds a wrun overlay publishes its chrome safe-area insets to
33
+ * the engine (DW06) while the overlay stands: the engine places records by
34
+ * them that the drawing safe area never sees (a docked matrix's header, a
35
+ * note label flagged for the chrome), on charts with no HUD, corner group or
36
+ * `safeArea` card. Each integrated run holds the chart's one chrome tracker
37
+ * for the overlay (`holdChartChromeSafeArea`, the tracker the drawings door
38
+ * and the HUD layer share), and the overlay's teardown lets go of it; a pause
39
+ * keeps it, since the paused picture stays.
40
+ *
32
41
  * The recovery ladders (heal, source rungs, casualty window) live in
33
42
  * wrun-overlay-recovery.util; the door re-exports the hold and the heal.
34
43
  * Import graph as in the drivers registry: the chart store and titan-charts are
@@ -114,5 +123,5 @@ export declare function resyncWrunOverlayAfterWake(chartIndex: number, indicator
114
123
  * without a driver.
115
124
  */
116
125
  export declare function withWrunOverlayExecutionMeasure<T>(chartIndex: number, indicatorId: string, reason: string, run: () => T): T;
117
- /** Clears the door's state and the recovery ladders' state. */
126
+ /** Clears the door's state (the chrome holds let go) and the recovery ladders' state. */
118
127
  export declare function __resetWrunOverlayLifecycleForTests(): void;
@@ -6,6 +6,7 @@ import { resolveLocalTechnicalScriptLazyRefreshRange, } from '../chart/local-tec
6
6
  import { overlayExecutionGuardKey } from '../chart/overlay-execution-guard-key.leaf.js';
7
7
  import { armLocalKScriptSourceRevalidation, clearLocalKScriptSourceRevalidation, disarmLocalKScriptSourceRevalidation, hasPendingLocalKScriptSourceRevalidation, installLocalKScriptSourceCacheBypass, markLocalKScriptSourceCacheHit, releaseLocalKScriptSourceCacheBypass, takePendingLocalKScriptSourceRevalidation, } from '../chart/local-kscript-source-revalidation.util.js';
8
8
  import { getChartDataFetchGeneration } from '../chart/chart-data-fetch-generation.util.js';
9
+ import { holdChartChromeSafeArea, releaseChartChromeSafeArea, } from '../chart/kscript-drawing-safe-area.util.js';
9
10
  import { isRealChartTimeRangeMs } from '../chart/chart-time-domain.util.js';
10
11
  import { ohlcvRowsHaveFiniteClose } from '../chart/ohlcv-row-readiness.util.js';
11
12
  import { wrunChartHostEnv } from '../../host-env.js';
@@ -426,12 +427,55 @@ async function runWrunSourceRevalidation(chartIndex, indicatorId, armedGeneratio
426
427
  }
427
428
  }
428
429
  // ---------------------------------------------------------------------------
430
+ // The chart chrome a wrun overlay's chart publishes (DW06)
431
+ // ---------------------------------------------------------------------------
432
+ // Per overlay: the chart engine its chrome hold is on.
433
+ const chromeHolds = new Map();
434
+ /**
435
+ * After an integrated run: the overlay's chart keeps its chrome insets
436
+ * reaching the engine. Every run holds again (a second hold of an id is no
437
+ * change), so a tracker that stopped with its pane DOM starts again with the
438
+ * next run; a chart replaced at the index takes the hold from the old engine.
439
+ * Never throws: the run it follows already landed.
440
+ */
441
+ function holdWrunChartChrome(indicatorId, chartIndex) {
442
+ if (!hasWrunOverlayDriver(indicatorId))
443
+ return;
444
+ try {
445
+ const tc = wrunChartHostEnv().chart.instance(chartIndex);
446
+ if (!tc)
447
+ return;
448
+ const held = chromeHolds.get(indicatorId);
449
+ if (held !== undefined && held !== tc)
450
+ releaseChartChromeSafeArea(held, indicatorId);
451
+ chromeHolds.set(indicatorId, tc);
452
+ holdChartChromeSafeArea(tc, indicatorId);
453
+ }
454
+ catch (error) {
455
+ console.warn('[wrun] could not hold the chart chrome for', indicatorId, error);
456
+ }
457
+ }
458
+ /** The overlay left its chart: its chrome hold goes (the chart's last hold sends the engine null insets). */
459
+ function releaseWrunChartChrome(indicatorId) {
460
+ const held = chromeHolds.get(indicatorId);
461
+ if (held === undefined)
462
+ return;
463
+ chromeHolds.delete(indicatorId);
464
+ releaseChartChromeSafeArea(held, indicatorId);
465
+ }
466
+ /** The door's one success hook: the chrome hold, then the SWR revalidation the run may owe. */
467
+ function onWrunComputeSucceeded(indicatorId, chartIndex) {
468
+ holdWrunChartChrome(indicatorId, chartIndex);
469
+ maybeScheduleWrunSourceRevalidation(indicatorId, chartIndex);
470
+ }
471
+ // ---------------------------------------------------------------------------
429
472
  // Teardown, registrations, test seam
430
473
  // ---------------------------------------------------------------------------
431
474
  /** Everything the door holds for one overlay goes with it, the SWR marks and
432
475
  * token under its id included (data-loading rule 3). A live-session suspend
433
- * runs the same hooks; the next integrated run marks and arms again. */
434
- function dropWrunLifecycleState(indicatorId) {
476
+ * runs the same hooks; the next integrated run marks and arms again. The
477
+ * chrome hold is the overlay's, not the session's: a suspend keeps it. */
478
+ function dropWrunLifecycleState(indicatorId, cause) {
435
479
  const timer = revalidationTimers.get(indicatorId);
436
480
  if (timer !== undefined)
437
481
  clearTimeout(timer);
@@ -440,12 +484,14 @@ function dropWrunLifecycleState(indicatorId) {
440
484
  revalidationCharts.delete(indicatorId);
441
485
  if (chartIndex !== undefined)
442
486
  clearLocalKScriptSourceRevalidation(chartIndex, indicatorId);
487
+ if (cause !== 'suspend')
488
+ releaseWrunChartChrome(indicatorId);
443
489
  }
444
490
  // Registered at import like the live intake and the tick lane. Specs that mock
445
491
  // the drivers util partially have no hook registry (reading a missing export of
446
492
  // a mocked module throws), so the registration is skipped there.
447
493
  try {
448
- onWrunOverlayComputeSucceeded(maybeScheduleWrunSourceRevalidation);
494
+ onWrunOverlayComputeSucceeded(onWrunComputeSucceeded);
449
495
  }
450
496
  catch {
451
497
  // partial module mock (specs)
@@ -456,11 +502,13 @@ try {
456
502
  catch {
457
503
  // partial module mock (specs)
458
504
  }
459
- /** Clears the door's state and the recovery ladders' state. */
505
+ /** Clears the door's state (the chrome holds let go) and the recovery ladders' state. */
460
506
  export function __resetWrunOverlayLifecycleForTests() {
461
507
  for (const timer of revalidationTimers.values())
462
508
  clearTimeout(timer);
463
509
  revalidationTimers.clear();
464
510
  revalidationCharts.clear();
511
+ for (const indicatorId of [...chromeHolds.keys()])
512
+ releaseWrunChartChrome(indicatorId);
465
513
  __resetWrunOverlayRecoveryForTests();
466
514
  }