@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
@@ -34,25 +34,39 @@
34
34
  * packer judges `max_cells`, never a fetch facet). A market pin, `history` and `min_size` are refused by name; a
35
35
  * block over `max_cells` refuses the run (wrun_cell_block_too_large, never truncated). One chain per package.
36
36
  * - `fold` "kit" (OPTLOAD G5, kit 0.90.0; wrun-option-views.util): `nearest`, `window_pct` (required), `lens`,
37
- * `step_rows` (required), `carry` and `levels`, refused by the SDK's rules by name (`wrun_option_knob_invalid`); its
38
- * `expiries` word is "all" or none (kit 0.91.1: the fold keeps its expiries with its own `nearest`, any other word
39
- * refused at declaration). Each bar reads the fold of its newest
37
+ * `step_rows` (required), `carry`, `levels` and `curve` (kit 0.96.0, beside `levels` only), refused by the SDK's
38
+ * rules by name (`wrun_option_knob_invalid`); its `expiries` word is "all" or none (kit 0.91.1: the fold keeps its
39
+ * expiries with its own `nearest`, any other word refused at declaration). Each bar reads the fold of its newest
40
40
  * minute, 14-value rows (`[1, totals..., max_pain, zero_gamma, call_wall, put_wall, spot, refused]` when `levels`,
41
+ * with `curve` the curve row `[2, gex_at_spot, gamma_flip, curve_spot, priced_at_ms, contracts, 0...]` after it,
41
42
  * then `[0, strike, value]` at the strikes the template draws), asked of the gateway at the chart's bars
42
- * (`strikeKitFold` and its params, `strikeMaxCells` the input's `max_cells`) and folded by the worker by the same
43
- * rules while the gateway refuses the read. A bar whose newest minute held more rows than `max_cells` answers its
43
+ * (`strikeKitFold` and its params, `strikeMaxCells` the input's `max_cells`, with `curve` `strikeKitCurve` and
44
+ * `strikeKitMultiplier`, the chart's `market.option_multiplier()`) and folded by the worker with the kit's own fold
45
+ * while the gateway refuses the read. A bar whose newest minute held more rows than `max_cells` answers its
44
46
  * levels row refused, and that refuses the run (wrun_cell_block_too_large), as a block over `max_cells` does today;
45
47
  * an input declaring `missing: "empty"` reads that bar empty instead (C1.2b). The run carries the 14-value rows: the
46
48
  * lane's plan, the packer and the shared aligner (kit 0.91.1) size the block by the input's width
47
49
  * (`WRUN_OPTION_STRIKES_KIT_SERVED`).
48
50
  * - O1 (OPTLOAD G5): on the OPRA plane the chain is the plane's own by coin (`wrunHeldOpraPlaneChain`), no chain
49
51
  * directory read.
52
+ * - `velocity_windows` (SKYLIT-PARITY contract H; the om schema takes the knob by this name and shape): 1 to 7 distinct
53
+ * windows in minutes from 1, 5, 10, 15, 60, 240 and 1440, a literal list. It rides the ask
54
+ * (`strikeVelocityWindowsMin`, the knob's order) and each tuple appends four lists after `underlying`, each one entry
55
+ * per window in the knob's order: `[...12 values, net_gex_velocity..., net_dex_velocity..., net_vex_velocity...,
56
+ * oi_velocity...]`, width 12 + 4N (`wrunOptionStrikesVelocityWidth`). Without the knob the 12-value tuple is
57
+ * byte-identical. The gateway answers velocity on its fold BAR state read alone, whose rows are per strike (every
58
+ * live expiry of the bar summed), so every tuple of one strike in one bar carries the strike's lists; NaN where the
59
+ * gateway has no lagged minute, where it does not draw the chart's bars, on a crypto chain (the state fold sums every
60
+ * book of the coin) and wherever the read fails. Refused by name beside `fold: "kit"` (the gateway refuses velocity
61
+ * on the kit fold) and, while the kit sizes an input by the class width alone, by this host
62
+ * (`WRUN_OPTION_STRIKES_VELOCITY_SERVED`).
50
63
  *
51
64
  * LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
52
65
  */
53
66
  import { decideWrunLaneChain, decideWrunLaneChainIdentity, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChainLeadMoved, wrunLaneChainRefusalError, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
54
67
  import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
55
- import { WRUN_OPTION_STRIKES_KIT_LAYOUTS, WRUN_OPTION_STRIKES_KIT_REFUSED_COLUMN, wrunHeldOpraPlaneChain, wrunOptionLaneAskFields, wrunOptionLaneAskOfSource, } from '../../wrun-option-views.util.js';
68
+ import { WRUN_OPTION_STRIKES_KIT_LAYOUTS, WRUN_OPTION_STRIKES_KIT_REFUSED_COLUMN, WRUN_OPTION_STRIKES_VELOCITY_FIELD, WRUN_OPTION_STRIKES_VELOCITY_KNOB, WRUN_OPTION_STRIKES_VELOCITY_TAKES, wrunHeldOpraPlaneChain, wrunOptionLaneAskFields, wrunOptionLaneAskOfSource, wrunOptionStrikesVelocityWindows, } from '../../wrun-option-views.util.js';
69
+ import { refuseWrunOptionKnob } from '../../wrun-option-knobs.util.js';
56
70
  import { WRUN_OPTIONS_CHAIN_EXPIRIES_CODE, wrunOptionsChainExpiries, wrunOptionsChainIdentityKey, } from '../../wrun-options-chain.util.js';
57
71
  import { attachWrunRefusal, wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
58
72
  /** f64s per tuple (om's `WRUN_OPTION_STRIKES_TUPLE_WIDTH`). */
@@ -137,20 +151,69 @@ export const WRUN_OPTION_VIEWS_UNSERVED_REFUSAL = 'wrun_option_views_unserved';
137
151
  export const WRUN_OPTION_STRIKES_KIT_SERVED = true;
138
152
  /**
139
153
  * Whether this host answers the strike kit fold's curve row (kit 0.96.0: `curve: true` beside `levels: true`, a row of
140
- * the gamma curve's readings after each bar's levels row). Not yet: the gateway's `strikeKitCurve` read and the worker's
141
- * fold of it are the Spot Exposures design's units (OPTLOAD W3, U2 and U4), and a fold without the row would read every
142
- * curve reading NaN. So an input declaring `curve: true` is refused by name after its knobs pass, never drawn without
143
- * its curve; U4 sets this true with the fold that answers the row.
154
+ * the gamma curve's readings after each bar's levels row). It does (OPTLOAD W3 U4): the ask names `strikeKitCurve` and
155
+ * `strikeKitMultiplier`, the worker reads the gateway's curve fields into the row (pb-common 12.74.0, fields 24 to 28)
156
+ * and folds it with the kit's own fold while the gateway refuses the read; a grouped answer without the curve fields
157
+ * is refused, never drawn. False refuses a `curve: true` input by name after its knobs pass.
144
158
  */
145
- export const WRUN_OPTION_STRIKES_KIT_CURVE_SERVED = false;
159
+ export const WRUN_OPTION_STRIKES_KIT_CURVE_SERVED = true;
160
+ /**
161
+ * Whether this host carries the velocity lists (`velocity_windows`) into a run. Not yet: the shared host plans and
162
+ * aligns each input at the KIT's width rule (kit `planWrunRun`, `alignWrunRows`, `wrunOptionInputTupleWidth`), and the
163
+ * kit sizes an option_strikes input at the class's 12 values until the om schema names the knob, so a velocity block
164
+ * (12 + 4N values a tuple) would split wrong there. So an input declaring the knob is refused by name after its words
165
+ * pass, never read wrong; the kit bump whose rule sizes it (`wrunOptionStrikesVelocityWidth`) sets this true
166
+ * (tests/utility/wrun/sources/option_strikes.velocity.spec.ts holds the two together).
167
+ */
168
+ export const WRUN_OPTION_STRIKES_VELOCITY_SERVED = false;
169
+ /**
170
+ * An input's velocity windows as the ask carries them (`strikeVelocityWindowsMin`, the knob's order), none without the
171
+ * knob, or a refusal by name: a value outside the knob's words (`wrun_option_knob_invalid`), the knob beside
172
+ * `fold: "kit"` (the gateway answers velocity on the state fold alone), and while this host does not carry the lists
173
+ * into a run (`WRUN_OPTION_STRIKES_VELOCITY_SERVED`).
174
+ */
175
+ export function wrunOptionStrikesVelocityExtras(source, ctx) {
176
+ const value = source[WRUN_OPTION_STRIKES_VELOCITY_KNOB];
177
+ if (value === undefined)
178
+ return undefined;
179
+ const windows = wrunOptionStrikesVelocityWindows(value);
180
+ if (windows === undefined) {
181
+ return refuseWrunOptionKnob(ctx, WRUN_OPTION_STRIKES_VELOCITY_KNOB, value, WRUN_OPTION_STRIKES_VELOCITY_TAKES);
182
+ }
183
+ if (source.fold === 'kit') {
184
+ return refuseWrunOptionKnob(ctx, WRUN_OPTION_STRIKES_VELOCITY_KNOB, value, 'the strike rows alone, never fold "kit" (drop one of the two)');
185
+ }
186
+ if (!WRUN_OPTION_STRIKES_VELOCITY_SERVED) {
187
+ return refuseWrunPollInput(ctx, `reads option_strikes with ${WRUN_OPTION_STRIKES_VELOCITY_KNOB} (${WRUN_OPTION_VIEWS_UNSERVED_REFUSAL}): this ` +
188
+ "app does not carry the strike velocity columns into a run yet; drop the knob and read the strike rows' " +
189
+ 'own columns', wrunAuthorRuleSeed(WRUN_OPTION_VIEWS_UNSERVED_REFUSAL));
190
+ }
191
+ return { [WRUN_OPTION_STRIKES_VELOCITY_FIELD]: windows };
192
+ }
146
193
  /**
147
194
  * The acquisition fields of an input's strike kit fold (OPTLOAD G5): the fold, its params and the input's `max_cells`,
148
195
  * so the gateway (or the worker's fold while the gateway refuses it) answers a refused levels row for a bar whose newest
149
- * minute held more rows. The fold reads every expiry of the minute (its `nearest` keeps the soonest): an `expiries`
150
- * word other than "all" beside it was refused at declaration (`wrunOptionLaneAskOfSource`, the SDK's words).
196
+ * minute held more rows; with `curve`, the curve fields and `optionMultiplier` (the chart's
197
+ * `market.option_multiplier()`, `wrunOptionStrikesChartMultiplier`). The fold reads every expiry of the minute (its
198
+ * `nearest` keeps the soonest): an `expiries` word other than "all" beside it was refused at declaration
199
+ * (`wrunOptionLaneAskOfSource`, the SDK's words).
200
+ */
201
+ export function wrunOptionStrikesKitExtras(ask, ctx, optionMultiplier) {
202
+ return wrunOptionLaneAskFields(ask, {
203
+ maxCells: ctx.maxCells,
204
+ ...(optionMultiplier !== undefined ? { optionMultiplier } : {}),
205
+ });
206
+ }
207
+ /**
208
+ * The multiplier the curve reads: the chart's `market.option_multiplier()` as the host fill computes it
209
+ * (wrun-chart-market-facts.util `wrunChartOptionMultiplier`: OPRA 100, a CME root's point value, crypto 1, else 0), so
210
+ * the gateway's curve values the chain as the template's own curve did. The lane context's market is the one the
211
+ * chain is read as: a stock twin's context names its stock on the OPRA plane (100). Loaded with the facts module at
212
+ * the first curve ask: the lane module stays off the boot path's weight.
151
213
  */
152
- export function wrunOptionStrikesKitExtras(ask, ctx) {
153
- return wrunOptionLaneAskFields(ask, { maxCells: ctx.maxCells });
214
+ export async function wrunOptionStrikesChartMultiplier(ctx) {
215
+ const { wrunChartOptionMultiplier } = await import('../../wrun-chart-market-facts.util.js');
216
+ return wrunChartOptionMultiplier({ exchange: ctx.exchange, symbol: ctx.symbol });
154
217
  }
155
218
  /** Whether a kit fold bar's rows carry the refusal: its levels row with `refused` 1 (the bar's newest minute held more
156
219
  * rows than the input's `max_cells`). */
@@ -190,8 +253,9 @@ export const rowLane = {
190
253
  horizon: wrunOptionStrikesHorizon,
191
254
  acquisitionMoved: wrunOptionStrikesAcquisitionMoved,
192
255
  identity: async (ctx) => {
193
- // O1: on the OPRA plane the chain is the plane's own by coin, no chain directory read.
194
- const held = await wrunHeldOpraPlaneChain(ctx.exchange, ctx.coin, ctx.opraPlane);
256
+ // O1: on the OPRA plane the chain is the plane's own by coin, no chain directory read (the chart market judged whole
257
+ // where the planner handed no verdict).
258
+ const held = await wrunHeldOpraPlaneChain(ctx.exchange, ctx.coin, ctx.opraPlane, ctx.symbol);
195
259
  rememberStrikesChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx, held));
196
260
  },
197
261
  facets: async (source, ctx) => {
@@ -220,8 +284,7 @@ export const rowLane = {
220
284
  throw wrunLaneChainRefusalError(decision, 'option_strikes');
221
285
  // The kit fold and its params, by the SDK's rules (`wrun_option_knob_invalid`), then this host's guard.
222
286
  const kit = wrunOptionLaneAskOfSource(source, ctx);
223
- const kitExtras = kit === undefined ? undefined : wrunOptionStrikesKitExtras(kit, ctx);
224
- if (kitExtras !== undefined && !WRUN_OPTION_STRIKES_KIT_SERVED) {
287
+ if (kit !== undefined && !WRUN_OPTION_STRIKES_KIT_SERVED) {
225
288
  return refuseWrunPollInput(ctx, `reads option_strikes with fold "kit" (${WRUN_OPTION_VIEWS_UNSERVED_REFUSAL}): this app does not carry the ` +
226
289
  "kit fold's rows into a run yet; read the strike rows whole (drop fold and its params)", wrunAuthorRuleSeed(WRUN_OPTION_VIEWS_UNSERVED_REFUSAL));
227
290
  }
@@ -229,6 +292,11 @@ export const rowLane = {
229
292
  return refuseWrunPollInput(ctx, `reads option_strikes with fold "kit" and curve (${WRUN_OPTION_VIEWS_UNSERVED_REFUSAL}): this app does not ` +
230
293
  "answer the kit fold's curve row yet; drop curve and read the gamma curve from the strike rows", wrunAuthorRuleSeed(WRUN_OPTION_VIEWS_UNSERVED_REFUSAL));
231
294
  }
295
+ const velocityExtras = wrunOptionStrikesVelocityExtras(source, ctx);
296
+ // The curve's multiplier is read for an input declaring it alone: any other asks exactly what it asked before.
297
+ const kitExtras = kit === undefined
298
+ ? undefined
299
+ : wrunOptionStrikesKitExtras(kit, ctx, kit.params.curve === 1 ? await wrunOptionStrikesChartMultiplier(ctx) : undefined);
232
300
  const chain = await decideWrunLaneChain(chart, { venue: source.venue, book: source.book }, ctx);
233
301
  return {
234
302
  // The chain's identity as the options chain keys it (one chain per package: `acquisitions: 'one'`).
@@ -237,6 +305,7 @@ export const rowLane = {
237
305
  // The run's bar span: the worker keeps the newest minute of each of these bars.
238
306
  hostIntervalMs: ctx.intervalMs,
239
307
  ...kitExtras,
308
+ ...velocityExtras,
240
309
  };
241
310
  },
242
311
  cells: wrunOptionStrikesCells,
@@ -149,7 +149,8 @@ export const rowLane = {
149
149
  await assertWrunProtocolType(ctx, WRUN_OPTION_SURFACE_TYPE, 'option_surface');
150
150
  // O1: on the OPRA plane the chain is the plane's own by coin, no chain directory read.
151
151
  const held = await wrunHeldOpraPlaneChain(ctx.exchange, ctx.coin, ctx.opraPlane);
152
- rememberSurfaceChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx, held));
152
+ // Every input decides through decideWrunLaneChain: the crypto venue listing waits for a crypto venue word.
153
+ rememberSurfaceChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx, held, { cryptoListingOnDemand: true }));
153
154
  },
154
155
  facets: async (source, ctx) => {
155
156
  for (const [knob, owners] of STRAY_KNOBS) {
@@ -38,7 +38,9 @@
38
38
  * interval pin and a view on these classes refuse in the pinned-wire planner before the lane is
39
39
  * planned; `forming` views and bindings are refused by the kit.
40
40
  */
41
+ import type { OpraOptionPlaneStop } from '../../../host-ports.types.js';
41
42
  import type { WrunInputSource } from '../../../interfaces/wrun-runtime.interface.js';
43
+ import type { GateProvider } from '../../../workers/constants/socket-slots.js';
42
44
  import type { WrunDailyLanding } from '../wrun-daily-lane.util.js';
43
45
  import { type WrunRefusalSeed } from '../wrun-refusal.util.js';
44
46
  import type { WrunBackendTier, WrunTierChoice, WrunTierLanding } from '../wrun-tier-grid.util.js';
@@ -81,6 +83,23 @@ export interface WrunPollLaneContext {
81
83
  /** The chart's options ride the OPRA plane (the run's `isOpraPlaneExchange`, the planner's one verdict), handed to a
82
84
  * `chain` lane: its chain there is OPRA's chain of the chart's own underlying. Absent reads false. */
83
85
  opraPlane?: boolean;
86
+ /** The chart market a stock twin's lane context stands in for (derived-roots.util `wrunUnderlyingLaneContext` over the
87
+ * run's twin lane market, `wrunChartOptionsLaneMarket`): the context names the twin's stock on the OPRA plane, and a
88
+ * crypto venue word still reads that venue's chain of the coin (opra-option-lanes.util `resolveWrunLaneCryptoVenues`).
89
+ * Absent on every other context. */
90
+ stockTwinOf?: {
91
+ exchange: string;
92
+ symbol: string;
93
+ };
94
+ /** The run's one options decision for the market this context names (derived-roots.util
95
+ * `decideWrunRunOptionsMarket`, handed on by the planners): the gate plane its chain rides, and off every plane the
96
+ * known stop. A chain lane's chain resolution reads it instead of deciding the plane again
97
+ * (opra-option-lanes.util `resolveWrunLaneChartChain`), so no lane of a run reads another plane than its head
98
+ * decided. Absent outside a run's plan: the plane is read when the chain resolves. */
99
+ optionsDecision?: {
100
+ plane: GateProvider | null;
101
+ opraStop?: OpraOptionPlaneStop;
102
+ };
84
103
  /**
85
104
  * The run's plan as an identity: one object per `planWrunPollLanes` call, the same for every input it plans. A lane
86
105
  * keys a resolution every input of the run shares by it (a `WeakMap`: a `chain` lane's chart, its chain and its
@@ -42,6 +42,7 @@
42
42
  import type { WrunIndicatorMetadata, WrunInputSource, WrunMetadataParam } from '../../../interfaces/wrun-runtime.interface.js';
43
43
  import type { OpraReadFacts } from '../../chart/opra-read-access.leaf.js';
44
44
  import type { OpraOptionPlaneStop } from '../../../host-ports.types.js';
45
+ import { type WrunRunOptionsMarket } from '../derived-roots.util.js';
45
46
  import { type WrunRefusalSeed } from '../wrun-refusal.util.js';
46
47
  import { type WrunPollLane, type WrunPollLaneContext, type WrunPollLaneId, type WrunPollLaneInstance, type WrunPollLaneSource } from './wrun-poll-lane.types.js';
47
48
  import { type WrunLaneChainPlane, type WrunRowLaneHorizon } from './wrun-row-lane.types.js';
@@ -76,15 +77,21 @@ export declare function wrunPollLaneInstanceKey(laneKey: string, extras: Readonl
76
77
  * says it: such a chart serves candles, time and the global series (named by class). */
77
78
  export declare function wrunPollLaneIndexModeReason(): string;
78
79
  /** What the run hands the poll planner beside the chart: its OPRA facts (`mayReadOpra`: who may read the plane)
79
- * and the predicate an `opra` lane is admitted by (`isOpraPlaneExchange`: the chart's options ride the OPRA plane,
80
- * a US stock or ETF chart under either venue spelling while the `opra` flag is lit, an OPRA contract chart; absent,
81
- * no chart is judged off the plane). */
80
+ * and the predicate an `opra` lane is admitted by (`isOpraPlaneExchange`, over the chart market's exchange and
81
+ * symbol: the chart's options ride the OPRA plane, a US stock or ETF chart under either venue spelling while the
82
+ * `opra` flag is lit, an OPRA contract chart, a stock twin reading its stock's chain; absent, no chart is judged off
83
+ * the plane). */
82
84
  export interface WrunPollLaneRunFacts extends OpraReadFacts {
83
- isOpraPlaneExchange?: (exchange: string) => boolean;
85
+ isOpraPlaneExchange?: (exchange: string, symbol: string) => boolean;
84
86
  /** Why a chart off the plane is off it although its options list on OPRA (opra-options-gate.util
85
87
  * `opraOptionPlaneStop`: the flag check's `flag-off`, the plane router's `chart-kind`); absent, the market's own
86
88
  * words ("no such feed here"). */
87
- opraPlaneStop?: (exchange: string) => OpraOptionPlaneStop | undefined;
89
+ opraPlaneStop?: (exchange: string, symbol: string) => OpraOptionPlaneStop | undefined;
90
+ /** The run's one options decision (derived-roots.util `decideWrunRunOptionsMarket`, taken at its head): every chain
91
+ * lane's input on the chart it was taken for carries it (`wrunChainLaneContext`), so its chain resolves under the
92
+ * decided plane, and a stock twin's input is planned against the twin's lane market (`options.lane`, through
93
+ * `wrunUnderlyingLaneContext`, as an `underlying` root's is). Absent: the plane is read when the chain resolves. */
94
+ options?: WrunRunOptionsMarket;
88
95
  /** The run's current setting values by name (wrun-param-values.util `wrunParamValuesFromSettings` over the
89
96
  * overlay's settings): what an option knob naming a setting reads (`resolveWrunOptionSettingKnobs`). Absent, no
90
97
  * knob's setting is read, and a lane refuses a name it cannot read by name. */
@@ -134,9 +141,17 @@ export interface WrunChartOpraPlane {
134
141
  * `opraOptionPlaneStop`: the flag check's `flag-off`, the plane router's `chart-kind`); absent, none is known. */
135
142
  stop?: OpraOptionPlaneStop;
136
143
  }
137
- /** The chart's OPRA plane facts, off the predicates the run injects (`isOpraPlaneExchange`: absent, no chart rides
138
- * the plane; `opraPlaneStop`, asked only off the plane). */
139
- export declare function wrunChartOpraPlane(exchange: string, facts: Pick<WrunPollLaneRunFacts, 'isOpraPlaneExchange' | 'opraPlaneStop'> | undefined): WrunChartOpraPlane;
144
+ /** The chart's OPRA plane facts, off the predicates the run injects over the chart's market, exchange and symbol
145
+ * (`isOpraPlaneExchange`: absent, no chart rides the plane; `opraPlaneStop`, asked only off the plane). */
146
+ export declare function wrunChartOpraPlane(chart: Pick<WrunPollLaneContext, 'exchange' | 'symbol'>, facts: Pick<WrunPollLaneRunFacts, 'isOpraPlaneExchange' | 'opraPlaneStop'> | undefined): WrunChartOpraPlane;
147
+ /**
148
+ * A chain lane input's context under the run's one options decision (`options`), both planners' one rule: on the chart
149
+ * the decision was taken for, the decision rides along (`optionsDecision`: the plane the input's chain resolves under,
150
+ * never decided again) and a stock twin's lane market stands in place of the chart's (`wrunUnderlyingLaneContext`, the
151
+ * swap an `underlying` root's input reads). A context with no decision, or one of another chart market (a switch since
152
+ * the head: the run is superseded), is left as it is.
153
+ */
154
+ export declare function wrunChainLaneContext<Ctx extends WrunPollLaneContext>(ctx: Ctx, options: WrunRunOptionsMarket | undefined): Ctx;
140
155
  /**
141
156
  * Why one input of a lane the chart does not serve is not served, as `wrunUnservedLaneInput` reads it: the planner's
142
157
  * own words after the input's label (`words`, with the `stop` when a known stop keeps the chart's OPRA options off the
@@ -201,7 +216,7 @@ export declare function wrunLaneUnservedScopeRefusal(error: unknown): error is E
201
216
  * stop. Undefined: the lane resolves its chain (its instance then meets its own plane's wall,
202
217
  * `assertWrunLaneChainPlaneReadable`).
203
218
  */
204
- export declare function wrunChainLaneStop(plane: WrunChartOpraPlane, run: OpraReadFacts | undefined, ctx: Pick<WrunPollLaneContext, 'inputName' | 'sourceClass'>): WrunUnservedLaneWhy | undefined;
219
+ export declare function wrunChainLaneStop(plane: WrunChartOpraPlane, run: OpraReadFacts | undefined, ctx: Pick<WrunPollLaneContext, 'inputName' | 'sourceClass' | 'stockTwinOf'>, venue?: unknown): WrunUnservedLaneWhy | undefined;
205
220
  /** The run's plan against the chart (WRUN-REFUSALS contract): the lane instances to fetch, and
206
221
  * the feeds the chart's fetch never serves to inputs that declared a missing fill (one entry per
207
222
  * lane key, its inputs in declaration order). */
@@ -1,4 +1,6 @@
1
+ import { wrunUnderlyingLaneContext } from '../derived-roots.util.js';
1
2
  import { wrunParamChoices } from '../wrun-color-settings.util.js';
3
+ import { isWrunOptionsChainCryptoVenueWord } from '../wrun-options-chain.util.js';
2
4
  import { refuseWrunOptionKnob } from '../wrun-option-knobs.util.js';
3
5
  import { wrunOptionPrintKnobWords } from '../wrun-option-prints.util.js';
4
6
  import { WRUN_OPTION_STRIKE_FLOW_CLASS, WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS, wrunOptionStrikeFlowExpiriesOf, } from '../wrun-option-strike-flow-lane.util.js';
@@ -216,14 +218,35 @@ export function wrunOpraPlaneStopDetail(stop) {
216
218
  ? 'is not served for this account yet: the opra flag is off, so no US options data is read on any chart'
217
219
  : 'is not served on this chart: an index chart does not ride the OPRA plane yet, so no US options data is read for it';
218
220
  }
219
- /** The chart's OPRA plane facts, off the predicates the run injects (`isOpraPlaneExchange`: absent, no chart rides
220
- * the plane; `opraPlaneStop`, asked only off the plane). */
221
- export function wrunChartOpraPlane(exchange, facts) {
222
- if (facts?.isOpraPlaneExchange?.(exchange) === true)
221
+ /** The chart's OPRA plane facts, off the predicates the run injects over the chart's market, exchange and symbol
222
+ * (`isOpraPlaneExchange`: absent, no chart rides the plane; `opraPlaneStop`, asked only off the plane). */
223
+ export function wrunChartOpraPlane(chart, facts) {
224
+ if (facts?.isOpraPlaneExchange?.(chart.exchange, chart.symbol) === true)
223
225
  return { onPlane: true };
224
- const stop = facts?.opraPlaneStop?.(exchange);
226
+ const stop = facts?.opraPlaneStop?.(chart.exchange, chart.symbol);
225
227
  return stop !== undefined ? { onPlane: false, stop } : { onPlane: false };
226
228
  }
229
+ /**
230
+ * A chain lane input's context under the run's one options decision (`options`), both planners' one rule: on the chart
231
+ * the decision was taken for, the decision rides along (`optionsDecision`: the plane the input's chain resolves under,
232
+ * never decided again) and a stock twin's lane market stands in place of the chart's (`wrunUnderlyingLaneContext`, the
233
+ * swap an `underlying` root's input reads). A context with no decision, or one of another chart market (a switch since
234
+ * the head: the run is superseded), is left as it is.
235
+ */
236
+ export function wrunChainLaneContext(ctx, options) {
237
+ if (options === undefined)
238
+ return ctx;
239
+ if ((options.chart.exchange ?? '') !== ctx.exchange || (options.chart.symbol ?? '') !== ctx.symbol)
240
+ return ctx;
241
+ const decided = {
242
+ ...ctx,
243
+ optionsDecision: {
244
+ plane: options.plane,
245
+ ...(options.opraStop !== undefined ? { opraStop: options.opraStop } : {}),
246
+ },
247
+ };
248
+ return options.lane === undefined ? decided : wrunUnderlyingLaneContext(decided, options.lane);
249
+ }
227
250
  /** The fills a scalar input reads on every bar of a feed the chart does not serve (`missing: "nan"` or `"zero"`). */
228
251
  const WRUN_POLL_LANE_UNSERVED_FILLS = Object.freeze(['nan', 'zero']);
229
252
  /**
@@ -313,8 +336,11 @@ export function wrunLaneUnservedScopeRefusal(error) {
313
336
  * stop. Undefined: the lane resolves its chain (its instance then meets its own plane's wall,
314
337
  * `assertWrunLaneChainPlaneReadable`).
315
338
  */
316
- export function wrunChainLaneStop(plane, run, ctx) {
317
- if (plane.onPlane || plane.stop !== undefined)
339
+ export function wrunChainLaneStop(plane, run, ctx, venue) {
340
+ // A stock twin's input pinning a crypto venue reads that venue's chain of the coin, never OPRA's: no OPRA wall stands
341
+ // before it (its instance meets its own plane's wall, `assertWrunLaneChainPlaneReadable`).
342
+ const twinCryptoVenue = ctx.stockTwinOf !== undefined && typeof venue === 'string' && isWrunOptionsChainCryptoVenueWord(venue);
343
+ if ((plane.onPlane || plane.stop !== undefined) && !twinCryptoVenue)
318
344
  assertWrunOpraLaneReadable(run, ctx);
319
345
  return plane.stop === undefined ? undefined : { words: wrunOpraPlaneStopDetail(plane.stop), stop: plane.stop };
320
346
  }
@@ -418,7 +444,7 @@ export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = (
418
444
  const category = typeof chart.category === 'number' ? { category: chart.category } : {};
419
445
  // The chart's OPRA plane facts, read once (`wrunChartOpraPlane`, the row lanes' planner reads them the same way):
420
446
  // whether its options ride the plane, and off it the known reason a chart whose options list on OPRA rides none.
421
- const plane = wrunChartOpraPlane(chart.exchange, run);
447
+ const plane = wrunChartOpraPlane(chart, run);
422
448
  // One object per plan: the inputs of this run share a chain lane's resolutions by it.
423
449
  const runScope = {};
424
450
  for (const planned of planWrunPollLaneInputs(metadata)) {
@@ -443,6 +469,9 @@ export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = (
443
469
  : {}),
444
470
  ...(chainLane ? { runScope, opraPlane: plane.onPlane } : {}),
445
471
  };
472
+ // A chain lane reads the run's one options market: a stock twin's stock in place of the chart's
473
+ // (`wrunChainLaneContext`); every other lane, and every chain lane of any other chart, the chart's own context.
474
+ const laneCtx = chainLane ? wrunChainLaneContext(ctx, run?.options) : ctx;
446
475
  const unserved = {
447
476
  inputName: planned.inputName,
448
477
  sourceClass: planned.lane.sourceClass,
@@ -454,7 +483,7 @@ export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = (
454
483
  // served by its own plane and the chart's mode. An input the chart does not serve meets the one rule both planners
455
484
  // keep (`wrunUnservedLaneInput`: a declared fill drops it with a note, any other refuses by name).
456
485
  const why = chainLane
457
- ? wrunChainLaneStop(plane, run, ctx)
486
+ ? wrunChainLaneStop(plane, run, laneCtx, planned.source.venue)
458
487
  : wrunPollLaneUnserved(planned.lane, plane, indexModeChart, run, ctx);
459
488
  if (why !== undefined) {
460
489
  wrunUnservedLaneInput(missing, unserved, WRUN_POLL_LANE_UNSERVED_FILLS, why, cryptoVenue);
@@ -465,7 +494,7 @@ export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = (
465
494
  // An option knob naming a setting reads the setting's current value before the lane judges it (om
466
495
  // `resolveOptionParamKnobs`): the instance's extras carry the value, so a settings change re-plans and re-asks.
467
496
  const source = resolveWrunOptionSettingKnobs(ctx, planned.source, metadata.params ?? [], run?.paramValues);
468
- answered = await planned.lane.plan(source, ctx);
497
+ answered = await planned.lane.plan(source, laneCtx);
469
498
  }
470
499
  catch (error) {
471
500
  // A chart with no option chain does not serve the feed (`wrunLaneNoChainRefusal`), nor one whose options plane
@@ -0,0 +1,64 @@
1
+ /**
2
+ * One download budget per ADD (OPTLOAD W3, after R2 and FE-FOLD-CAP; wrun-row-lanes.util `fetchWrunRowLaneRows`
3
+ * `addMemo`). A budgeted read of one row lane instance of a mounted indicator leaves a memo: the bars it landed whole
4
+ * and final with their rows, the bars its budget cut, and what it downloaded within which share. Every later read of the
5
+ * same add (the run's loaded-range refresh, the live start, each live reconcile) reuses the landed bars, keeps the cut
6
+ * bars partial and asks only the bars the memo does not hold (a new bar at the head, a bar still forming), so the add
7
+ * spends its budget once, not once a read. INT 2026-10-23, Premium by Strike 0.3.0 on ES1! 1h: the refresh run, the
8
+ * live start and a live reconcile each folded the same 3 newest bars again, 1.21 MB a read.
9
+ *
10
+ * Off the boot path: wrun-row-lanes.util loads it only for a read that names an add.
11
+ */
12
+ import type { LiveBucketVenue } from '../../chart/live-bucket.util.js';
13
+ import { type WrunHostGridAsk } from '../wrun-tier-grid.util.js';
14
+ /** A landed bar is final once it ended this long before the read: a delayed route serves a bar's last buckets up to 15
15
+ * minutes after its close, so a bar closer to the clock is asked again by the add's next read. */
16
+ export declare const WRUN_ROW_LANE_FINAL_LAG_MS: number;
17
+ /** What the add's reads of one row lane instance hold (`wrunRowLaneAddMemoAfter`). */
18
+ export interface WrunRowLaneAddMemo {
19
+ /** The lane, its acquisition without any per-ask field, and the bar span: a read printing another reads another add
20
+ * (a setting, the market or the interval moved) and replaces the memo. */
21
+ readonly fingerprint: string;
22
+ /** The bars read whole and final, each with its landed row (undefined: the bar answered nothing, an empty bar). */
23
+ readonly landed: ReadonlyMap<number, ReadonlyArray<unknown> | undefined>;
24
+ /** The bars the add's budget left partial: never asked again by the add. */
25
+ readonly cut: ReadonlySet<number>;
26
+ /** What the add's budgeted reads downloaded, and the share they read within (a later run reads what is left). */
27
+ readonly spentBytes: number;
28
+ readonly shareBytes: number;
29
+ }
30
+ /** The add's memo, or undefined when it holds none or one of another fingerprint (dropped then). */
31
+ export declare function wrunRowLaneAddMemoOf(key: string, fingerprint: string): WrunRowLaneAddMemo | undefined;
32
+ export declare function rememberWrunRowLaneAdd(key: string, memo: WrunRowLaneAddMemo): void;
33
+ /** A whole run of the add (its plan fits the budget again): the add reads its window whole, no memo after it. */
34
+ export declare function forgetWrunRowLaneAdd(key: string): void;
35
+ /** Test seam: forget every memo. */
36
+ export declare function __resetWrunRowLaneAddMemosForTests(): void;
37
+ /** The asks over the bars `keep` keeps: each ask cut into the runs of its kept bars (a bar belongs to the ask its span
38
+ * opens in), the tier kept; a run reaching the ask's last bar keeps the ask's own end. */
39
+ export declare function wrunRowLaneAsksOverBars(asks: readonly WrunHostGridAsk[], keep: (stampMs: number) => boolean, window: {
40
+ barOpens: readonly number[];
41
+ intervalMs: number;
42
+ }, sessionGrid: LiveBucketVenue | null | undefined): WrunHostGridAsk[];
43
+ /**
44
+ * The add's memo after one of its reads: every bar the read asked that landed whole (not partial for the read, no
45
+ * partial mark on its row) and final (ended `WRUN_ROW_LANE_FINAL_LAG_MS` before the read's clock) joins the landed bars
46
+ * and leaves the cut; every bar the read's budget cut joins the cut unless it is landed; a budgeted read adds what it
47
+ * downloaded and names its share (a live read adds nothing: the add's budget is its runs').
48
+ */
49
+ export declare function wrunRowLaneAddMemoAfter(args: {
50
+ previous: WrunRowLaneAddMemo | undefined;
51
+ fingerprint: string;
52
+ window: {
53
+ intervalMs: number;
54
+ nowMs: number;
55
+ };
56
+ sessionGrid: LiveBucketVenue | null | undefined;
57
+ askedBars: Iterable<number>;
58
+ landedRows: ReadonlyMap<number, ReadonlyArray<unknown>>;
59
+ partialBars: ReadonlySet<number>;
60
+ marked: (row: ReadonlyArray<unknown>) => boolean;
61
+ cutBars: Iterable<number>;
62
+ spentBytes: number;
63
+ shareBytes: number | undefined;
64
+ }): WrunRowLaneAddMemo;
@@ -0,0 +1,89 @@
1
+ import { wrunHostBarSpanOf } from '../wrun-tier-grid.util.js';
2
+ const MINUTE_MS = 60_000;
3
+ /** A landed bar is final once it ended this long before the read: a delayed route serves a bar's last buckets up to 15
4
+ * minutes after its close, so a bar closer to the clock is asked again by the add's next read. */
5
+ export const WRUN_ROW_LANE_FINAL_LAG_MS = 20 * MINUTE_MS;
6
+ /** The memos kept, the oldest dropped first: one for each budgeted row lane instance of a mounted indicator. */
7
+ const MEMOS_KEPT = 32;
8
+ const memos = new Map();
9
+ /** The add's memo, or undefined when it holds none or one of another fingerprint (dropped then). */
10
+ export function wrunRowLaneAddMemoOf(key, fingerprint) {
11
+ const memo = memos.get(key);
12
+ if (memo === undefined)
13
+ return undefined;
14
+ if (memo.fingerprint !== fingerprint) {
15
+ memos.delete(key);
16
+ return undefined;
17
+ }
18
+ return memo;
19
+ }
20
+ export function rememberWrunRowLaneAdd(key, memo) {
21
+ memos.delete(key);
22
+ memos.set(key, memo);
23
+ while (memos.size > MEMOS_KEPT)
24
+ memos.delete(memos.keys().next().value);
25
+ }
26
+ /** A whole run of the add (its plan fits the budget again): the add reads its window whole, no memo after it. */
27
+ export function forgetWrunRowLaneAdd(key) {
28
+ memos.delete(key);
29
+ }
30
+ /** Test seam: forget every memo. */
31
+ export function __resetWrunRowLaneAddMemosForTests() {
32
+ memos.clear();
33
+ }
34
+ /** The asks over the bars `keep` keeps: each ask cut into the runs of its kept bars (a bar belongs to the ask its span
35
+ * opens in), the tier kept; a run reaching the ask's last bar keeps the ask's own end. */
36
+ export function wrunRowLaneAsksOverBars(asks, keep, window, sessionGrid) {
37
+ const out = [];
38
+ for (const ask of asks) {
39
+ const bars = window.barOpens.filter((stampMs) => {
40
+ const { fromMs } = wrunHostBarSpanOf(stampMs, window.intervalMs, sessionGrid);
41
+ return fromMs >= ask.fromMs && fromMs < ask.toMs;
42
+ });
43
+ let runFrom;
44
+ for (let at = 0; at < bars.length; at += 1) {
45
+ const span = wrunHostBarSpanOf(bars[at], window.intervalMs, sessionGrid);
46
+ if (keep(bars[at])) {
47
+ if (runFrom === undefined)
48
+ runFrom = span.fromMs;
49
+ if (at === bars.length - 1)
50
+ out.push({ ...ask, fromMs: runFrom, toMs: ask.toMs });
51
+ continue;
52
+ }
53
+ if (runFrom !== undefined)
54
+ out.push({ ...ask, fromMs: runFrom, toMs: span.fromMs });
55
+ runFrom = undefined;
56
+ }
57
+ }
58
+ return out;
59
+ }
60
+ /**
61
+ * The add's memo after one of its reads: every bar the read asked that landed whole (not partial for the read, no
62
+ * partial mark on its row) and final (ended `WRUN_ROW_LANE_FINAL_LAG_MS` before the read's clock) joins the landed bars
63
+ * and leaves the cut; every bar the read's budget cut joins the cut unless it is landed; a budgeted read adds what it
64
+ * downloaded and names its share (a live read adds nothing: the add's budget is its runs').
65
+ */
66
+ export function wrunRowLaneAddMemoAfter(args) {
67
+ const landed = new Map(args.previous?.landed ?? []);
68
+ const cut = new Set(args.previous?.cut ?? []);
69
+ const finalBefore = args.window.nowMs - WRUN_ROW_LANE_FINAL_LAG_MS;
70
+ for (const stampMs of args.askedBars) {
71
+ const row = args.landedRows.get(stampMs);
72
+ const whole = !args.partialBars.has(stampMs) && (row === undefined || !args.marked(row));
73
+ const { toMs } = wrunHostBarSpanOf(stampMs, args.window.intervalMs, args.sessionGrid);
74
+ if (!whole || toMs > finalBefore)
75
+ continue;
76
+ landed.set(stampMs, row);
77
+ cut.delete(stampMs);
78
+ }
79
+ for (const stampMs of args.cutBars)
80
+ if (!landed.has(stampMs))
81
+ cut.add(stampMs);
82
+ return {
83
+ fingerprint: args.fingerprint,
84
+ landed,
85
+ cut,
86
+ spentBytes: (args.previous?.spentBytes ?? 0) + Math.max(0, args.spentBytes),
87
+ shareBytes: args.shareBytes ?? args.previous?.shareBytes ?? 0,
88
+ };
89
+ }
@@ -7,10 +7,18 @@ export declare const WRUN_ROW_LANE_FIRST_PAINT_BARS = 30;
7
7
  /** The most bytes a row lane's first ask is projected to answer (OPTLOAD first paint: 0.25 MB, at 8 bytes a cell). */
8
8
  export declare const WRUN_ROW_LANE_FIRST_PAINT_BYTES: number;
9
9
  /** The fewest bars a first slice holds to draw before the older bars land: a closed bar beside the newest. A lane
10
- * whose budget leaves the newest bar alone (Strike Footprint's expiry_strike rows, Interval Flow's contracts at 1h)
11
- * draws nothing early: one bar, forming most of a session, is no first picture to check, and Strike Footprint learns
12
- * its strike step over the whole run, so that bar could read another value once the older bars land. */
10
+ * whose budget leaves the newest bar alone (Interval Flow's contracts at 1h) draws nothing early: one bar, forming
11
+ * most of a session, is no first picture to check. Strike Footprint never draws early
12
+ * (`wrunRowLaneDrawsFirstSlice`). */
13
13
  export declare const WRUN_ROW_LANE_FIRST_SLICE_MIN_BARS = 2;
14
+ /**
15
+ * Whether an instance's first slice may draw before its older bars land (wrun-row-lanes.util `onFirstSlice`): never
16
+ * Strike Footprint's per-(expiry, strike) rows (`option_strike_flow`'s `expiry_strike` group), whatever the slice
17
+ * holds. It learns its strike step over the whole run, so a slice bar could read another value once the older bars
18
+ * land. Its projection alone kept it out (one bar filled the slice) until the projection followed the bar's width: a
19
+ * 5-minute slice holds five of its bars.
20
+ */
21
+ export declare function wrunRowLaneDrawsFirstSlice(sourceClass: string, acquisition: Readonly<Record<string, unknown>>): boolean;
14
22
  /** A host-grid ask plan split for first paint: the slice's asks (`first`), the older parts newest first (`older`, empty
15
23
  * when the slice holds the plan whole), where the slice starts (its first bar's open; set only when it split) and
16
24
  * whether its cut falls on a trade date's first bar (`sessions` asked and met; set only then). */
@@ -27,6 +35,10 @@ export interface WrunRowLaneFirstPaintSplit {
27
35
  * slice: a 5m chart inside its day) the split is the plain one, unaligned, and nothing draws before the whole answer.
28
36
  */
29
37
  export declare function wrunRowLaneFirstPaintSplit(asks: readonly WrunHostGridAsk[], window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs' | 'nowMs'>, budget: WrunRowLaneRowBudget | undefined, acquisition?: Readonly<Record<string, unknown>>, sessionGrid?: LiveBucketVenue | null, sessions?: (barOpenMs: number) => number): WrunRowLaneFirstPaintSplit;
38
+ /** A host-grid ask plan cut at `sliceFromMs` (never inside a bar): the slice's asks and the older ones, newest first;
39
+ * the plan whole as the slice when no ask opens before it. A budgeted read of a whole session per row slices on its
40
+ * newest session's first bar (wrun-row-lanes.util `landWithinDownloadShare`, OPTLOAD W3 R2). */
41
+ export declare function wrunRowLaneSplitAt(asks: readonly WrunHostGridAsk[], sliceFromMs: number): WrunRowLaneFirstPaintSplit;
30
42
  /** A host-grid ask plan ordered for first paint (see the module doc): the slice's asks, then the older ones. */
31
43
  export declare function wrunRowLaneFirstPaintAsks(asks: readonly WrunHostGridAsk[], window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs' | 'nowMs'>, budget: WrunRowLaneRowBudget | undefined, acquisition?: Readonly<Record<string, unknown>>, sessionGrid?: LiveBucketVenue | null): WrunHostGridAsk[];
32
44
  /**
@@ -15,15 +15,26 @@
15
15
  */
16
16
  import { KSCRIPT_SOURCE_CELL_BYTES } from '../../chart/kscript-source-answer-budget.leaf.js';
17
17
  import { wrunHostBarSpanOf } from '../wrun-tier-grid.util.js';
18
+ import { WRUN_OPTION_STRIKE_FLOW_CLASS } from '../wrun-option-strike-flow-lane.util.js';
18
19
  /** The most host bars a row lane's first ask covers (OPTLOAD first paint: the newest 30 bars first). */
19
20
  export const WRUN_ROW_LANE_FIRST_PAINT_BARS = 30;
20
21
  /** The most bytes a row lane's first ask is projected to answer (OPTLOAD first paint: 0.25 MB, at 8 bytes a cell). */
21
22
  export const WRUN_ROW_LANE_FIRST_PAINT_BYTES = 256 * 1024;
22
23
  /** The fewest bars a first slice holds to draw before the older bars land: a closed bar beside the newest. A lane
23
- * whose budget leaves the newest bar alone (Strike Footprint's expiry_strike rows, Interval Flow's contracts at 1h)
24
- * draws nothing early: one bar, forming most of a session, is no first picture to check, and Strike Footprint learns
25
- * its strike step over the whole run, so that bar could read another value once the older bars land. */
24
+ * whose budget leaves the newest bar alone (Interval Flow's contracts at 1h) draws nothing early: one bar, forming
25
+ * most of a session, is no first picture to check. Strike Footprint never draws early
26
+ * (`wrunRowLaneDrawsFirstSlice`). */
26
27
  export const WRUN_ROW_LANE_FIRST_SLICE_MIN_BARS = 2;
28
+ /**
29
+ * Whether an instance's first slice may draw before its older bars land (wrun-row-lanes.util `onFirstSlice`): never
30
+ * Strike Footprint's per-(expiry, strike) rows (`option_strike_flow`'s `expiry_strike` group), whatever the slice
31
+ * holds. It learns its strike step over the whole run, so a slice bar could read another value once the older bars
32
+ * land. Its projection alone kept it out (one bar filled the slice) until the projection followed the bar's width: a
33
+ * 5-minute slice holds five of its bars.
34
+ */
35
+ export function wrunRowLaneDrawsFirstSlice(sourceClass, acquisition) {
36
+ return sourceClass !== WRUN_OPTION_STRIKE_FLOW_CLASS || acquisition.group !== 'expiry_strike';
37
+ }
27
38
  /**
28
39
  * A host-grid ask plan split for first paint (see the module doc). `sessions` (the chart's trade date of a bar, on
29
40
  * every run that reads one) moves the cut forward to the first slice bar of another trade date than the bar before the cut, so the slice
@@ -65,6 +76,14 @@ export function wrunRowLaneFirstPaintSplit(asks, window, budget, acquisition = {
65
76
  ...(aligned !== undefined ? { sessionAligned: true } : {}),
66
77
  };
67
78
  }
79
+ /** A host-grid ask plan cut at `sliceFromMs` (never inside a bar): the slice's asks and the older ones, newest first;
80
+ * the plan whole as the slice when no ask opens before it. A budgeted read of a whole session per row slices on its
81
+ * newest session's first bar (wrun-row-lanes.util `landWithinDownloadShare`, OPTLOAD W3 R2). */
82
+ export function wrunRowLaneSplitAt(asks, sliceFromMs) {
83
+ if (asks.every((ask) => ask.fromMs >= sliceFromMs))
84
+ return { first: [...asks], older: [] };
85
+ return { ...cutAsks(asks, sliceFromMs), sliceFromMs };
86
+ }
68
87
  /** The asks cut at `sliceFrom` (never inside a bar): the slice's in their order, the older ones newest first. */
69
88
  function cutAsks(asks, sliceFrom) {
70
89
  const first = [];