@orangecharts/wrun-chart-host 0.8.0 → 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 (145) hide show
  1. package/README.md +2 -1
  2. package/dist/constants/feature-flags.constants.d.ts +4 -0
  3. package/dist/constants/feature-flags.constants.js +27 -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 +11 -6
  9. package/dist/constants/option-venues.constants.js +5 -2
  10. package/dist/host-env.d.ts +10 -4
  11. package/dist/host-ports.types.d.ts +39 -3
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +1 -0
  14. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  15. package/dist/interfaces/opra-realtime.interface.js +10 -10
  16. package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
  17. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +53 -10
  18. package/dist/kscript-data/controls/live-trades-merge.util.js +81 -16
  19. package/dist/market-data/billing.interface.d.ts +138 -17
  20. package/dist/market-data/billing.interface.js +25 -8
  21. package/dist/market-data/venues/index.d.ts +3 -3
  22. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  23. package/dist/market-data/venues/opra.d.ts +3 -3
  24. package/dist/market-data/venues/opra.js +5 -4
  25. package/dist/replay/replayLadder.js +3 -1
  26. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  27. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  28. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  29. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  30. package/dist/utility/chart/index-mode.util.js +23 -13
  31. package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
  32. package/dist/utility/chart/kscript-venue-policy.util.js +30 -24
  33. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  34. package/dist/utility/chart/marketKind.util.js +17 -7
  35. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  36. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  37. package/dist/utility/chart/om-panel.util.js +6 -6
  38. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  39. package/dist/utility/chart/profile-block-size.util.js +7 -0
  40. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  41. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  42. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
  43. package/dist/utility/chart/wrun-run-result.util.js +4 -1
  44. package/dist/utility/common/transformations.util.d.ts +7 -0
  45. package/dist/utility/common/transformations.util.js +11 -0
  46. package/dist/utility/options/option-venue.util.d.ts +3 -3
  47. package/dist/utility/options/option-venue.util.js +3 -3
  48. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
  49. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
  50. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  51. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  52. package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
  53. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  54. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
  55. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +11 -0
  56. package/dist/utility/wrun/sources/row-lanes/option_prints.js +63 -9
  57. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +8 -0
  58. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +12 -0
  59. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
  60. package/dist/utility/wrun/sources/row-lanes/option_surface.js +5 -2
  61. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +11 -5
  62. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +31 -10
  63. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +33 -1
  64. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +95 -6
  65. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
  66. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +55 -18
  67. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +146 -40
  68. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  69. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  70. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  71. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  72. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  73. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  74. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  75. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
  76. package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
  77. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  78. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  79. package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
  80. package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
  81. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  82. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  83. package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
  84. package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
  85. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
  86. package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
  87. package/dist/utility/wrun/wrun-frames.js +5 -5
  88. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  89. package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
  90. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
  91. package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
  92. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  93. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  94. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  95. package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
  96. package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
  97. package/dist/utility/wrun/wrun-live-tick.util.js +91 -38
  98. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  99. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  100. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +166 -48
  101. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +216 -33
  102. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
  103. package/dist/utility/wrun/wrun-market-size-defaults.util.js +314 -56
  104. package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
  105. package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
  106. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +3 -0
  107. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +3 -0
  108. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +23 -0
  109. package/dist/utility/wrun/wrun-option-strike-flow.util.js +55 -0
  110. package/dist/utility/wrun/wrun-option-views.util.d.ts +51 -7
  111. package/dist/utility/wrun/wrun-option-views.util.js +151 -28
  112. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  113. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  114. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  115. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  116. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  117. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
  118. package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
  119. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  120. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  121. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
  122. package/dist/utility/wrun/wrun-overlay-run.util.js +416 -171
  123. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
  124. package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
  125. package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
  126. package/dist/utility/wrun/wrun-pack.util.js +20 -9
  127. package/dist/utility/wrun/wrun-panel-style.util.d.ts +27 -15
  128. package/dist/utility/wrun/wrun-panel-style.util.js +42 -20
  129. package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
  130. package/dist/utility/wrun/wrun-param-map.util.js +8 -5
  131. package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
  132. package/dist/utility/wrun/wrun-param-values.util.js +2 -0
  133. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  134. package/dist/utility/wrun/wrun-refusal.util.js +10 -1
  135. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +7 -0
  136. package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
  137. package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
  138. package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
  139. package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
  140. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  141. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  142. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  143. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  144. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  145. package/package.json +11 -11
@@ -45,7 +45,9 @@
45
45
  * every print of the window:
46
46
  * - cuts: `newest` (the window's N newest prints) with `newestTailMs` (every print up to that many ms before the
47
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);
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);
49
51
  * - filters, per print (`wrunOptionPrintKept`, the one rule history and live read): `types`, `sides`, `maxDte` and
50
52
  * `moneyness` (the producer's rule, `wrunOptionPrintMoneyness`).
51
53
  * The worker twin asks the gateway for each of them where its answer is exactly the lane's own cut (`types` as the
@@ -652,8 +654,9 @@ export function isWrunOptionPrintMarker(tuple) {
652
654
  * answers. The live fold applies it after every drain, so a live bar never outgrows the cut its history was read under
653
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
654
656
  * `max_cells`). A bar the cut empties keeps its row, empty or, when it was partial, the marker; a marker is no print.
655
- * No newest cut, or `overflow: "largest"` (each bar's largest prints are the projection's, and the newest cut changes no
656
- * bar it draws): the rows as they are (copied).
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).
657
660
  */
658
661
  export function wrunNewestOptionPrintRows(rows, acquisition) {
659
662
  const newest = acquisition.newest;
@@ -744,6 +747,25 @@ export function forEachWrunOptionPrintTuple(row, visit) {
744
747
  }
745
748
  }
746
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) {
753
+ const premium = (at) => {
754
+ const value = tuples[at][WRUN_OPTION_PRINT_COLUMN.premium];
755
+ return Number.isFinite(value) ? value : Number.NEGATIVE_INFINITY;
756
+ };
757
+ const ranked = tuples.map((_, at) => at).sort((a, b) => premium(b) - premium(a) || 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) {
763
+ const out = kept.map((at) => [...tuples[at]]);
764
+ if (out.length > 0) {
765
+ out[0][WRUN_OPTION_PRINT_COLUMN.present] = wrunPresentWithPartial(out[0][WRUN_OPTION_PRINT_COLUMN.present]);
766
+ }
767
+ return out;
768
+ }
747
769
  /**
748
770
  * `overflow: "largest"` over a bar over its bound (om's packer rule, wrun-host/pack.ts `wrunLargestPremiumBlock`):
749
771
  * the `maxCells` prints with the largest premium (an equal premium keeps the earlier print; a non-finite premium
@@ -754,15 +776,60 @@ export function wrunLargestPremiumPrints(tuples, maxCells) {
754
776
  const bound = Math.max(0, Math.floor(maxCells));
755
777
  if (tuples.length <= bound)
756
778
  return tuples;
757
- const premium = (at) => {
758
- const value = tuples[at][WRUN_OPTION_PRINT_COLUMN.premium];
759
- return Number.isFinite(value) ? value : Number.NEGATIVE_INFINITY;
760
- };
761
- const ranked = tuples.map((_, at) => at).sort((a, b) => premium(b) - premium(a) || a - b);
762
- const kept = ranked.slice(0, bound).sort((a, b) => a - b);
763
- const out = kept.map((at) => [...tuples[at]]);
764
- if (out.length > 0) {
765
- out[0][WRUN_OPTION_PRINT_COLUMN.present] = wrunPresentWithPartial(out[0][WRUN_OPTION_PRINT_COLUMN.present]);
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
+ }
766
798
  }
767
- return out;
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));
768
835
  }
@@ -41,6 +41,9 @@ export type WrunOptionStrikeFlowExpiries = {
41
41
  kind: 'nearest';
42
42
  count: number;
43
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"];
44
47
  /** An `expiries` word as this class reads it (absent is "all"), or undefined for a word outside them. */
45
48
  export declare function wrunOptionStrikeFlowExpiriesOf(value: unknown): WrunOptionStrikeFlowExpiries | undefined;
46
49
  /** One input's knobs, canonical: each absent at its default (one acquisition for equal reads). */
@@ -58,6 +58,9 @@ export const WRUN_OPTION_STRIKE_FLOW_TIERS = Object.freeze({
58
58
  ]),
59
59
  });
60
60
  const NEAREST_RE = /^nearest:([1-9]\d{0,2})$/;
61
+ /** The `expiries` words a setting picks (om `WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS`, kit 0.96.0: a select whose
62
+ * `style_values` are these words): every word but "nearest:N", whose count no choice carries. */
63
+ export const WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS = Object.freeze(['all', '0dte', 'after_today']);
61
64
  /** An `expiries` word as this class reads it (absent is "all"), or undefined for a word outside them. */
62
65
  export function wrunOptionStrikeFlowExpiriesOf(value) {
63
66
  if (value === undefined || value === 'all')
@@ -128,6 +128,29 @@ export declare function wrunOptionFlowGrouping(args: {
128
128
  session: boolean;
129
129
  clock: OptionTradeDateClockRule;
130
130
  }): WrunOptionFlowGrouping;
131
+ /**
132
+ * The widest UTC groups a read of `[fromMs, toMs)` at a tier may be summed or picked to so that its answer lands on the
133
+ * chart exactly as the tier's buckets do, where the chart's bars themselves are no grouping the gateway draws (an RTH
134
+ * CME chart's hourly bars open at 13:30Z; a daily bar takes no session pick): the widest whole-minute width that divides
135
+ * a day, divides the host bar (or a day, for a bar of a day or longer), is a multiple of the tier and is a day only on
136
+ * the DAY tier, the window on its boundaries, such that every tier bucket's group opens on a bucket that lands on the
137
+ * bucket's own host bar (`wrunHostBarOf` over the chart's bar grid), or both on none (a Globex night on an RTH chart).
138
+ * One row per group, a few per host bar, never a row that straddles two host bars or a session's edge, so a consumer
139
+ * that lands each host bar on its newest group row lands it where today's buckets land it. Undefined when no width
140
+ * holds or the window cannot be walked (off the tier's grid, more than `NESTED_PROOF_MAX_BUCKETS` buckets). The one
141
+ * proof `options_flow` and the per-bar pick read (option-print-agg-scope.worker.util `wrunOptionsFlowBars`,
142
+ * option-strikes.worker.util `optionLaneBarGrouping`); `wrunOptionFlowGrouping` is the exact decider beside it.
143
+ */
144
+ export declare function wrunOptionNestedUtcBars(args: {
145
+ barMs: number | undefined;
146
+ barGrid: LiveBucketVenue | null | undefined;
147
+ tierMs: number;
148
+ fromMs: number;
149
+ toMs: number;
150
+ }): {
151
+ barSeconds: number;
152
+ barAnchor: number;
153
+ } | undefined;
131
154
  /** The trade-date group a bucket stamped `ts` sums into under the gateway's session (contract 3.4): on RTH the New York
132
155
  * date's 09:30 open for a bucket inside the cash session (null outside it), on UTC the UTC date's 00:00Z. */
133
156
  export declare function wrunOptionFlowSessionStampMs(ts: number, barAnchor: number): number | null;
@@ -303,6 +303,61 @@ export function wrunOptionFlowGrouping(args) {
303
303
  }
304
304
  return { kind: 'host', session: false };
305
305
  }
306
+ /** The most tier buckets the nested proof walks for one read (the gateway's own limit is 15,000 points a request). */
307
+ const NESTED_PROOF_MAX_BUCKETS = 50_000;
308
+ /** Every UTC group width the gateway takes, widest first: the whole minutes that divide a day (contract 3.2: B below a
309
+ * day, or a day on the DAY tier; a width that divides a day keeps the UTC grid whole across days). */
310
+ const NESTED_UTC_WIDTHS_MS = Object.freeze(Array.from({ length: 1440 }, (_, at) => 1440 - at)
311
+ .filter((minutes) => 1440 % minutes === 0)
312
+ .map((minutes) => minutes * MINUTE_MS));
313
+ /**
314
+ * The widest UTC groups a read of `[fromMs, toMs)` at a tier may be summed or picked to so that its answer lands on the
315
+ * chart exactly as the tier's buckets do, where the chart's bars themselves are no grouping the gateway draws (an RTH
316
+ * CME chart's hourly bars open at 13:30Z; a daily bar takes no session pick): the widest whole-minute width that divides
317
+ * a day, divides the host bar (or a day, for a bar of a day or longer), is a multiple of the tier and is a day only on
318
+ * the DAY tier, the window on its boundaries, such that every tier bucket's group opens on a bucket that lands on the
319
+ * bucket's own host bar (`wrunHostBarOf` over the chart's bar grid), or both on none (a Globex night on an RTH chart).
320
+ * One row per group, a few per host bar, never a row that straddles two host bars or a session's edge, so a consumer
321
+ * that lands each host bar on its newest group row lands it where today's buckets land it. Undefined when no width
322
+ * holds or the window cannot be walked (off the tier's grid, more than `NESTED_PROOF_MAX_BUCKETS` buckets). The one
323
+ * proof `options_flow` and the per-bar pick read (option-print-agg-scope.worker.util `wrunOptionsFlowBars`,
324
+ * option-strikes.worker.util `optionLaneBarGrouping`); `wrunOptionFlowGrouping` is the exact decider beside it.
325
+ */
326
+ export function wrunOptionNestedUtcBars(args) {
327
+ const { barMs, barGrid, tierMs, fromMs, toMs } = args;
328
+ if (barMs === undefined || !(barMs > 0) || !(tierMs > 0) || !Number.isFinite(fromMs) || !(toMs > fromMs)) {
329
+ return undefined;
330
+ }
331
+ if (fromMs % tierMs !== 0 || toMs % tierMs !== 0)
332
+ return undefined;
333
+ const count = (toMs - fromMs) / tierMs;
334
+ if (count > NESTED_PROOF_MAX_BUCKETS)
335
+ return undefined;
336
+ const host = new Array(count);
337
+ for (let at = 0; at < count; at += 1)
338
+ host[at] = wrunHostBarOf(fromMs + at * tierMs, barMs, barGrid);
339
+ /** Whether every bucket's group (opening at `ts - ts % width`, a bucket of the window) lands where the bucket does. */
340
+ const nests = (width) => {
341
+ for (let at = 0; at < count; at += 1) {
342
+ const ts = fromMs + at * tierMs;
343
+ const slot = (ts - (ts % width) - fromMs) / tierMs;
344
+ if (!(slot >= 0 && slot <= at && Number.isInteger(slot)) || host[slot] !== host[at])
345
+ return false;
346
+ }
347
+ return true;
348
+ };
349
+ for (const width of NESTED_UTC_WIDTHS_MS) {
350
+ if (width % tierMs !== 0 || (width === DAY_MS && tierMs !== DAY_MS))
351
+ continue;
352
+ if (barMs < DAY_MS && barMs % width !== 0)
353
+ continue;
354
+ if (fromMs % width !== 0 || toMs % width !== 0)
355
+ continue;
356
+ if (nests(width))
357
+ return { barSeconds: width / 1000, barAnchor: WRUN_OPTION_READ_ENUM.anchorUtc };
358
+ }
359
+ return undefined;
360
+ }
306
361
  /** The trade-date group a bucket stamped `ts` sums into under the gateway's session (contract 3.4): on RTH the New York
307
362
  * date's 09:30 open for a bucket inside the cash session (null outside it), on UTC the UTC date's 00:00Z. */
308
363
  export function wrunOptionFlowSessionStampMs(ts, barAnchor) {
@@ -185,7 +185,7 @@ export interface WrunOptionView {
185
185
  export declare const WRUN_OPTION_VIEW_MARGIN_PCT = 0.5;
186
186
  /** The lane refusal code (wrun-lane-refusal.leaf) of a view ask the gateway answered without the views. */
187
187
  export declare const WRUN_OPTION_VIEWS_UNSERVED_CODE = "option-views-unserved";
188
- /** The plan's refusal of a view whose answer no reader of this host takes yet (a fold). */
188
+ /** The plan's refusal of a view this host does not read yet (`wrunOptionViewUnread`). */
189
189
  export declare const WRUN_OPTION_VIEW_UNREAD_CODE = "wrun_option_view_unread";
190
190
  /** The plan's refusal of one chain lane whose inputs read it through views and whole at once (one ask serves both
191
191
  * never: B and a view of B are two answers). */
@@ -196,6 +196,9 @@ export declare const WRUN_OPTION_VIEWS_ONE_ASK_CODE = "wrun_option_views_one_ask
196
196
  export declare const WRUN_OPTION_VIEWS_ONE_EXPIRIES_CODE = "wrun_option_views_one_expiries";
197
197
  /** A view's spec, or undefined for a word that names none. */
198
198
  export declare function wrunOptionViewSpec(word: unknown): WrunOptionViewSpec | undefined;
199
+ /** Why this host does not read a view yet, in a refusal's words, or undefined when it reads it (every projection,
200
+ * option_contract_state's folds but `oi_board`, which follows the chart's close). */
201
+ export declare function wrunOptionViewUnread(spec: WrunOptionViewSpec): string | undefined;
199
202
  /**
200
203
  * The knobs an input names its views in: `page_view` (one word) or `page_views` (a list), the chain page's views
201
204
  * (section 6.1's title). Never `view`: that is every input's bar view (`confirmed`, `forming`, `is_new_period`,
@@ -213,8 +216,8 @@ export declare function wrunOptionViewParamKnobs(source: Readonly<Record<string,
213
216
  /**
214
217
  * An input's views, validated (main thread, after the paint seam): undefined when it declares none (today's path),
215
218
  * else the views in canonical order (`canonicalViews`). Refuses by name a word that names no view of the input's
216
- * class, a param that is no finite number (a `"@<param>"` the sheet declares no param of stays a string here), and a
217
- * fold, which no reader of this host takes yet.
219
+ * class, a view this host does not read yet (`wrunOptionViewUnread`), and a param that is no finite number (a
220
+ * `"@<param>"` the sheet declares no param of stays a string here).
218
221
  */
219
222
  export declare function wrunOptionViewsOfSource(input: object, ctx: {
220
223
  inputName: string;
@@ -229,7 +232,8 @@ export declare function wrunOptionViewsHinted(views: readonly WrunOptionView[]):
229
232
  /**
230
233
  * A payload's `<prefix>Views` read back (the worker twins, the K controls): the views of `cls`, canonical, or
231
234
  * undefined for a payload that names none; null for a text that is not one this module writes (a word of another
232
- * class, a param that is no finite number, garbage): the ask is refused, never widened to B whole.
235
+ * class, a view this host does not read, a param that is no finite number, garbage): the ask is refused, never
236
+ * widened to B whole.
233
237
  */
234
238
  export declare function wrunOptionViewsOf(text: unknown, cls: WrunOptionViewClass): WrunOptionView[] | null | undefined;
235
239
  /** What an `options_chain` view ask hands the gateway to size B on its page (section 5.1). */
@@ -243,10 +247,41 @@ export interface WrunOptionsChainViewScope {
243
247
  export declare function wrunOptionViewLaneFields(cls: WrunOptionViewClass, views: readonly WrunOptionView[], scope?: WrunOptionsChainViewScope): Record<string, unknown>;
244
248
  /** The view fields of a payload, as they ride (a K control copies them onto the request it builds). */
245
249
  export declare function wrunOptionViewPayloadFields(cls: WrunOptionViewClass, payload: Readonly<Record<string, unknown>> | undefined): Record<string, unknown>;
250
+ /**
251
+ * The implicit view (OPTLOAD W3 FE-STATE): an `option_contract_state` input that declares no view reads its block B
252
+ * whole, so its lane asks the gateway for exactly that, the `WHOLE` view of B (pb-common `OPTION_CHAIN_VIEW_WHOLE`,
253
+ * which the gateway answers on either class), in ONE chain summary read: no expiry directory, no page of every strike,
254
+ * no per-contract registry read. The answer is B's own class tuples in B's order, so the input reads it as it read B.
255
+ * The acquisition names it apart from any view text (`stateViews: "whole"`, never a JSON list: the authoring table
256
+ * keeps `whole` an options_chain word, as the kit does, and no author declares it on this class), so it keys an
257
+ * instance of its own (one key per chain, tier, expiries word, window and book), and the worker twin reads it back as
258
+ * the `whole` view, `implicit` (`wrunOptionViewAskFieldsOf`).
259
+ */
260
+ export declare const WRUN_OPTION_STATE_IMPLICIT_VIEW = "whole";
261
+ /** The payload field of the implicit view (`WRUN_OPTION_STATE_IMPLICIT_VIEW`), as the state lane writes it. */
262
+ export declare function wrunOptionStateImplicitViewFields(): Record<string, unknown>;
263
+ /**
264
+ * The implicit view of an `options_chain` input (OPTLOAD W3 FE-CHAIN), FE-STATE's rule on the chain class: a governed
265
+ * chain whose inputs declare no view reads its block B whole, so its lane asks the gateway's `WHOLE` view of B in ONE
266
+ * chain summary read, sized on the gateway's page by the inputs' expiries word and budget (`chainNearestExpiries`, the
267
+ * inputs' `nearest:N` when every input declares one; `chainMaxContracts`, the smallest `max_cells`; the gateway ports the
268
+ * lane scope's arithmetic, `wrunOptionsChainLaneScope`): no expiry directory before the ask and no per-contract registry
269
+ * read after it. The answer is B's 10-value tuples in B's order, so the inputs read it as they read B. The acquisition
270
+ * names it by the bare word (`chainViews: "whole"`), never a JSON list, so it never shares an author's spelling (an
271
+ * explicit `page_view: "whole"` rides as view text and is refused like any view when the gateway does not answer it),
272
+ * and the worker twin reads it back as the `whole` view, `implicit` (`wrunOptionViewAskFieldsOf`).
273
+ */
274
+ export declare const WRUN_OPTIONS_CHAIN_IMPLICIT_VIEW = "whole";
275
+ /** The payload fields of the options_chain implicit view (`WRUN_OPTIONS_CHAIN_IMPLICIT_VIEW`), as the chain lane writes
276
+ * them: the bare word, then the gateway's scope inputs. */
277
+ export declare function wrunOptionsChainImplicitViewFields(scope: WrunOptionsChainViewScope): Record<string, unknown>;
246
278
  /** A view ask read off a payload (the worker twins): the views and the scope and hint fields, or null for a payload
247
279
  * whose views are not this module's text; undefined for one that names no views (today's path). */
248
280
  export interface WrunOptionViewAskFields {
249
281
  views: WrunOptionView[];
282
+ /** The implicit WHOLE of an input that declares no view (`WRUN_OPTIONS_CHAIN_IMPLICIT_VIEW`,
283
+ * `WRUN_OPTION_STATE_IMPLICIT_VIEW`): an answer that is not B's rows is read today's way, never refused. */
284
+ implicit?: true;
250
285
  nearestExpiries?: number;
251
286
  maxContracts?: number;
252
287
  spotHint?: number;
@@ -291,6 +326,9 @@ export declare const WRUN_OPTION_LANE_KNOBS: Readonly<Record<string, Readonly<Re
291
326
  /** What `expiries` takes beside the strike kit fold (the SDK's `WRUN_OPTION_STRIKES_KIT_EXPIRIES_TAKES`, kit 0.91.1):
292
327
  * the fold keeps its expiries with its own `nearest`, so any other word beside it is refused at declaration. */
293
328
  export declare const WRUN_OPTION_STRIKES_KIT_EXPIRIES_TAKES = "\"all\" (or no expiries) beside fold \"kit\": the fold keeps its expiries with its own `nearest`";
329
+ /** What `curve` takes beside the strike kit fold (the SDK's `WRUN_OPTION_STRIKES_KIT_CURVE_TAKES`, kit 0.96.0): the
330
+ * curve row follows each bar's levels row, so `curve: true` without `levels: true` is refused at declaration. */
331
+ export declare const WRUN_OPTION_STRIKES_KIT_CURVE_TAKES = "true only beside levels: true (the curve row follows each bar's levels row), or false";
294
332
  /** A per-bar class, or undefined for a class that declares no per-bar word. */
295
333
  export declare function wrunOptionLaneClassOf(sourceClass: unknown): WrunOptionLaneClass | undefined;
296
334
  /** One word's knobs on a per-bar class (empty for a word the class does not take). */
@@ -341,10 +379,12 @@ export declare const WRUN_OPTION_VIEW_ROW_WIDTHS: Readonly<{
341
379
  readonly option_contract_state: 16;
342
380
  readonly option_strikes: 14;
343
381
  }>;
344
- /** Column 0 of every strike kit fold row (the SDK's `WRUN_OPTION_STRIKES_KIT_LAYOUTS`). */
382
+ /** Column 0 of every strike kit fold row (the SDK's `WRUN_OPTION_STRIKES_KIT_LAYOUTS`): a strike row, a bar's levels
383
+ * row and, with `curve` (kit 0.96.0), its curve row after the levels row. */
345
384
  export declare const WRUN_OPTION_STRIKES_KIT_LAYOUTS: Readonly<{
346
385
  readonly strike: 0;
347
386
  readonly levels: 1;
387
+ readonly curve: 2;
348
388
  }>;
349
389
  /** The column of a kit levels row that says the bar was refused (its newest minute held more rows than the input's
350
390
  * `max_cells`): 1 refused, 0 served. */
@@ -406,8 +446,12 @@ export declare function wrunOptionLaneCarriesNext(sourceClass: string, acquisiti
406
446
  /** Whether one landed kit fold bar has rows the carry reads: any row, its levels row not the refusal (a refused bar
407
447
  * keeps no strike, so the carry passes over it to the next bar). */
408
448
  export declare function wrunOptionKitBarHasRows(tuples: ReadonlyArray<unknown>): boolean;
409
- /** The f64s per row an instance's rows carry, by its facets: the kit fold's rows on an instance asking it, else the
410
- * class's own tuple (`classWidth`). */
449
+ /**
450
+ * The f64s per row an instance's rows carry, by its facets (the SDK's `wrunAskTupleWidth`, the ask's side of
451
+ * `wrunOptionInputTupleWidth`: the views ride the instance's key, so every input it serves shares its width): the kit
452
+ * fold's rows on an instance asking it, a view block's rows on one whose views (`<prefix>Views`) name a fold of its
453
+ * class (Top Contracts' totals), else the class's own tuple (`classWidth`).
454
+ */
411
455
  export declare function wrunOptionLaneTupleWidth(sourceClass: string, acquisition: Readonly<Record<string, unknown>>, classWidth: number): number;
412
456
  /**
413
457
  * The row budget the first-paint slice sizes an instance asking a per-bar word by (wrun-row-lane-first-paint.util, the