@orangecharts/wrun-chart-host 0.7.1 → 0.9.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 (210) hide show
  1. package/README.md +27 -4
  2. package/dist/constants/feature-flags.constants.d.ts +5 -0
  3. package/dist/constants/feature-flags.constants.js +32 -0
  4. package/dist/constants/marketCapabilities.constants.d.ts +14 -9
  5. package/dist/constants/marketCapabilities.constants.js +36 -13
  6. package/dist/constants/opra-compliance.constants.d.ts +14 -0
  7. package/dist/constants/opra-compliance.constants.js +14 -0
  8. package/dist/constants/option-venues.constants.d.ts +29 -6
  9. package/dist/constants/option-venues.constants.js +19 -2
  10. package/dist/constants/venue-presets.constants.d.ts +17 -3
  11. package/dist/constants/venue-presets.constants.js +17 -3
  12. package/dist/host-env.d.ts +34 -4
  13. package/dist/host-env.js +21 -0
  14. package/dist/host-ports.types.d.ts +51 -3
  15. package/dist/index.d.ts +17 -0
  16. package/dist/index.js +17 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +40 -11
  18. package/dist/indicators/controls/tpo-session.util.js +138 -14
  19. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  20. package/dist/interfaces/opra-realtime.interface.js +10 -10
  21. package/dist/interfaces/option-instrument.interface.d.ts +6 -0
  22. package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
  23. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +57 -10
  24. package/dist/kscript-data/controls/live-trades-merge.util.js +85 -16
  25. package/dist/market-data/billing.interface.d.ts +138 -17
  26. package/dist/market-data/billing.interface.js +25 -8
  27. package/dist/market-data/venues/index.d.ts +3 -3
  28. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  29. package/dist/market-data/venues/opra.d.ts +3 -3
  30. package/dist/market-data/venues/opra.js +5 -4
  31. package/dist/replay/replayLadder.js +3 -1
  32. package/dist/settings-templates/footprint-rows.d.ts +25 -0
  33. package/dist/settings-templates/footprint-rows.js +127 -0
  34. package/dist/settings-templates/form-rows.d.ts +56 -0
  35. package/dist/settings-templates/form-rows.js +19 -0
  36. package/dist/settings-templates/frvp-fields.js +14 -0
  37. package/dist/settings-templates/index.d.ts +10 -1
  38. package/dist/settings-templates/index.js +11 -2
  39. package/dist/settings-templates/indicator-fields.js +78 -0
  40. package/dist/settings-templates/tool-rules.d.ts +35 -9
  41. package/dist/settings-templates/tool-rules.js +42 -8
  42. package/dist/settings-templates/tool-tables.generated.js +13 -2
  43. package/dist/utility/chart/candle-volume-unit.leaf.d.ts +16 -0
  44. package/dist/utility/chart/candle-volume-unit.leaf.js +61 -0
  45. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  46. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  47. package/dist/utility/chart/footprint-columns.util.d.ts +74 -0
  48. package/dist/utility/chart/footprint-columns.util.js +106 -0
  49. package/dist/utility/chart/footprint-display-mode.util.d.ts +40 -0
  50. package/dist/utility/chart/footprint-display-mode.util.js +62 -0
  51. package/dist/utility/chart/footprint-sierra-look.util.d.ts +2 -0
  52. package/dist/utility/chart/footprint-sierra-look.util.js +37 -0
  53. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  54. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  55. package/dist/utility/chart/index-mode.util.js +23 -13
  56. package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
  57. package/dist/utility/chart/kscript-venue-policy.util.js +34 -26
  58. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  59. package/dist/utility/chart/marketKind.util.js +17 -7
  60. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  61. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  62. package/dist/utility/chart/om-panel.util.d.ts +11 -0
  63. package/dist/utility/chart/om-panel.util.js +65 -6
  64. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  65. package/dist/utility/chart/profile-block-size.util.js +7 -0
  66. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  67. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  68. package/dist/utility/chart/window-geometry.leaf.d.ts +23 -1
  69. package/dist/utility/chart/window-geometry.leaf.js +78 -6
  70. package/dist/utility/chart/window-owner.leaf.d.ts +13 -0
  71. package/dist/utility/chart/window-owner.leaf.js +5 -0
  72. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
  73. package/dist/utility/chart/wrun-run-result.util.js +4 -1
  74. package/dist/utility/common/transformations.util.d.ts +7 -0
  75. package/dist/utility/common/transformations.util.js +11 -0
  76. package/dist/utility/options/cme-options-root.util.d.ts +25 -0
  77. package/dist/utility/options/cme-options-root.util.js +40 -0
  78. package/dist/utility/options/option-book.util.d.ts +27 -0
  79. package/dist/utility/options/option-book.util.js +76 -0
  80. package/dist/utility/options/option-trade-date.util.d.ts +50 -0
  81. package/dist/utility/options/option-trade-date.util.js +120 -0
  82. package/dist/utility/options/option-venue.util.d.ts +3 -3
  83. package/dist/utility/options/option-venue.util.js +3 -3
  84. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
  85. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
  86. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  87. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  88. package/dist/utility/wrun/sources/host-grid-landing.d.ts +4 -2
  89. package/dist/utility/wrun/sources/host-grid-landing.js +8 -0
  90. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +40 -4
  91. package/dist/utility/wrun/sources/lanes/options_flow.js +115 -18
  92. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +12 -9
  93. package/dist/utility/wrun/sources/opra-option-lanes.util.js +10 -7
  94. package/dist/utility/wrun/sources/row-lane-registry.js +10 -5
  95. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  96. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +3 -2
  97. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +30 -5
  98. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  99. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
  100. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +25 -1
  101. package/dist/utility/wrun/sources/row-lanes/option_prints.js +161 -30
  102. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.d.ts +4 -0
  103. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +65 -0
  104. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -1
  105. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +83 -2
  106. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +17 -1
  107. package/dist/utility/wrun/sources/row-lanes/option_surface.js +33 -2
  108. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +7 -1
  109. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +51 -5
  110. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +136 -3
  111. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +42 -0
  112. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +146 -0
  113. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
  114. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +111 -20
  115. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +291 -48
  116. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  117. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  118. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  119. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  120. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  121. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  122. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  123. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
  124. package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
  125. package/dist/utility/wrun/wrun-cloud-record.leaf.d.ts +27 -0
  126. package/dist/utility/wrun/wrun-cloud-record.leaf.js +71 -0
  127. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +4 -21
  128. package/dist/utility/wrun/wrun-cloud-record.util.js +5 -65
  129. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  130. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  131. package/dist/utility/wrun/wrun-color-settings.util.d.ts +22 -9
  132. package/dist/utility/wrun/wrun-color-settings.util.js +57 -23
  133. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  134. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  135. package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
  136. package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
  137. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +10 -3
  138. package/dist/utility/wrun/wrun-draft-overlay.util.js +63 -6
  139. package/dist/utility/wrun/wrun-frames.js +5 -5
  140. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  141. package/dist/utility/wrun/wrun-hosted-wire-caps.js +11 -0
  142. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
  143. package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
  144. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +29 -3
  145. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +33 -3
  146. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  147. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  148. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  149. package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
  150. package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
  151. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -1
  152. package/dist/utility/wrun/wrun-live-tick.util.js +130 -44
  153. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  154. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  155. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +224 -0
  156. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +342 -0
  157. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +88 -0
  158. package/dist/utility/wrun/wrun-market-size-defaults.util.js +471 -0
  159. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +43 -8
  160. package/dist/utility/wrun/wrun-opra-flow.leaf.js +37 -6
  161. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +51 -10
  162. package/dist/utility/wrun/wrun-option-contract-flow.util.js +85 -33
  163. package/dist/utility/wrun/wrun-option-prints.util.d.ts +172 -3
  164. package/dist/utility/wrun/wrun-option-prints.util.js +394 -17
  165. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +99 -0
  166. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +218 -0
  167. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +365 -0
  168. package/dist/utility/wrun/wrun-option-strike-flow.util.js +797 -0
  169. package/dist/utility/wrun/wrun-option-views.util.d.ts +231 -7
  170. package/dist/utility/wrun/wrun-option-views.util.js +643 -23
  171. package/dist/utility/wrun/wrun-options-chain.util.d.ts +6 -4
  172. package/dist/utility/wrun/wrun-options-chain.util.js +8 -5
  173. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  174. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  175. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  176. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  177. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  178. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -1
  179. package/dist/utility/wrun/wrun-overlay-recovery.util.js +32 -3
  180. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  181. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  182. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
  183. package/dist/utility/wrun/wrun-overlay-run.util.js +527 -180
  184. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +15 -0
  185. package/dist/utility/wrun/wrun-pack-widths.leaf.js +22 -0
  186. package/dist/utility/wrun/wrun-pack.util.d.ts +13 -8
  187. package/dist/utility/wrun/wrun-pack.util.js +38 -21
  188. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +4 -0
  189. package/dist/utility/wrun/wrun-panel-mount.util.js +62 -22
  190. package/dist/utility/wrun/wrun-panel-style.util.d.ts +41 -14
  191. package/dist/utility/wrun/wrun-panel-style.util.js +86 -26
  192. package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
  193. package/dist/utility/wrun/wrun-param-map.util.js +8 -5
  194. package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
  195. package/dist/utility/wrun/wrun-param-values.util.js +2 -0
  196. package/dist/utility/wrun/wrun-pin-spelling.util.js +19 -10
  197. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  198. package/dist/utility/wrun/wrun-refusal.util.js +17 -2
  199. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +20 -0
  200. package/dist/utility/wrun/wrun-script-inputs.util.js +43 -0
  201. package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
  202. package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
  203. package/dist/utility/wrun/wrun-tape-source.util.d.ts +133 -48
  204. package/dist/utility/wrun/wrun-tape-source.util.js +205 -62
  205. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  206. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  207. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  208. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  209. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  210. package/package.json +11 -11
@@ -39,13 +39,29 @@
39
39
  * read at the input's floor from whichever table the reader picks for it; "3d" every print of the last three days;
40
40
  * "90d" up to 90 days of the large prints (premium 25,000, or size 150 on OPRA and CME, and up): below the large floor
41
41
  * an older bar holds only those and is partial.
42
+ *
43
+ * OPTLOAD G4 (OPTLOAD-READ-CONTRACT sections 7.2 and 7.5, om kit 0.89.0): the cuts and filters a package declares
44
+ * ride the acquisition (`WRUN_OPTION_PRINTS_CUT_FIELDS`), so the gateway sends the prints the package draws, never
45
+ * every print of the window:
46
+ * - cuts: `newest` (the window's N newest prints) with `newestTailMs` (every print up to that many ms before the
47
+ * oldest of them), and `largestPerBar` (K = the inputs' `max_cells` + 1 largest premiums of each chart bar, which
48
+ * the per-input projection cuts to `max_cells` as before, bit 14 on a bar that answered more); both asked, the
49
+ * gateway answers their union, and the projection keeps each bar's `max_cells` largest unioned with its prints
50
+ * inside the window's newest N (`wrunLargestOrNewestOptionPrints`, a block of at most `max_cells` + N);
51
+ * - filters, per print (`wrunOptionPrintKept`, the one rule history and live read): `types`, `sides`, `maxDte` and
52
+ * `moneyness` (the producer's rule, `wrunOptionPrintMoneyness`).
53
+ * The worker twin asks the gateway for each of them where its answer is exactly the lane's own cut (`types` as the
54
+ * request's own `optionType`, the rest in `optionRead`), and makes the rest itself over the prints it read
55
+ * (`wrunNewestOptionPrints`, the filters), so every answer is the same picture.
56
+ * Its rows cross to the page packed (`packWrunOptionPrintRows`: one buffer, a block of tuples per second, moved by
57
+ * transfer) and the lane reads the blocks in place (`forEachWrunOptionPrintTuple`).
42
58
  */
43
59
  import { Exchange } from '@orangecharts/orange-v2-pb-common';
44
60
  import { parseOptionSymbol } from '../options/option-symbol.util.js';
45
61
  import { optionVenueForExchange } from '../options/option-venue.util.js';
46
62
  import { WRUN_PLANE_PAYLOAD_KEY } from '../chart/opra-read-access.leaf.js';
47
63
  import { exchangeCodeOf } from '../v2/gate-plane.util.js';
48
- import { wrunPresentMaskOf, wrunPresentWithPartial } from './wrun-present-bits.util.js';
64
+ import { wrunPartialMarkerTuple, wrunPresentHasBit, wrunPresentIsPartial, wrunPresentMaskOf, wrunPresentWithPartial, } from './wrun-present-bits.util.js';
49
65
  import { encodeSymbol } from './wrun-symbol-code.util.js';
50
66
  import { wrunOptionSeriesOf } from './sources/opra-option-lanes.util.js';
51
67
  import { wrunLaneChainPlaneOf } from './sources/wrun-row-lane.types.js';
@@ -104,11 +120,118 @@ export const WRUN_OPTION_PRINT_BAR_LIMIT_MS = 15_000 * 60_000;
104
120
  export const WRUN_OPTION_PRINT_CLOCK_MARGIN_MS = 10 * 60_000;
105
121
  export const WRUN_OPTION_PRINTS_HISTORY = Object.freeze(['live', '3d', '90d']);
106
122
  export const WRUN_OPTION_PRINTS_OVERFLOW = Object.freeze(['refuse', 'largest']);
123
+ /** `newest` (om `WRUN_OPTION_PRINTS_NEWEST_MAX`): also keep the window's N newest prints, 0 to 20,000 (0 or absent: no
124
+ * newest cut). */
125
+ export const WRUN_OPTION_PRINTS_NEWEST_MAX = 20_000;
126
+ /** `newest_tail_ms` (om `WRUN_OPTION_PRINTS_NEWEST_TAIL_MAX_MS`, with `newest` only): also every print up to this many
127
+ * ms before the oldest newest print, 0 to 60,000 (the legs of an order the cut would split). */
128
+ export const WRUN_OPTION_PRINTS_NEWEST_TAIL_MAX_MS = 60_000;
129
+ /** `types` (om `WRUN_OPTION_PRINTS_TYPES`): "both" (absent too), "calls" or "puts". */
130
+ export const WRUN_OPTION_PRINTS_TYPES = Object.freeze(['both', 'calls', 'puts']);
131
+ /** `sides` (om `WRUN_OPTION_PRINT_SIDES`), in om's order: the side of the quote a print is kept on (the aggressor
132
+ * against the NBBO on OPRA, "none" a print with no quote to side it; off OPRA the taker's side, "ask" or "bid"). */
133
+ export const WRUN_OPTION_PRINT_SIDES = Object.freeze(['ask', 'bid', 'mid', 'none']);
134
+ /** `moneyness` (om `WRUN_OPTIONS_FLOW_MONEYNESS`): "all" (absent too), "otm" or "itm". */
135
+ export const WRUN_OPTION_PRINTS_MONEYNESS = Object.freeze(['all', 'otm', 'itm']);
136
+ /** `max_dte` (om `WRUN_OPTION_MAX_DTE_DAYS`): keep the prints at most this many days to expiry, 0 to 3,650 (0 or
137
+ * absent: every expiry). */
138
+ export const WRUN_OPTION_MAX_DTE_DAYS = 3_650;
139
+ /** The words a word or list knob of the print classes takes (om `wrunOptionKnobWords`); none for any other knob. The
140
+ * planners read a knob naming a setting by them (wrun-poll-lanes.util `resolveWrunOptionSettingKnobs`, whose one table
141
+ * `WRUN_OPTION_SETTING_KNOBS` holds the print class's row of om's `WRUN_OPTION_PARAM_KNOBS`). */
142
+ export function wrunOptionPrintKnobWords(knob) {
143
+ if (knob === 'types')
144
+ return WRUN_OPTION_PRINTS_TYPES;
145
+ if (knob === 'moneyness')
146
+ return WRUN_OPTION_PRINTS_MONEYNESS;
147
+ if (knob === 'sides')
148
+ return WRUN_OPTION_PRINT_SIDES;
149
+ return [];
150
+ }
151
+ /**
152
+ * The payload fields an acquisition carries its cuts and filters in (OPTLOAD G4), each absent at its default, so a
153
+ * sheet declaring none asks exactly as before. Where the gateway applies each:
154
+ * - `wire`: the cut ask's `optionRead` field (the worker twin's `optionPrintReadShape`), wherever the gateway's answer is
155
+ * the lane's own cut;
156
+ * - `request`: the request's own DataRequest field (`types` as `optionType`, the reader's type filter), on every read,
157
+ * so the gateway's cut is the lane's own when one type is asked (it filters before it cuts).
158
+ * The worker twin keeps every filter over the prints it read too (`wrunOptionPrintKept`), so today's ask paints alike.
159
+ * ONE table: the acquisition reads exactly these fields, and the class spec
160
+ * (tests/workers/indicators/controls/k-option-print.worker.class.spec.ts) fails on a field the asks leave out.
161
+ */
162
+ export const WRUN_OPTION_PRINTS_CUT_FIELDS = Object.freeze({
163
+ newest: { wire: 'newest' },
164
+ newestTailMs: { wire: 'newestTailMs' },
165
+ largestPerBar: { wire: 'largestPerBar' },
166
+ sides: { wire: 'sides' },
167
+ maxDte: { wire: 'maxDteDays' },
168
+ moneyness: { wire: 'moneyness' },
169
+ types: { request: 'optionType' },
170
+ });
107
171
  /** A payload field's text, trimmed and upper case ('' for anything else). */
108
172
  function upperTextOf(value) {
109
173
  return typeof value === 'string' ? value.trim().toUpperCase() : '';
110
174
  }
111
- /** An instance's payload as the acquisition it carries, or undefined when it names no valid floor or history. */
175
+ /** A whole number from `min` to `max`. */
176
+ function wholeIn(value, min, max) {
177
+ return typeof value === 'number' && Number.isInteger(value) && value >= min && value <= max;
178
+ }
179
+ /** The sides a payload's `sides` field names ("ask,bid": om's facet spelling, the words in om's order, one to three
180
+ * of them), or undefined for anything else. */
181
+ export function wrunOptionPrintSidesOf(value) {
182
+ if (typeof value !== 'string' || value === '')
183
+ return undefined;
184
+ const words = value.split(',');
185
+ const sides = WRUN_OPTION_PRINT_SIDES.filter((side) => words.includes(side));
186
+ if (sides.length !== words.length || sides.length === WRUN_OPTION_PRINT_SIDES.length)
187
+ return undefined;
188
+ return sides.join(',') === value ? sides : undefined;
189
+ }
190
+ /** The cut and filter fields of a payload (`WRUN_OPTION_PRINTS_CUT_FIELDS`), or null when one is outside its words
191
+ * (a payload the lane never builds: fail closed). */
192
+ function cutFieldsOf(extras) {
193
+ const fields = {};
194
+ const { newest, newestTailMs, largestPerBar, types, sides, maxDte, moneyness } = extras;
195
+ if (newest !== undefined) {
196
+ if (!wholeIn(newest, 1, WRUN_OPTION_PRINTS_NEWEST_MAX))
197
+ return null;
198
+ fields.newest = newest;
199
+ }
200
+ if (newestTailMs !== undefined) {
201
+ if (fields.newest === undefined || !wholeIn(newestTailMs, 1, WRUN_OPTION_PRINTS_NEWEST_TAIL_MAX_MS))
202
+ return null;
203
+ fields.newestTailMs = newestTailMs;
204
+ }
205
+ if (largestPerBar !== undefined) {
206
+ if (!wholeIn(largestPerBar, 2, Number.MAX_SAFE_INTEGER))
207
+ return null;
208
+ fields.largestPerBar = largestPerBar;
209
+ }
210
+ if (types !== undefined) {
211
+ if (types !== 'calls' && types !== 'puts')
212
+ return null;
213
+ fields.types = types;
214
+ }
215
+ if (sides !== undefined) {
216
+ const read = wrunOptionPrintSidesOf(sides);
217
+ if (read === undefined)
218
+ return null;
219
+ fields.sides = read;
220
+ }
221
+ if (maxDte !== undefined) {
222
+ if (!wholeIn(maxDte, 1, WRUN_OPTION_MAX_DTE_DAYS))
223
+ return null;
224
+ fields.maxDte = maxDte;
225
+ }
226
+ if (moneyness !== undefined) {
227
+ if (moneyness !== 'otm' && moneyness !== 'itm')
228
+ return null;
229
+ fields.moneyness = moneyness;
230
+ }
231
+ return fields;
232
+ }
233
+ /** An instance's payload as the acquisition it carries, or undefined when it names no valid floor or history, or a
234
+ * cut or filter outside its words. */
112
235
  export function wrunOptionPrintsAcquisitionOf(extras) {
113
236
  if (!extras)
114
237
  return undefined;
@@ -121,6 +244,10 @@ export function wrunOptionPrintsAcquisitionOf(extras) {
121
244
  return undefined;
122
245
  if (!WRUN_OPTION_PRINTS_OVERFLOW.includes(overflow))
123
246
  return undefined;
247
+ const cuts = cutFieldsOf(extras);
248
+ // A per-bar cut exists under "largest" alone (the projection cuts each bar to its largest).
249
+ if (cuts === null || (cuts.largestPerBar !== undefined && overflow !== 'largest'))
250
+ return undefined;
124
251
  const coin = upperTextOf(extras.coin);
125
252
  const book = upperTextOf(extras[WRUN_OPTION_PRINTS_BOOK_FIELD]);
126
253
  return {
@@ -131,8 +258,21 @@ export function wrunOptionPrintsAcquisitionOf(extras) {
131
258
  history: history,
132
259
  overflow: overflow,
133
260
  ...(typeof extras.expiries === 'string' ? { expiries: extras.expiries } : {}),
261
+ ...cuts,
134
262
  };
135
263
  }
264
+ /** An acquisition's cut and filter fields as the payload carries them (`sides` in om's facet spelling), each absent at
265
+ * its default: what the K control forwards to the worker twin. */
266
+ export function wrunOptionPrintsCutPayloadOf(acquisition) {
267
+ const payload = {};
268
+ for (const field of Object.keys(WRUN_OPTION_PRINTS_CUT_FIELDS)) {
269
+ const value = acquisition[field];
270
+ if (value === undefined)
271
+ continue;
272
+ payload[field] = field === 'sides' ? value.join(',') : value;
273
+ }
274
+ return payload;
275
+ }
136
276
  /**
137
277
  * Whether a payload's OPRA stamp agrees with the chain it names, the print classes' one rule for a K control: the
138
278
  * payload names its chain's exchange, and it carries the stamp (`wrunPlane: 'opra'`, which Door C judged) exactly when
@@ -407,10 +547,42 @@ export function wrunOptionPrintOf(print, series) {
407
547
  tuple,
408
548
  };
409
549
  }
550
+ /** The at-the-money band of the print rule (tsdb-gateway `optionPrintAtTheMoneyBand`, OptionPrint.moneyness): a
551
+ * strike within half a percent of the underlying counts as out of the money. */
552
+ export const WRUN_OPTION_PRINT_AT_THE_MONEY_BAND = 0.005;
553
+ /**
554
+ * A print's moneyness by the producer's rule (OptionPrint.moneyness, the gateway's option print job): -1 in the money
555
+ * (a call struck below the underlying less the band, a put struck above it plus the band), +1 otherwise, undefined
556
+ * without an underlying price (the tuple's bit 2 clear). Read off the tuple, so history (whose columns carry no
557
+ * moneyness) and live judge one print alike.
558
+ */
559
+ export function wrunOptionPrintMoneyness(tuple, at = 0) {
560
+ const C = WRUN_OPTION_PRINT_COLUMN;
561
+ const underlying = tuple[at + C.underlying];
562
+ if (!wrunPresentHasBit(tuple[at + C.present], WRUN_OPTION_PRINT_BIT.underlying) || !(underlying > 0)) {
563
+ return undefined;
564
+ }
565
+ const strike = tuple[at + C.strike];
566
+ const side = tuple[at + C.side];
567
+ const band = underlying * WRUN_OPTION_PRINT_AT_THE_MONEY_BAND;
568
+ if ((side === 1 && strike < underlying - band) || (side === -1 && strike > underlying + band))
569
+ return -1;
570
+ return 1;
571
+ }
572
+ /** The side word of a tuple's aggressor (+1 ask, -1 bid, 0 mid, 2 none). */
573
+ export function wrunOptionPrintSideWord(aggressor) {
574
+ if (aggressor === 1)
575
+ return 'ask';
576
+ if (aggressor === -1)
577
+ return 'bid';
578
+ return aggressor === 0 ? 'mid' : 'none';
579
+ }
410
580
  /**
411
581
  * Whether a print passes an acquisition's own filters, on history and live alike: its chain (the print's exchange is
412
582
  * the chain's, and its book, the series its raw symbol spells, is the ONE book the acquisition reads: two books of one
413
- * coin never merge), its floor, and "0dte" (expiring on the print's trade date, the producer's `dte_days`).
583
+ * coin never merge), its floor, "0dte" (expiring on the print's trade date, the producer's `dte_days`), and the OPTLOAD
584
+ * filters: `types` (the tuple's call or put), `sides` (its aggressor's side word), `maxDte` (the producer's
585
+ * `dte_days`, at most) and `moneyness` (`wrunOptionPrintMoneyness`; a print without an underlying price has none).
414
586
  */
415
587
  export function wrunOptionPrintKept(print, acquisition) {
416
588
  if (print.exchange !== acquisition.exchange)
@@ -419,7 +591,17 @@ export function wrunOptionPrintKept(print, acquisition) {
419
591
  return false;
420
592
  if (!(print.premium >= acquisition.minPremium))
421
593
  return false;
422
- return acquisition.expiries !== '0dte' || print.dteDays === 0;
594
+ if (acquisition.expiries === '0dte' && print.dteDays !== 0)
595
+ return false;
596
+ const C = WRUN_OPTION_PRINT_COLUMN;
597
+ const { types, sides, maxDte, moneyness } = acquisition;
598
+ if (types !== undefined && print.tuple[C.side] !== (types === 'calls' ? 1 : -1))
599
+ return false;
600
+ if (sides !== undefined && !sides.includes(wrunOptionPrintSideWord(print.tuple[C.aggressor])))
601
+ return false;
602
+ if (maxDte !== undefined && !(print.dteDays !== undefined && print.dteDays <= maxDte))
603
+ return false;
604
+ return moneyness === undefined || wrunOptionPrintMoneyness(print.tuple) === (moneyness === 'otm' ? 1 : -1);
423
605
  }
424
606
  /** Whether a cell is a print tuple of the class: exactly 16 finite numbers. */
425
607
  export function isWrunOptionPrintTuple(cell) {
@@ -427,32 +609,227 @@ export function isWrunOptionPrintTuple(cell) {
427
609
  cell.length === WRUN_OPTION_PRINTS_WIDTH &&
428
610
  cell.every((value) => typeof value === 'number' && Number.isFinite(value)));
429
611
  }
612
+ /** The order prints happened in: by offset, then by key (two prints in one millisecond). */
613
+ export function compareWrunOptionPrintsInTimeOrder(a, b) {
614
+ return (a[WRUN_OPTION_PRINT_COLUMN.offset] - b[WRUN_OPTION_PRINT_COLUMN.offset] ||
615
+ a[WRUN_OPTION_PRINT_COLUMN.key] - b[WRUN_OPTION_PRINT_COLUMN.key]);
616
+ }
430
617
  /** A bar's print tuples in the order they printed: by offset, then by key (two prints in one millisecond). */
431
618
  export function wrunOptionPrintsInTimeOrder(tuples) {
432
- return tuples
433
- .map((tuple) => [...tuple])
434
- .sort((a, b) => a[WRUN_OPTION_PRINT_COLUMN.offset] - b[WRUN_OPTION_PRINT_COLUMN.offset] ||
435
- a[WRUN_OPTION_PRINT_COLUMN.key] - b[WRUN_OPTION_PRINT_COLUMN.key]);
619
+ return tuples.map((tuple) => [...tuple]).sort(compareWrunOptionPrintsInTimeOrder);
436
620
  }
621
+ // ---------------------------------------------------------------------------
622
+ // The newest cut, and the rows as they cross to the page.
623
+ // ---------------------------------------------------------------------------
437
624
  /**
438
- * `overflow: "largest"` over a bar over its bound (om's packer rule, wrun-host/pack.ts `wrunLargestPremiumBlock`):
439
- * the `maxCells` prints with the largest premium (an equal premium keeps the earlier print; a non-finite premium
440
- * ranks last), laid out in the order they printed, bit 14 set on the FIRST kept print's `present` so the module reads
441
- * the bar as partial. A bar within its bound is returned as it is.
625
+ * The newest cut over a window's prints, the gateway's rule (OPTLOAD-READ-CONTRACT 7.2: `ORDER BY "timestamp" DESC,
626
+ * original_id DESC LIMIT newest`, then every print up to `tailMs` before the oldest kept one): every print stamped at
627
+ * or after the `newest`-th newest print's millisecond less the tail, in the order given. Inclusive at that millisecond:
628
+ * the stamps here are whole ms, so prints the gateway told apart below the ms (or by their id) stay together, and
629
+ * cutting a cut answer again keeps it whole (the worker cuts the union of several reads, each cut on the gateway, to
630
+ * the window's one cut). Fewer prints than `newest`: every print.
442
631
  */
443
- export function wrunLargestPremiumPrints(tuples, maxCells) {
444
- const bound = Math.max(0, Math.floor(maxCells));
445
- if (tuples.length <= bound)
446
- return tuples;
632
+ export function wrunNewestOptionPrints(prints, newest, tailMs = 0) {
633
+ if (!(newest >= 1) || prints.length <= newest)
634
+ return [...prints];
635
+ const stamps = prints.map((print) => print.tsMs).sort((a, b) => b - a);
636
+ const fromMs = stamps[newest - 1] - Math.max(0, tailMs);
637
+ return prints.filter((print) => print.tsMs >= fromMs);
638
+ }
639
+ /** Whether a tuple is a partial bar's marker (every value 0 but `present`, bit 14 alone set), never a print. */
640
+ export function isWrunOptionPrintMarker(tuple) {
641
+ const present = tuple[WRUN_OPTION_PRINT_COLUMN.present];
642
+ if (!wrunPresentIsPartial(present))
643
+ return false;
644
+ for (let at = 0; at < WRUN_OPTION_PRINTS_WIDTH; at += 1) {
645
+ if (at !== WRUN_OPTION_PRINT_COLUMN.present && tuple[at] !== 0)
646
+ return false;
647
+ }
648
+ return true;
649
+ }
650
+ /**
651
+ * An instance's host-bar rows `[barOpen, ...tuples]` cut to its acquisition's newest cut over the whole window they
652
+ * hold, the gateway's rule (`wrunNewestOptionPrints`: every print stamped at or after the `newest`-th newest print's
653
+ * millisecond less `newestTailMs`, a print's time its bar's open plus its offset): what a history read of the window
654
+ * answers. The live fold applies it after every drain, so a live bar never outgrows the cut its history was read under
655
+ * (Flow Tape's day bar held the newest 3,000 prints from history, then every live print of the day on top, past its
656
+ * `max_cells`). A bar the cut empties keeps its row, empty or, when it was partial, the marker; a marker is no print.
657
+ * No newest cut, or `overflow: "largest"` (the projection makes the cut there, each bar's largest unioned with the
658
+ * window's newest over every print the rows hold, `wrunLargestOrNewestOptionPrints`, again on every run): the rows as
659
+ * they are (copied).
660
+ */
661
+ export function wrunNewestOptionPrintRows(rows, acquisition) {
662
+ const newest = acquisition.newest;
663
+ const copy = () => rows.map((row) => [...row]);
664
+ if (newest === undefined || !(newest >= 1) || acquisition.overflow === 'largest')
665
+ return copy();
666
+ const C = WRUN_OPTION_PRINT_COLUMN;
667
+ const isPrint = (cell) => isWrunOptionPrintTuple(cell) && !isWrunOptionPrintMarker(cell);
668
+ const stamps = [];
669
+ for (const row of rows) {
670
+ const open = Number(row[0]);
671
+ for (let at = 1; at < row.length; at += 1) {
672
+ const cell = row[at];
673
+ if (isPrint(cell))
674
+ stamps.push(open + cell[C.offset]);
675
+ }
676
+ }
677
+ if (stamps.length <= newest)
678
+ return copy();
679
+ stamps.sort((a, b) => b - a);
680
+ const fromMs = stamps[newest - 1] - Math.max(0, acquisition.newestTailMs ?? 0);
681
+ return rows.map((row) => {
682
+ const open = Number(row[0]);
683
+ const cells = row.slice(1);
684
+ const prints = cells.filter(isPrint);
685
+ const kept = prints.filter((tuple) => open + tuple[C.offset] >= fromMs);
686
+ if (kept.length === prints.length)
687
+ return [...row];
688
+ const partial = cells.some((cell) => isWrunOptionPrintTuple(cell) && wrunPresentIsPartial(cell[C.present]));
689
+ if (kept.length > 0)
690
+ return [row[0], ...kept];
691
+ return partial ? [row[0], wrunPartialMarkerTuple(WRUN_OPTION_PRINTS_WIDTH)] : [row[0]];
692
+ });
693
+ }
694
+ /**
695
+ * A window's rows `[secondMs, tuples]` as they cross to the page: every tuple packed back to back in ONE Float64Array
696
+ * (16 values each), each row `[secondMs, block]` with the block a view of its second's tuples. The worker posts them
697
+ * BY TRANSFER (comm.worker.util `sendV2RowsTransferringCellsToMainThread`: the one buffer moves, no structured clone
698
+ * walks it) and the lane reads the blocks in place (`forEachWrunOptionPrintTuple`).
699
+ */
700
+ export function packWrunOptionPrintRows(rows) {
701
+ const width = WRUN_OPTION_PRINTS_WIDTH;
702
+ let count = 0;
703
+ for (const [, tuples] of rows)
704
+ count += tuples.length;
705
+ const packed = new Float64Array(count * width);
706
+ const out = [];
707
+ let at = 0;
708
+ for (const [secondMs, tuples] of rows) {
709
+ const start = at;
710
+ for (const tuple of tuples) {
711
+ for (let column = 0; column < width; column += 1)
712
+ packed[at + column] = tuple[column];
713
+ at += width;
714
+ }
715
+ out.push([secondMs, packed.subarray(start, at)]);
716
+ }
717
+ return out;
718
+ }
719
+ /** Whether the tuple at `offset` of a block holds finite numbers only (a plain tuple's rule, read in place). */
720
+ function printTupleFiniteAt(block, offset) {
721
+ for (let column = 0; column < WRUN_OPTION_PRINTS_WIDTH; column += 1) {
722
+ if (!Number.isFinite(block[offset + column]))
723
+ return false;
724
+ }
725
+ return true;
726
+ }
727
+ /**
728
+ * Every print tuple a row's cells hold (from cell 1: cell 0 is the row's stamp), in order, read in place as
729
+ * (source, offset): a packed block's tuples back to back (a Float64Array holding a whole number of them, the worker's
730
+ * answer), a plain tuple (the live fold's, a spec's) at offset 0. A cell of any other shape, and a tuple holding a value
731
+ * that is not finite, is skipped.
732
+ */
733
+ export function forEachWrunOptionPrintTuple(row, visit) {
734
+ const width = WRUN_OPTION_PRINTS_WIDTH;
735
+ for (let index = 1; index < row.length; index += 1) {
736
+ const cell = row[index];
737
+ if (cell instanceof Float64Array) {
738
+ if (cell.length % width !== 0)
739
+ continue;
740
+ for (let offset = 0; offset < cell.length; offset += width) {
741
+ if (printTupleFiniteAt(cell, offset))
742
+ visit(cell, offset);
743
+ }
744
+ }
745
+ else if (isWrunOptionPrintTuple(cell)) {
746
+ visit(cell, 0);
747
+ }
748
+ }
749
+ }
750
+ /** The indexes of the `count` prints with the largest premium (an equal premium keeps the earlier print; a non-finite
751
+ * premium ranks last), ascending. */
752
+ function largestPremiumIndexes(tuples, count) {
447
753
  const premium = (at) => {
448
754
  const value = tuples[at][WRUN_OPTION_PRINT_COLUMN.premium];
449
755
  return Number.isFinite(value) ? value : Number.NEGATIVE_INFINITY;
450
756
  };
451
757
  const ranked = tuples.map((_, at) => at).sort((a, b) => premium(b) - premium(a) || a - b);
452
- const kept = ranked.slice(0, bound).sort((a, b) => a - b);
758
+ return ranked.slice(0, count).sort((a, b) => a - b);
759
+ }
760
+ /** The kept prints of a bar, copied in the order given, bit 14 set on the FIRST one's `present` so the module reads
761
+ * the bar as partial. */
762
+ function partialPrintsAt(tuples, kept) {
453
763
  const out = kept.map((at) => [...tuples[at]]);
454
764
  if (out.length > 0) {
455
765
  out[0][WRUN_OPTION_PRINT_COLUMN.present] = wrunPresentWithPartial(out[0][WRUN_OPTION_PRINT_COLUMN.present]);
456
766
  }
457
767
  return out;
458
768
  }
769
+ /**
770
+ * `overflow: "largest"` over a bar over its bound (om's packer rule, wrun-host/pack.ts `wrunLargestPremiumBlock`):
771
+ * the `maxCells` prints with the largest premium (an equal premium keeps the earlier print; a non-finite premium
772
+ * ranks last), laid out in the order they printed, bit 14 set on the FIRST kept print's `present` so the module reads
773
+ * the bar as partial. A bar within its bound is returned as it is.
774
+ */
775
+ export function wrunLargestPremiumPrints(tuples, maxCells) {
776
+ const bound = Math.max(0, Math.floor(maxCells));
777
+ if (tuples.length <= bound)
778
+ return tuples;
779
+ return partialPrintsAt(tuples, largestPremiumIndexes(tuples, bound));
780
+ }
781
+ /**
782
+ * The bound of the window's newest cut over every bar an instance holds (`WrunNewestOptionPrintBound`), or undefined
783
+ * when they hold fewer than `newest` prints (every print is inside the cut). A partial bar's marker is no print. The
784
+ * bound is the same over the gateway's union answer, today's whole download and either one merged with live prints: each
785
+ * holds the window's `newest` newest prints whole.
786
+ */
787
+ export function wrunNewestOptionPrintBound(bars, newest) {
788
+ if (!(newest >= 1))
789
+ return undefined;
790
+ const C = WRUN_OPTION_PRINT_COLUMN;
791
+ const prints = [];
792
+ for (const { openMs, tuples } of bars) {
793
+ for (const tuple of tuples) {
794
+ if (!isWrunOptionPrintMarker(tuple)) {
795
+ prints.push({ atMs: openMs + tuple[C.offset], key: tuple[C.key], barOpenMs: openMs });
796
+ }
797
+ }
798
+ }
799
+ if (prints.length < newest)
800
+ return undefined;
801
+ prints.sort((a, b) => b.atMs - a.atMs || b.key - a.key);
802
+ return prints[Math.floor(newest) - 1];
803
+ }
804
+ /**
805
+ * One bar's prints under `overflow: "largest"` beside the window's newest cut (the union, the SDK's frozen contract):
806
+ * its `maxCells` largest (`wrunLargestPremiumPrints`' order) and every print inside the cut (`bound`, from
807
+ * `wrunNewestOptionPrintBound`), each once, in the order given. So a block holds at most `maxCells` plus the cut's
808
+ * count, the read's capacity for the input (wrun-cell-capacity.leaf `wrunCellReadCapacity`), which a module holds whole
809
+ * only when its sheet's `capacity` does (`wrunCellBlockTuples`).
810
+ *
811
+ * Bit 14 on the first kept print, by a rule every answer reads alike (the gateway's union answer, today's whole
812
+ * download, either one merged with live prints), so the cells never depend on the path: a bar older than the bar
813
+ * holding the bound, past `maxCells` prints (none of its prints is newest: its largest alone, as without the cut); and
814
+ * the bar holding the bound, past `maxCells` prints, even when nothing it holds is left out (the gateway answers its
815
+ * largest and its prints inside the cut, so whether an older and smaller print was left out cannot be told there). A bar
816
+ * newer than that one holds only prints inside the cut, and with no bound (fewer than `newest` prints in the window)
817
+ * every bar holds every print, unmarked.
818
+ */
819
+ export function wrunLargestOrNewestOptionPrints(tuples, barOpenMs, maxCells, bound) {
820
+ if (bound === undefined || barOpenMs > bound.barOpenMs)
821
+ return tuples;
822
+ if (barOpenMs < bound.barOpenMs)
823
+ return wrunLargestPremiumPrints(tuples, maxCells);
824
+ const largest = Math.max(0, Math.floor(maxCells));
825
+ if (tuples.length <= largest)
826
+ return tuples;
827
+ const C = WRUN_OPTION_PRINT_COLUMN;
828
+ const kept = new Set(largestPremiumIndexes(tuples, largest));
829
+ tuples.forEach((tuple, at) => {
830
+ const atMs = barOpenMs + tuple[C.offset];
831
+ if (atMs > bound.atMs || (atMs === bound.atMs && tuple[C.key] >= bound.key))
832
+ kept.add(at);
833
+ });
834
+ return partialPrintsAt(tuples, [...kept].sort((a, b) => a - b));
835
+ }
@@ -0,0 +1,99 @@
1
+ import type { WrunBackendTier } from './wrun-tier-grid.util.js';
2
+ /** The class, its lane key and its K type word (om `WRUN_OPTION_FETCH_TYPES.option_strike_flow`). */
3
+ export declare const WRUN_OPTION_STRIKE_FLOW_CLASS = "option_strike_flow";
4
+ /** f64s per tuple, the `present` mask included (om `WRUN_OPTION_TUPLE_WIDTHS.option_strike_flow`). */
5
+ export declare const WRUN_OPTION_STRIKE_FLOW_WIDTH = 15;
6
+ /** The tuple's columns (om `WRUN_OPTION_CELL_COLUMNS.option_strike_flow`). */
7
+ export declare const WRUN_OPTION_STRIKE_FLOW_COLUMN: Readonly<{
8
+ readonly expiry: 0;
9
+ readonly strike: 1;
10
+ readonly side: 2;
11
+ readonly dteClass: 3;
12
+ readonly volAsk: 4;
13
+ readonly volBid: 5;
14
+ readonly volMid: 6;
15
+ readonly volNone: 7;
16
+ readonly volAboveAsk: 8;
17
+ readonly volBelowBid: 9;
18
+ readonly premAsk: 10;
19
+ readonly premBid: 11;
20
+ readonly premMid: 12;
21
+ readonly premNone: 13;
22
+ readonly present: 14;
23
+ }>;
24
+ /** `group` (om `WRUN_OPTION_STRIKE_FLOW_GROUPS`, required). */
25
+ export declare const WRUN_OPTION_STRIKE_FLOW_GROUPS: readonly ["strike", "expiry", "expiry_strike"];
26
+ export type WrunOptionStrikeFlowGroup = (typeof WRUN_OPTION_STRIKE_FLOW_GROUPS)[number];
27
+ /** `span` and `history` on the grouped flow classes (om `WRUN_OPTION_FLOW_SPANS`, `WRUN_OPTION_FLOW_HISTORY`). */
28
+ export declare const WRUN_OPTION_FLOW_SPANS: readonly ["bar", "session"];
29
+ export declare const WRUN_OPTION_FLOW_HISTORY: readonly ["window", "today"];
30
+ /** The tiers each group is served at (om `WRUN_OPTION_STRIKE_FLOW_TIERS`, contract 6.3): 1m 7 days, 5m 30, 30m kept
31
+ * (30 days on `expiry_strike`, the lane's horizon). Every tier serves the forming bar. */
32
+ export declare const WRUN_OPTION_STRIKE_FLOW_TIERS: Readonly<Record<WrunOptionStrikeFlowGroup, readonly WrunBackendTier[]>>;
33
+ /** `expiries` on this class: the contract classes' words and "after_today" (om `wrunOptionStrikeFlowExpiries`). */
34
+ export type WrunOptionStrikeFlowExpiries = {
35
+ kind: 'all';
36
+ } | {
37
+ kind: '0dte';
38
+ } | {
39
+ kind: 'after_today';
40
+ } | {
41
+ kind: 'nearest';
42
+ count: number;
43
+ };
44
+ /** The `expiries` words a setting picks (om `WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS`, kit 0.96.0: a select whose
45
+ * `style_values` are these words): every word but "nearest:N", whose count no choice carries. */
46
+ export declare const WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS: readonly ["all", "0dte", "after_today"];
47
+ /** An `expiries` word as this class reads it (absent is "all"), or undefined for a word outside them. */
48
+ export declare function wrunOptionStrikeFlowExpiriesOf(value: unknown): WrunOptionStrikeFlowExpiries | undefined;
49
+ /** One input's knobs, canonical: each absent at its default (one acquisition for equal reads). */
50
+ export interface WrunOptionStrikeFlowKnobs {
51
+ group: WrunOptionStrikeFlowGroup;
52
+ /** "0dte", "after_today" or "nearest:N"; absent is "all". */
53
+ expiries?: string;
54
+ strikeWindowPct?: number;
55
+ strikeRows?: number;
56
+ splitDte?: true;
57
+ foldTypes?: true;
58
+ /** "session"; absent is "bar". */
59
+ span?: 'session';
60
+ /** "today"; absent is "window". */
61
+ history?: 'today';
62
+ minVolume?: number;
63
+ }
64
+ /** The knobs an acquisition (an instance's payload) names, a field that is not valid read absent. */
65
+ export declare function wrunOptionStrikeFlowPayloadKnobsOf(payload: Readonly<Record<string, unknown>> | null | undefined): WrunOptionStrikeFlowKnobs;
66
+ /** The span the class is served over for one acquisition: `expiry_strike`'s 30-minute view keeps 30 days; every other
67
+ * group's tiers say it alone. */
68
+ export declare function wrunOptionStrikeFlowHorizon(extras: Readonly<Record<string, unknown>>, nowMs: number): {
69
+ servedFromMs: number;
70
+ completeFromMs: number;
71
+ } | undefined;
72
+ /** The tuples one SPY bar of a group holds (one 30-minute session of 13 bars measured 2026-10-19): STRIKE 357 (471 with
73
+ * the 0DTE split), EXPIRY 75, the per-(expiry, strike) rows 2,326; 33 traded expiries. Any bar width, every chain. */
74
+ export declare const WRUN_OPTION_STRIKE_FLOW_BAR_TUPLES: Readonly<{
75
+ strike: 357;
76
+ strikeSplit: 471;
77
+ expiry: 75;
78
+ expiryStrike: 2326;
79
+ expiries: 33;
80
+ }>;
81
+ /** The tuples a bar of one acquisition is projected to hold, from its knobs over SPY's measured bars. */
82
+ export declare function wrunOptionStrikeFlowTuplesPerBar(acquisition: Readonly<Record<string, unknown>>): number;
83
+ /** The rows one host bar is projected to read (the lane's row budget): its projected tuples, none for a bar before
84
+ * today's first instant as the acquisition names it under `history` "today" (it reads nothing;
85
+ * wrun-option-contract-flow.util `wrunOptionFlowBarBeforeToday`, never dated off `nowMs`). */
86
+ export declare function wrunOptionStrikeFlowBarRows(bar: {
87
+ openMs: number;
88
+ endMs: number;
89
+ tier?: WrunBackendTier;
90
+ }, _nowMs: number, acquisition: Readonly<Record<string, unknown>>): number;
91
+ /** Every finite tuple a host bar row's cells hold, in order: a packed block's tuples back to back, a plain tuple as it
92
+ * is. A cell of another shape, and a tuple holding a value that is not finite, is skipped. */
93
+ export declare function wrunOptionStrikeFlowTuplesOfRow(row: ReadonlyArray<unknown>): number[][];
94
+ /** The canonical order of a bar's tuples: expiry, strike, calls before puts (folded last), then the 0DTE part first. */
95
+ export declare function compareWrunOptionStrikeFlowTuples(a: ArrayLike<number>, b: ArrayLike<number>): number;
96
+ /** One host bar's tuples from its rows (the lane's fold): a grouped bar's tuples as they are, several rows of one bar
97
+ * merged key by key (expiry, strike, side, class: values summed, a partial mark kept), a partial marker kept as the
98
+ * bar's marker. Sorted canonically. */
99
+ export declare function foldWrunOptionStrikeFlowBar(rows: ReadonlyArray<ReadonlyArray<unknown>>): number[][];