@orangecharts/wrun-chart-host 0.10.0 → 0.11.1

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 (152) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/feature-flags.constants.d.ts +9 -0
  3. package/dist/constants/feature-flags.constants.js +67 -4
  4. package/dist/constants/governed-exchanges.constants.d.ts +12 -0
  5. package/dist/constants/governed-exchanges.constants.js +16 -0
  6. package/dist/constants/option-venues.constants.d.ts +2 -2
  7. package/dist/host-env.d.ts +1 -9
  8. package/dist/host-ports.types.d.ts +36 -7
  9. package/dist/index.d.ts +7 -1
  10. package/dist/index.js +7 -1
  11. package/dist/indicators/controls/tpo-session.util.d.ts +36 -13
  12. package/dist/indicators/controls/tpo-session.util.js +217 -236
  13. package/dist/interfaces/cancel-reason.interface.d.ts +1 -1
  14. package/dist/interfaces/cme-realtime.interface.d.ts +16 -9
  15. package/dist/interfaces/cme-realtime.interface.js +6 -3
  16. package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
  17. package/dist/interfaces/opra-realtime.interface.d.ts +1 -5
  18. package/dist/interfaces/prediction-market.interface.d.ts +7 -0
  19. package/dist/interfaces/stocks-realtime.interface.d.ts +57 -0
  20. package/dist/interfaces/stocks-realtime.interface.js +32 -0
  21. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +48 -117
  22. package/dist/kscript-data/controls/live-trades-merge.util.js +97 -207
  23. package/dist/market-data/billing.interface.d.ts +86 -12
  24. package/dist/market-data/billing.interface.js +23 -4
  25. package/dist/market-data/venue.d.ts +65 -2
  26. package/dist/market-data/venues/index.d.ts +135 -5
  27. package/dist/market-data/venues/index.js +2 -1
  28. package/dist/market-data/venues/opra.contract.copy.json +3 -2
  29. package/dist/market-data/venues/opra.d.ts +2 -2
  30. package/dist/market-data/venues/opra.js +5 -2
  31. package/dist/market-data/venues/stocks.contract.copy.json +64 -0
  32. package/dist/market-data/venues/stocks.d.ts +130 -0
  33. package/dist/market-data/venues/stocks.js +117 -0
  34. package/dist/settings-templates/footprint-rows.js +35 -2
  35. package/dist/settings-templates/form-rows.d.ts +2 -1
  36. package/dist/settings-templates/indicator-fields.js +34 -4
  37. package/dist/settings-templates/tool-rules.d.ts +12 -5
  38. package/dist/settings-templates/tool-rules.js +11 -5
  39. package/dist/settings-templates/tool-tables.generated.js +4 -0
  40. package/dist/utility/chart/cme-cache-context.util.d.ts +5 -3
  41. package/dist/utility/chart/cme-cache-context.util.js +10 -6
  42. package/dist/utility/chart/cme-realtime.util.js +10 -0
  43. package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +83 -0
  44. package/dist/utility/chart/cme-user-scripts-gate.util.js +142 -0
  45. package/dist/utility/chart/effective-chart-session.util.d.ts +14 -0
  46. package/dist/utility/chart/effective-chart-session.util.js +39 -0
  47. package/dist/utility/chart/host-bar-placement.util.d.ts +28 -0
  48. package/dist/utility/chart/host-bar-placement.util.js +170 -30
  49. package/dist/utility/chart/index-host-tier.util.d.ts +3 -1
  50. package/dist/utility/chart/index-host-tier.util.js +7 -2
  51. package/dist/utility/chart/index-mode-admission.util.js +25 -11
  52. package/dist/utility/chart/kscript-apply-fingerprint.util.js +1 -1
  53. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +6 -9
  54. package/dist/utility/chart/kscript-live-coalesce.util.js +8 -9
  55. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +9 -0
  56. package/dist/utility/chart/kscript-live-source-identity.util.js +10 -1
  57. package/dist/utility/chart/kscript-provenance-keys.util.js +7 -0
  58. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
  59. package/dist/utility/chart/kscript-venue-policy.util.d.ts +115 -21
  60. package/dist/utility/chart/kscript-venue-policy.util.js +194 -40
  61. package/dist/utility/chart/live-bucket.util.d.ts +24 -8
  62. package/dist/utility/chart/live-bucket.util.js +85 -27
  63. package/dist/utility/chart/market-sessions.util.d.ts +83 -0
  64. package/dist/utility/chart/market-sessions.util.js +220 -0
  65. package/dist/utility/chart/marketKind.util.js +5 -0
  66. package/dist/utility/chart/mixed-mode.util.d.ts +7 -0
  67. package/dist/utility/chart/mixed-mode.util.js +14 -0
  68. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +11 -16
  69. package/dist/utility/chart/opra-user-scripts-gate.util.js +12 -28
  70. package/dist/utility/chart/rth-session.util.d.ts +9 -8
  71. package/dist/utility/chart/rth-session.util.js +23 -20
  72. package/dist/utility/chart/session-interval.util.d.ts +2 -1
  73. package/dist/utility/chart/session-interval.util.js +1 -3
  74. package/dist/utility/chart/trading-day.util.d.ts +17 -0
  75. package/dist/utility/chart/trading-day.util.js +59 -0
  76. package/dist/utility/chart/window-owner.leaf.d.ts +23 -2
  77. package/dist/utility/chart/window-owner.leaf.js +45 -3
  78. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +33 -15
  79. package/dist/utility/chart/wrun-bar-session-facts.util.js +70 -20
  80. package/dist/utility/intl-locale.util.js +5 -0
  81. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
  82. package/dist/utility/v2/gate-plane.util.d.ts +12 -3
  83. package/dist/utility/v2/gate-plane.util.js +30 -4
  84. package/dist/utility/v2/gate-session-latch.util.js +1 -1
  85. package/dist/utility/v2/stocks-governed.util.d.ts +16 -0
  86. package/dist/utility/v2/stocks-governed.util.js +34 -0
  87. package/dist/utility/wrun/derived-roots.leaf.d.ts +13 -0
  88. package/dist/utility/wrun/derived-roots.leaf.js +27 -0
  89. package/dist/utility/wrun/derived-roots.util.d.ts +1 -9
  90. package/dist/utility/wrun/derived-roots.util.js +3 -23
  91. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +4 -3
  92. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +24 -3
  93. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +46 -10
  94. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +2 -0
  95. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +63 -16
  96. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +58 -14
  97. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +34 -11
  98. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +106 -30
  99. package/dist/utility/wrun/wrun-browser-sources.leaf.js +1 -2
  100. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +7 -4
  101. package/dist/utility/wrun/wrun-chart-market-facts.util.js +12 -8
  102. package/dist/utility/wrun/wrun-color-settings.util.d.ts +9 -0
  103. package/dist/utility/wrun/wrun-color-settings.util.js +33 -0
  104. package/dist/utility/wrun/wrun-handles.util.d.ts +7 -3
  105. package/dist/utility/wrun/wrun-handles.util.js +9 -8
  106. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +68 -0
  107. package/dist/utility/wrun/wrun-input-requirements.leaf.js +163 -7
  108. package/dist/utility/wrun/wrun-leg-close.util.d.ts +59 -23
  109. package/dist/utility/wrun/wrun-leg-close.util.js +186 -28
  110. package/dist/utility/wrun/wrun-live-intake.util.d.ts +26 -12
  111. package/dist/utility/wrun/wrun-live-intake.util.js +219 -155
  112. package/dist/utility/wrun/wrun-live-tick.util.d.ts +9 -5
  113. package/dist/utility/wrun/wrun-live-tick.util.js +130 -94
  114. package/dist/utility/wrun/wrun-market-facts.util.d.ts +13 -3
  115. package/dist/utility/wrun/wrun-market-facts.util.js +13 -3
  116. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +20 -10
  117. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +10 -5
  118. package/dist/utility/wrun/wrun-option-book-rows.util.d.ts +56 -0
  119. package/dist/utility/wrun/wrun-option-book-rows.util.js +96 -0
  120. package/dist/utility/wrun/wrun-option-views.util.d.ts +281 -20
  121. package/dist/utility/wrun/wrun-option-views.util.js +391 -50
  122. package/dist/utility/wrun/wrun-options-chain.util.d.ts +3 -3
  123. package/dist/utility/wrun/wrun-options-chain.util.js +2 -0
  124. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +15 -2
  125. package/dist/utility/wrun/wrun-overlay-drivers.util.js +13 -3
  126. package/dist/utility/wrun/wrun-overlay-recovery.util.js +3 -1
  127. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +60 -11
  128. package/dist/utility/wrun/wrun-overlay-run.util.js +529 -113
  129. package/dist/utility/wrun/wrun-panel-mount.util.js +51 -6
  130. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +15 -2
  131. package/dist/utility/wrun/wrun-pin-spelling.util.js +27 -3
  132. package/dist/utility/wrun/wrun-refusal.util.d.ts +3 -2
  133. package/dist/utility/wrun/wrun-refusal.util.js +22 -0
  134. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +26 -0
  135. package/dist/utility/wrun/wrun-registry-errors.util.js +34 -0
  136. package/dist/utility/wrun/wrun-replay-lane.util.js +3 -2
  137. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +20 -6
  138. package/dist/utility/wrun/wrun-run-interval-session.util.js +22 -7
  139. package/dist/utility/wrun/wrun-run-interval.util.d.ts +39 -7
  140. package/dist/utility/wrun/wrun-run-interval.util.js +49 -9
  141. package/dist/utility/wrun/wrun-socket-row-source.js +7 -2
  142. package/dist/utility/wrun/wrun-source-rows.util.d.ts +29 -22
  143. package/dist/utility/wrun/wrun-source-rows.util.js +62 -41
  144. package/dist/utility/wrun/wrun-tape-per-order.util.js +1 -20
  145. package/dist/utility/wrun/wrun-tape-source.util.d.ts +17 -9
  146. package/dist/utility/wrun/wrun-tape-source.util.js +20 -12
  147. package/dist/utility/wrun/wrun-volume-profile.util.js +37 -29
  148. package/dist/workers/constants/socket-slots.d.ts +91 -6
  149. package/dist/workers/constants/socket-slots.js +85 -6
  150. package/package.json +5 -5
  151. package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +0 -56
  152. package/dist/kscript-data/controls/live-trades-order-gate.util.js +0 -107
@@ -26,14 +26,24 @@
26
26
  * rule reads a run bar's span on the session calendar (runBarSpan: a 1D bar is its trade date,
27
27
  * stamped 00:00Z after its 17:00 Chicago open; a 1W bar its trade-date week; a 4h bar the 17:00
28
28
  * lattice) and steps over the session gaps, as the built-in's native higher-timeframe leg does.
29
+ *
30
+ * Market replay runs a twin on the same run bars as live wherever they ride a session calendar
31
+ * (isWrunRunIntervalSessionMarket: the CME session lattice, a chart on a session filter such as RTH):
32
+ * the package's own resampler keys its 5m to 4h buckets on the epoch grid, so on an RTH chart its 1h
33
+ * would fold UTC hours (under daylight time 13:00Z holds the 09:30 and 09:45 bars) where the live run
34
+ * steps on the 09:30-anchored hours. The replay lane computes the run bars as of its cutoff
35
+ * (wrunReplayRunBars). Everywhere else replay keeps the package's own path: its fold of the chart's
36
+ * bars is the run bars' own grid.
29
37
  */
30
38
  import { wrunChartHostEnv } from '../../host-env.js';
31
39
  import { runIntervalOfTimeframeLabel, timeframeIsChartOrFiner, } from '../chart/indicator-run-interval.util.js';
32
40
  import { isCmeSessionLatticeExchange } from '../chart/cme-session-bucket.util.js';
33
41
  import { checkIsIndexMode } from '../chart/index-mode.util.js';
42
+ import { chartIntervalToMs } from '../chart/rth-session.util.js';
34
43
  import { isRunIntervalUnservableMarket } from '../chart/run-interval-unservable.leaf.js';
35
44
  import { runIntervalWarmupBars } from '../chart/run-interval-warmup.leaf.js';
36
45
  import { builtinPortOf } from './wrun-builtin-twin.util.js';
46
+ import { wrunBarsSessionFiltered } from './wrun-run-interval-session.util.js';
37
47
  /** The param a twin selects its timeframe with, and the one that says whether to wait for closes. */
38
48
  export const WRUN_TIMEFRAME_PARAM = 'timeframe';
39
49
  export const WRUN_WAIT_FOR_CLOSE_PARAM = 'wait_for_close';
@@ -156,12 +166,13 @@ export function wrunWaitsForClose(settings) {
156
166
  /**
157
167
  * The interval a wrun overlay's package runs at when it is coarser than the chart's, else null (the
158
168
  * package runs on the chart's bars, as before): a proven twin listed in WRUN_RUN_INTERVAL_TWINS,
159
- * off replay, index mode and the markets one candle ask cannot serve (`unsupportedMarket`), whose
160
- * timeframe selects an interval coarser than the chart. A selection at or below the chart's interval
161
- * is the chart's own (wrunTimeframeIsChartOrFiner).
169
+ * off index mode and the markets one candle ask cannot serve (`unsupportedMarket`), live or in
170
+ * replay on a session market (`sessionMarket`, the live run's bars), whose timeframe selects an
171
+ * interval coarser than the chart. A selection at or below the chart's interval is the chart's own
172
+ * (wrunTimeframeIsChartOrFiner).
162
173
  */
163
174
  export function resolveWrunRunInterval(input) {
164
- if (input.replay || input.indexMode || input.unsupportedMarket)
175
+ if (input.indexMode || input.unsupportedMarket || (input.replay && !input.sessionMarket))
165
176
  return null;
166
177
  const lookbackBars = wrunTwinLookbackBars(input.settings);
167
178
  if (lookbackBars === null)
@@ -179,24 +190,53 @@ export function resolveWrunRunInterval(input) {
179
190
  export function isWrunRunIntervalUnsupportedMarket(exchange, transformations) {
180
191
  return isRunIntervalUnservableMarket(exchange, transformations);
181
192
  }
193
+ /**
194
+ * Whether a chart's market rides a session calendar its twins' own resampler cannot fold from the
195
+ * chart's bars (see WrunRunIntervalInput.sessionMarket): a venue on the CME session lattice
196
+ * (isCmeSessionLatticeExchange: its 4h bars on the 17:00 Chicago lattice), or a chart whose own bars
197
+ * ride a session filter (wrunBarsSessionFiltered at the chart's interval: RTH on a CME chart, where
198
+ * a run bar above 30m is anchored on the session open and a 1D run bar holds the whole session).
199
+ */
200
+ export function isWrunRunIntervalSessionMarket(exchange, chart, chartInterval) {
201
+ return (isCmeSessionLatticeExchange(exchange) ||
202
+ wrunBarsSessionFiltered({ ...chart, exchange }, chartIntervalToMs(chartInterval)));
203
+ }
182
204
  /**
183
205
  * The run interval of one mounted wrun overlay: its settings against the chart's interval, venue,
184
- * series (`chartTransformations`, a formula chart's legs) and replay state. `chartExchange` is the
206
+ * series (`chartTransformations`, a formula chart's legs), session (`chartMarket`: the symbol and the
207
+ * session type a replaying chart's session market reads) and replay state. `chartExchange` is the
185
208
  * chart's venue; omitted, the overlay's own `settings.exchange` stands in. A venue that rides the CME
186
209
  * session lattice (CME, CBOT, NYMEX, COMEX: isCmeSessionLatticeExchange, the rule the chart's own
187
- * live bars and the run bars' live fold key on) stamps the run `sessionLattice`.
210
+ * live bars and the run bars' live fold key on) stamps the run `sessionLattice`. The same question
211
+ * with replay off is liveOverlayWrunRunInterval.
188
212
  */
189
- export function overlayWrunRunInterval(chartIndex, overlay, chartInterval, chartExchange, chartTransformations) {
213
+ export function overlayWrunRunInterval(chartIndex, overlay, chartInterval, chartExchange, chartTransformations, chartMarket) {
214
+ // The replay flags are web's (replay/replayFlags.ts `isChartReplaying`, the same Set read at call time).
215
+ const replay = wrunChartHostEnv().chart.isReplaying(chartIndex);
216
+ return overlayRunIntervalUnder(replay, overlay, chartInterval, chartExchange, chartTransformations, chartMarket);
217
+ }
218
+ /**
219
+ * The run interval of one mounted wrun overlay as a live run computes it, whatever the chart's replay:
220
+ * overlayWrunRunInterval's settings, venue, series and session with replay off. The alerts engine
221
+ * evaluates live, so an Indicator arm made while its chart replays reads what live reads
222
+ * (alert-overlay-target `runsAtOwnTimeframe`), where the replay run keeps the package's own path off a
223
+ * session market.
224
+ */
225
+ export function liveOverlayWrunRunInterval(overlay, chartInterval, chartExchange, chartTransformations, chartMarket) {
226
+ return overlayRunIntervalUnder(false, overlay, chartInterval, chartExchange, chartTransformations, chartMarket);
227
+ }
228
+ /** overlayWrunRunInterval's composition under a replay state the caller names. */
229
+ function overlayRunIntervalUnder(replay, overlay, chartInterval, chartExchange, chartTransformations, chartMarket) {
190
230
  const settings = overlay?.settings;
191
231
  const exchange = chartExchange ?? settings?.exchange;
192
232
  const venue = typeof exchange === 'string' ? exchange : undefined;
193
233
  const run = resolveWrunRunInterval({
194
234
  settings,
195
235
  chartInterval,
196
- // The replay flags are web's (replay/replayFlags.ts `isChartReplaying`, the same Set read at call time).
197
- replay: wrunChartHostEnv().chart.isReplaying(chartIndex),
236
+ replay,
198
237
  indexMode: checkIsIndexMode(venue),
199
238
  unsupportedMarket: isWrunRunIntervalUnsupportedMarket(venue, chartTransformations),
239
+ sessionMarket: isWrunRunIntervalSessionMarket(venue, chartMarket, chartInterval),
200
240
  });
201
241
  return run && isCmeSessionLatticeExchange(venue) ? { ...run, sessionLattice: true } : run;
202
242
  }
@@ -1126,6 +1126,12 @@ export class SocketWrunRowSource {
1126
1126
  const servedLegs = mergeWrunSocketServedLegs(freshSheet !== undefined ? undefined : this.runLevel.servedLegs, level.servedLegs);
1127
1127
  // The skipped elements the newest answer named, as it named them; a page without the keys keeps the session's.
1128
1128
  const skipped = level.skipped ?? (freshSheet !== undefined ? undefined : this.runLevel.skipped);
1129
+ // The receipt of the session's OPRA rows (contract opra-server-lanes C4): a fresh session's result names its
1130
+ // own (none without the mark or a tier). A page carrying the mark that names no tier read no chain (the cloud's
1131
+ // pan-back chunk: kscript-backend `wrunOpraRowsReceipt`), and the rows it extends are the session's, served at
1132
+ // the tier the session holds, so the session's receipt stands and the legend's word with it. A page without the
1133
+ // mark (a re-plan off OPRA) drops it; a page naming another tier never reaches here (`servedTierMoved`).
1134
+ const opraServed = level.opraServed ?? (freshSheet === undefined && level.opra === true ? this.runLevel.opraServed : undefined);
1129
1135
  this.runLevel = {
1130
1136
  ...(strategy !== undefined ? { strategy } : {}),
1131
1137
  diagnostics: level.diagnostics ?? [],
@@ -1133,8 +1139,7 @@ export class SocketWrunRowSource {
1133
1139
  ...(skipped !== undefined ? { skipped } : {}),
1134
1140
  // The newest result's OPRA word (every result answers one): a re-plan off OPRA names false.
1135
1141
  ...(level.opra !== undefined ? { opra: level.opra } : {}),
1136
- // And the receipt of its rows: a result without the mark (or naming no tier) leaves none.
1137
- ...(level.opraServed !== undefined ? { opraServed: level.opraServed } : {}),
1142
+ ...(opraServed !== undefined ? { opraServed } : {}),
1138
1143
  };
1139
1144
  if (freshSheet !== undefined)
1140
1145
  this.retainedTier = undefined;
@@ -119,18 +119,7 @@
119
119
  * refuses by name where the host builds the live row's block
120
120
  * (`wrun_cell_block_too_large`, never truncated).
121
121
  * - `tape` (celled): the K_TRADES large lane's rows (`k-trades.worker.ts`:
122
- * `[barTs, [offsetMs, price, size, side], ...]`, the prints of the bar at or
123
- * above the acquisition's `min_size`, history from TRADE_LARGE sorted by
124
- * offset, live prints folded in arrival order by `live-trades-merge.util.ts`)
125
- * become the ABI's `[offsetMs, price, size, side]` 4-tuples through the
126
- * shared host's cell adapter, side +1 for a buy and -1 for a sell, in the
127
- * row's own order, the plan's floor kept (the host plans the tape ask with
128
- * `min_size` resolved from the run's settings, `sources.settings`, the floor
129
- * the lane's acquisition was asked at), except where the per-order switch
130
- * holds (`wrunTapePerOrder`: a CME Group venue, the build flag on), where the
131
- * lane served every fill of each order that reached the floor and the cells
132
- * are read whole (the host's per-cell check would drop the small fills of a
133
- * big order before the package combines them). A primary bar with no row (before the
122
+ * `[barTs, [offsetMs, price, size, side], ...]`, one TRADE_LARGE row per order) become the ABI's 4-tuples, floored by the plan. A primary bar with no row (before the
134
123
  * served history, a quiet bar, a live-edge tape) is a PRESENT EMPTY block; a
135
124
  * bar over the input's `max_cells` refuses by name where the rows are packed
136
125
  * (`wrun_cell_block_too_large`, never truncated). The facets (`min_size`,
@@ -346,7 +335,7 @@
346
335
  * tail build gives the same answer.
347
336
  */
348
337
  import { type WrunPinnedInterval } from './wrun-pinned-interval.util.js';
349
- import type { LiveBucketVenue } from '../chart/live-bucket.util.js';
338
+ import { type LiveBucketVenue } from '../chart/live-bucket.util.js';
350
339
  import { type WrunBarVenue } from '../chart/wrun-bar-session-facts.util.js';
351
340
  import type { WrunIndicatorMetadata, WrunInputSource, WrunInputView, WrunMetadataParam } from '../../interfaces/wrun-runtime.interface.js';
352
341
  import type { WrunInputCarry as WrunHostInputCarry, WrunLegRowBounds } from '@orangecharts/indicator-kit/host';
@@ -596,13 +585,22 @@ export interface WrunChartSourceRows {
596
585
  * either is declared. */
597
586
  venue?: WrunBarVenue;
598
587
  }
599
- /** The chart's market as the shared host's session calendar reads it (`WrunChartSourceRows.session`). */
588
+ /** The chart's market as the shared host's session calendar reads it (`WrunChartSourceRows.session`,
589
+ * built by `wrunChartSession`). */
600
590
  export interface WrunChartSession {
601
591
  /** The chart's exchange: the venue of its own rows and of every leg that names none. */
602
592
  exchange?: string;
603
- /** The session the chart fetches a US listing's candles on, always stated
604
- * (`wrunChartSessionType`): 'extended' only while the chart runs its extended session. */
593
+ /** The chart's symbol: the symbol of its own rows and of every leg that names none, by which the session
594
+ * calendar finds a future's RTH window. */
595
+ symbol?: string;
596
+ /** The session the chart rides, always stated: on a market with an RTH window the effective word
597
+ * (`effectiveChartSessionType` at the chart's interval: 'regular' only while the chart rides RTH), else
598
+ * `wrunChartSessionType` ('extended' only while the chart runs its extended session). */
605
599
  sessionType: 'regular' | 'extended';
600
+ /** The session the chart fetches a pinned US listing's candles on, present only where it differs from
601
+ * `sessionType` (`wrunChartSessionType` of the persisted word: a future riding its full session fetches a
602
+ * stock leg's regular hours). */
603
+ listingSessionType?: 'regular' | 'extended';
606
604
  }
607
605
  /** A calendar row's bounds (1M 3M 6M 1Y, on every market): from its label to its calendar end
608
606
  * (February 2026 from Feb 1 to Mar 1, never the average month's Mar 3 10:30); undefined at a fixed
@@ -869,12 +867,20 @@ export declare const WRUN_PINNED_WIRE_ROWS: Readonly<{
869
867
  readonly candles: "native";
870
868
  readonly typed: "none";
871
869
  }>;
872
- /** A leg's rows as `wrunLegRowsOnHostBars` lands them: their own span (the leg's interval, a trades leg's tier) and
873
- * their row class (`WRUN_LEG_ROW_HOST_MERGE`: how one chart bar merges them). */
870
+ /** A leg's rows as `wrunLegRowsOnHostBars` lands them: their own span (the leg's interval, a trades leg's tier),
871
+ * their row class (`WRUN_LEG_ROW_HOST_MERGE`: how one chart bar merges them) and their own bar grid (`rowVenue`: a
872
+ * session's stub row ends at its close, `rowLastInstantMs`; absent, the nominal span). */
874
873
  export interface WrunLegRowsSpan {
875
874
  legMs: number;
876
875
  rowClass: WrunLegRowClass;
876
+ rowVenue?: LiveBucketVenue | null;
877
877
  }
878
+ /** A pinned leg's own bar grid (`WrunLegRowsSpan.rowVenue`): its market, the chart's own when it names none, at the
879
+ * session the chart's bar grid carries (the session its rows were asked at). */
880
+ export declare function wrunLegRowVenue(market: {
881
+ exchange?: unknown;
882
+ symbol?: unknown;
883
+ } | undefined, barGrid: LiveBucketVenue | null | undefined): LiveBucketVenue;
878
884
  /** The interval (ms) a lane's acquisition was asked at (its `interval` word, the payload field the K control asks
879
885
  * by), undefined when it names none: a trades leg's tier (`WrunChartSourceRows.tradeLegIntervals`). */
880
886
  export declare function wrunLaneAcquisitionIntervalMs(acquisition: Readonly<Record<string, unknown>> | undefined): number | undefined;
@@ -947,11 +953,12 @@ export interface WrunHostBarGrid {
947
953
  /**
948
954
  * The chart bar a grid leg's row stamped `rowTs` lands in, for one row and with no forming bar
949
955
  * (`wrunLegRowsOnHostBars`'s rule for a closed row): its own stamp when that opens a chart bar, else the bar
950
- * holding its last instant (by its open on a calendar span); null when no bar holds it (off the chart's
951
- * session). `barOf` is the chart's bucket function at its own interval (`hostBucketResolverFor` over its bar
952
- * grid). The live session reads it to tell which committed bar a revised leg row reaches.
956
+ * holding its last instant (by its open on a calendar span; on `rowVenue`, the leg's own grid, a session's stub row
957
+ * lasts to its close, `rowLastInstantMs`); null when no bar holds it (off the chart's session). `barOf` is the
958
+ * chart's bucket function at its own interval (`hostBucketResolverFor` over its bar grid). The live session reads it
959
+ * to tell which committed bar a revised leg row reaches.
953
960
  */
954
- export declare function wrunLegRowHostBar(rowTs: number, legMs: number, barOf: (tsMs: number) => number | null): number | null;
961
+ export declare function wrunLegRowHostBar(rowTs: number, legMs: number, barOf: (tsMs: number) => number | null, rowVenue?: LiveBucketVenue | null): number | null;
955
962
  /**
956
963
  * A grid leg's rows as the shared host's exact cursor reads them (`WRUN_PINNED_WIRE_ROWS`): each row in the chart
957
964
  * bar holding its LAST instant (`placeRowsInHostBars` over the leg's own span, merged by the leg's row shape,
@@ -119,18 +119,7 @@
119
119
  * refuses by name where the host builds the live row's block
120
120
  * (`wrun_cell_block_too_large`, never truncated).
121
121
  * - `tape` (celled): the K_TRADES large lane's rows (`k-trades.worker.ts`:
122
- * `[barTs, [offsetMs, price, size, side], ...]`, the prints of the bar at or
123
- * above the acquisition's `min_size`, history from TRADE_LARGE sorted by
124
- * offset, live prints folded in arrival order by `live-trades-merge.util.ts`)
125
- * become the ABI's `[offsetMs, price, size, side]` 4-tuples through the
126
- * shared host's cell adapter, side +1 for a buy and -1 for a sell, in the
127
- * row's own order, the plan's floor kept (the host plans the tape ask with
128
- * `min_size` resolved from the run's settings, `sources.settings`, the floor
129
- * the lane's acquisition was asked at), except where the per-order switch
130
- * holds (`wrunTapePerOrder`: a CME Group venue, the build flag on), where the
131
- * lane served every fill of each order that reached the floor and the cells
132
- * are read whole (the host's per-cell check would drop the small fills of a
133
- * big order before the package combines them). A primary bar with no row (before the
122
+ * `[barTs, [offsetMs, price, size, side], ...]`, one TRADE_LARGE row per order) become the ABI's 4-tuples, floored by the plan. A primary bar with no row (before the
134
123
  * served history, a quiet bar, a live-edge tape) is a PRESENT EMPTY block; a
135
124
  * bar over the input's `max_cells` refuses by name where the rows are packed
136
125
  * (`wrun_cell_block_too_large`, never truncated). The facets (`min_size`,
@@ -351,13 +340,13 @@ import { Intervals } from '../../constants/interval.constants.js';
351
340
  import { barEndMs, calendarBarStartMs, calendarLongestBarMs, calendarMonthsOfMs, isCalendarIntervalMs, } from '../chart/calendar-interval.util.js';
352
341
  import { WRUN_PINNED_INTERVALS, wrunPinnedIntervalOf } from './wrun-pinned-interval.util.js';
353
342
  import { realMainRows } from '../chart/indicator-gap-detector.util.js';
354
- import { placeRowsInHostBars } from '../chart/host-bar-placement.util.js';
343
+ import { placeRowsInHostBars, rowLastInstantMs } from '../chart/host-bar-placement.util.js';
344
+ import { liveBucketVenueOf } from '../chart/live-bucket.util.js';
355
345
  import { findMonday } from '../chart/titan-constants.pin.js';
356
346
  import { wrunBarSessionFactsResolver, } from '../chart/wrun-bar-session-facts.util.js';
357
347
  import { wrunSettingRefusedMessage } from '../scriptEditor/wrun-runtime-diagnostics.leaf.js';
358
348
  import { attachWrunRefusal, wrunPinFinerSeed } from './wrun-refusal.util.js';
359
349
  import { isWrunAskedTapeSource, wrunTapeFloorParamOf } from './wrun-tape-source.util.js';
360
- import { wrunTapePerOrder } from './wrun-tape-per-order.util.js';
361
350
  import { WRUN_BROWSER_REFUSED_CLASS_CODES } from './wrun-browser-sources.leaf.js';
362
351
  import { wrunProtocolPendingSeed } from './wrun-protocol-pending.util.js';
363
352
  import { planWrunRowLaneInputs, wrunRowLaneCellRows } from './sources/wrun-row-lanes.util.js';
@@ -753,6 +742,15 @@ export const WRUN_PINNED_WIRE_ROWS = Object.freeze({
753
742
  candles: 'native',
754
743
  typed: 'none',
755
744
  });
745
+ /** A pinned leg's own bar grid (`WrunLegRowsSpan.rowVenue`): its market, the chart's own when it names none, at the
746
+ * session the chart's bar grid carries (the session its rows were asked at). */
747
+ export function wrunLegRowVenue(market, barGrid) {
748
+ return liveBucketVenueOf({
749
+ exchange: market?.exchange ?? barGrid?.exchange,
750
+ symbol: market?.symbol ?? barGrid?.symbol,
751
+ sessionType: barGrid?.sessionType,
752
+ });
753
+ }
756
754
  /** The interval (ms) a lane's acquisition was asked at (its `interval` word, the payload field the K control asks
757
755
  * by), undefined when it names none: a trades leg's tier (`WrunChartSourceRows.tradeLegIntervals`). */
758
756
  export function wrunLaneAcquisitionIntervalMs(acquisition) {
@@ -870,17 +868,18 @@ export async function wrunAskWirePieces(pieces, ask, abandoned) {
870
868
  /**
871
869
  * The chart bar a grid leg's row stamped `rowTs` lands in, for one row and with no forming bar
872
870
  * (`wrunLegRowsOnHostBars`'s rule for a closed row): its own stamp when that opens a chart bar, else the bar
873
- * holding its last instant (by its open on a calendar span); null when no bar holds it (off the chart's
874
- * session). `barOf` is the chart's bucket function at its own interval (`hostBucketResolverFor` over its bar
875
- * grid). The live session reads it to tell which committed bar a revised leg row reaches.
871
+ * holding its last instant (by its open on a calendar span; on `rowVenue`, the leg's own grid, a session's stub row
872
+ * lasts to its close, `rowLastInstantMs`); null when no bar holds it (off the chart's session). `barOf` is the
873
+ * chart's bucket function at its own interval (`hostBucketResolverFor` over its bar grid). The live session reads it
874
+ * to tell which committed bar a revised leg row reaches.
876
875
  */
877
- export function wrunLegRowHostBar(rowTs, legMs, barOf) {
876
+ export function wrunLegRowHostBar(rowTs, legMs, barOf, rowVenue) {
878
877
  if (!Number.isFinite(rowTs))
879
878
  return null;
880
879
  const open = barOf(rowTs);
881
880
  if (open === rowTs || !(legMs > 0) || isCalendarIntervalMs(legMs))
882
881
  return open;
883
- return barOf(rowTs + legMs - 1);
882
+ return barOf(rowLastInstantMs(rowTs, legMs, rowVenue));
884
883
  }
885
884
  /** The index of the first of ascending `values` above `ms` (`values.length` when none is). */
886
885
  function firstValueAbove(values, ms) {
@@ -930,7 +929,9 @@ export function wrunLegRowsOnHostBars(rows, host, leg, afterTs) {
930
929
  const floor = Math.max(opens[from] - reach, opens[from - 1]);
931
930
  placedFrom = Math.max(lead, wrunLastRowAtOrBefore(rows, floor) + 1);
932
931
  }
933
- const placed = placeRowsInHostBars((placedFrom === 0 ? rows : rows.slice(placedFrom)), { mainRows: (from === 0 ? opens : opens.slice(from)).map((open) => [open]), intervalMs, venue: host.barGrid }, WRUN_LEG_ROW_HOST_MERGE[leg.rowClass], undefined, spanMs === undefined ? undefined : { rowSpanMs: spanMs, formingBarTs: host.formingBarTs ?? null });
932
+ const placed = placeRowsInHostBars((placedFrom === 0 ? rows : rows.slice(placedFrom)), { mainRows: (from === 0 ? opens : opens.slice(from)).map((open) => [open]), intervalMs, venue: host.barGrid }, WRUN_LEG_ROW_HOST_MERGE[leg.rowClass], undefined, spanMs === undefined
933
+ ? undefined
934
+ : { rowSpanMs: spanMs, formingBarTs: host.formingBarTs ?? null, rowVenue: leg.rowVenue });
934
935
  if (lead === 0 && placedFrom === 0 && placed.length === rows.length && placed.every((row, at) => row === rows[at])) {
935
936
  return rows;
936
937
  }
@@ -2375,22 +2376,47 @@ function wrunPlainLaneRows(rows) {
2375
2376
  : rows;
2376
2377
  }
2377
2378
  /** The session answers a run's clock carries (`WrunHostAlignClock`), keyed as the aligner reads
2378
- * them: `wrunSessionClock` over the plan on the chart's session (the CME session rows' bounds, the
2379
- * leg candles' closes and opens; none without a session), and a calendar row's bounds on every
2380
- * market (`wrunCalendarRowBounds`, the chart's own rule beside the package's). The browser plans
2381
- * under the chart's placeholder market (`WRUN_ROWS_CHART_MARKET`), so an ask on it (the chart's own
2382
- * rows, a leg that names no exchange) reads the chart's exchange, as the browser's fetch does. */
2379
+ * them: `wrunSessionClock` over the plan on the chart's session (its symbol and the session the chart
2380
+ * rides: the session rows' bounds, the leg candles' closes and opens; none without a session), and a
2381
+ * calendar row's bounds on every market (`wrunCalendarRowBounds`, the chart's own rule beside the
2382
+ * package's). The browser plans under the chart's placeholder market (`WRUN_ROWS_CHART_MARKET`), so an
2383
+ * ask on it (the chart's own rows, a leg that names no exchange or no symbol) reads the chart's exchange
2384
+ * and symbol, as the browser's fetch does. The clock reads one session word for the chart's own rules
2385
+ * and for a US listing's: where the chart fetches a pinned listing on another session
2386
+ * (`listingSessionType`: a future riding its full session fetches a stock leg's regular hours), the
2387
+ * listing legs take their closes from the clock read again on that word, over their asks alone. */
2383
2388
  function wrunSessionAnswersOf(host, plan, session, intervalMs) {
2384
2389
  const calendarBounds = wrunCalendarRowBounds(intervalMs);
2385
2390
  const calendar = calendarBounds === undefined ? {} : { rowBounds: calendarBounds };
2386
2391
  if (session === undefined)
2387
2392
  return calendar;
2388
- const { exchange, sessionType } = session;
2389
- const fetches = exchange === undefined
2393
+ const { exchange, symbol, sessionType, listingSessionType } = session;
2394
+ const fetches = exchange === undefined && symbol === undefined
2390
2395
  ? plan.fetches
2391
- : plan.fetches.map((ask) => (ask.exchange === WRUN_ROWS_CHART_MARKET.exchange ? { ...ask, exchange } : ask));
2396
+ : plan.fetches.map((ask) => {
2397
+ const onExchange = exchange !== undefined && ask.exchange === WRUN_ROWS_CHART_MARKET.exchange;
2398
+ const onSymbol = symbol !== undefined && ask.symbol === WRUN_ROWS_CHART_MARKET.symbol;
2399
+ return onExchange || onSymbol
2400
+ ? { ...ask, ...(onExchange ? { exchange } : {}), ...(onSymbol ? { symbol } : {}) }
2401
+ : ask;
2402
+ });
2403
+ // A typed value, not an object literal: a kit whose clock names no `symbol` compiles with it and reads none.
2404
+ const chart = {
2405
+ exchange: exchange ?? '',
2406
+ intervalMs,
2407
+ ...(symbol !== undefined ? { symbol } : {}),
2408
+ sessionType,
2409
+ };
2410
+ const answers = host.wrunSessionClock({ ...plan, fetches }, chart);
2411
+ const listingWord = listingSessionType !== sessionType ? listingSessionType : undefined;
2412
+ const listingAsks = listingWord === undefined ? [] : fetches.filter((ask) => host.wrunCalendarOfVenue(ask.exchange) === 'us_equities');
2413
+ if (listingWord === undefined || listingAsks.length === 0)
2414
+ return { ...answers, ...calendar };
2415
+ const listing = { ...chart, sessionType: listingWord };
2416
+ const listingCloses = host.wrunSessionClock({ ...plan, fetches: listingAsks }, listing).legCloses;
2392
2417
  return {
2393
- ...host.wrunSessionClock({ ...plan, fetches }, { exchange: exchange ?? '', intervalMs, sessionType }),
2418
+ ...answers,
2419
+ ...(listingCloses !== undefined ? { legCloses: { ...answers.legCloses, ...listingCloses } } : {}),
2394
2420
  ...calendar,
2395
2421
  };
2396
2422
  }
@@ -2522,7 +2548,11 @@ function wrunHostRunOf(metadata, sources, clock, cellsAfterTs) {
2522
2548
  return legRowsOf(leg);
2523
2549
  let rows = hostBarLegRows.get(leg.fetchKey);
2524
2550
  if (rows === undefined) {
2525
- rows = wrunLegRowsOnHostBars(legRowsOf(leg), hostBarGrid(), { legMs: sources.pinnedLegTierMs?.[leg.fetchKey] ?? leg.legMs, rowClass: wrunLegRowClassOf(leg) }, cellsAfterTs);
2551
+ rows = wrunLegRowsOnHostBars(legRowsOf(leg), hostBarGrid(), {
2552
+ legMs: sources.pinnedLegTierMs?.[leg.fetchKey] ?? leg.legMs,
2553
+ rowClass: wrunLegRowClassOf(leg),
2554
+ rowVenue: wrunLegRowVenue(leg.market, sources.venue?.barGrid),
2555
+ }, cellsAfterTs);
2526
2556
  hostBarLegRows.set(leg.fetchKey, rows);
2527
2557
  }
2528
2558
  return rows;
@@ -2679,17 +2709,8 @@ function wrunHostRunOf(metadata, sources, clock, cellsAfterTs) {
2679
2709
  : source.source === 'tape'
2680
2710
  ? sources.tapeRows
2681
2711
  : sources.optionsChainRows;
2682
- // The browser's book lane is asked at the sheet's depth already: its rows are read whole. The
2683
- // tape keeps the plan's floor (the one its lane was asked at, from the run's settings), except where
2684
- // the per-order switch holds (wrunTapePerOrder: a CME Group venue, the build flag on): its lane served
2685
- // every fill of each order that reached the floor (the history read's per-order floor, the per-order
2686
- // live fold), so its rows are read whole too. The host's per-cell check there drew a 147-contract NQZ6
2687
- // buy of 45 fills as its two 17-lot fills, the fills dropped one by one before "Combine fills" saw them.
2688
- const adapted = ask.class === 'book'
2689
- ? { ...ask, max_depth: undefined }
2690
- : ask.class === 'tape' && wrunTapePerOrder(gridMarket?.exchange)
2691
- ? { ...ask, min_size: undefined, min_value: undefined }
2692
- : ask;
2712
+ // The book lane is asked at the sheet's depth already, so its rows are read whole.
2713
+ const adapted = ask.class === 'book' ? { ...ask, max_depth: undefined } : ask;
2693
2714
  // Past the carry only (`cellsAfterTs`), except the options chain: the live row reads its newest poll, however old.
2694
2715
  const rows = wrunPlainLaneRows(cellsAfterTs === undefined || source.source === 'options_chain'
2695
2716
  ? (lane ?? [])
@@ -1,23 +1,4 @@
1
- /**
2
- * The ONE switch of the per-order floor (BT-ORDER-FLOOR): whether a tape on a venue is judged per aggressor ORDER. One
3
- * aggressor order on a CME Group venue fills as many small fills on one exchange stamp and side; Big Trades' "Combine
4
- * fills: One order" and the kScript trades template add them back into one trade, so a floor applied to each fill
5
- * before they arrive drops the fills of a big order one by one (the 147-contract NQZ6 buy of 2026-10-23 14:31:54Z, 45
6
- * fills of 1 to 17 lots, drew as its two 17-lot fills).
7
- *
8
- * True, everything moves together: the K_TRADES control asks the history read's per-order floor (the payload's
9
- * `perOrder`: the worker sends `minAmountPerOrder` on both lanes and keeps every row), the live raw TRADE prints pass
10
- * the order gate (live-trades-order-gate.util) at the wrun intake's enqueue and the kScript fan-out instead of a floor
11
- * per fill, the fold judges no single fill, the row builder hands the cell adapter the tape ask without its floor, and
12
- * Big Trades' contracts floor defaults by the product root (wrun-market-size-defaults.leaf). False: every one of them
13
- * exactly as before (the per-fill floors, the floored ask, the package's 10 and 100). The switch flips in the same roll
14
- * as the gateway cutover, so a user never sees half of it (history per order beside live per fill).
15
- *
16
- * It holds when the venue is one the gateway judges per order (live-trades-merge.util `tradesFloorPerOrder`: the CME
17
- * Group venues) and the host says the switch is on (`WrunChartHostEnv.tapePerOrder`: web's build flag
18
- * VITE_WRUN_TAPE_PER_ORDER, off by default). When the instrument registry names the plane (`largeTradePerOrder` beside
19
- * `largeTradeMinContracts`), its answer replaces the host flag here, and nowhere else.
20
- */
1
+ /** The one switch for the large CME tape's per-order history read and root defaults: a registry field replaces it here alone. */
21
2
  import { wrunHostTapePerOrder } from '../../host-env.js';
22
3
  import { tradesFloorPerOrder } from '../../kscript-data/controls/live-trades-merge.util.js';
23
4
  /** Whether a tape on `exchange` is judged per aggressor order (above). */
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * The `tape` input source's browser-side contract (WRUN-BIG-TRADES-PLAN C1, and C-DOLLAR for the dollar floor): how a
3
3
  * package's `inputSources.<name> = { source: "tape", min_size | min_value, history }` becomes the ONE acquisition the
4
- * K_TRADES large lane fetches and the live intake folds. Pure: no store, no chart, no fetch; the run pass calls it at
5
- * its head, before any lane fetch, so every refusal here lands by name and at zero fetches.
4
+ * K_TRADES lane fetches and the live intake folds: the large lane wherever the large-print table holds the market, else
5
+ * the raw tape (`wrunTapeLaneExtras`). Pure: no store, no chart, no fetch; the run pass calls it at its head, before any
6
+ * lane fetch, so every refusal here lands by name and at zero fetches.
6
7
  *
7
8
  * - A tape declares exactly ONE floor, `min_size` or `min_value`; both or neither refuses `wrun_tape_floor_invalid`
8
9
  * naming the input. Each is a number literal or a string naming a declared numeric `param`, resolved from the run's
@@ -22,7 +23,8 @@
22
23
  * - The table's own floor ($10k quote on USD-quoted markets, a contracts floor per CME Group root) is a fact a package
23
24
  * cannot lower: a floor below it is served at the table's floor (documented, never enforced here).
24
25
  * - `history: "0" | <duration>`: `"0"` (the default) is the live edge only; a duration `^\d+(s|m|h|d)$` seeds that much
25
- * history from TRADE_LARGE, at most `WRUN_TAPE_HISTORY_MAX_SEC` (30 days); a zero-length spelling ("0m") is the live
26
+ * history from TRADE_LARGE (two hours of the raw tape on a market the table does not hold, `tradesLaneLimits`), at
27
+ * most `WRUN_TAPE_HISTORY_MAX_SEC` (30 days); a zero-length spelling ("0m") is the live
26
28
  * edge too. Anything else refuses `wrun_tape_history_invalid`. The lane serves `min(history, the chart's loaded
27
29
  * window)`, and no more than the gateway's bar limit lets it today (`WRUN_TAPE_HISTORY_SERVED_MAX_SEC`: 15,000
28
30
  * one-minute points, about 10.4 days; k-trades.control.ts opens the ask at the first bar after it), so the
@@ -42,6 +44,7 @@
42
44
  * `wrun_tape_min_value_invalid`, `wrun_tape_history_invalid`).
43
45
  */
44
46
  import type { WrunIndicatorMetadata, WrunInputSource } from '../../interfaces/wrun-runtime.interface.js';
47
+ import { type TradesLargeMarket } from '../../kscript-data/controls/live-trades-merge.util.js';
45
48
  /** A tape `min_size` that resolves to nothing servable (a param the package does not declare, non-finite or not
46
49
  * above zero). */
47
50
  export declare const WRUN_TAPE_MIN_SIZE_INVALID_CODE = "wrun_tape_min_size_invalid";
@@ -157,11 +160,16 @@ export declare function wrunTapeAcquisitionFloor(acquisition: {
157
160
  } | undefined): unknown;
158
161
  /**
159
162
  * The K_TRADES payload extras of a tape acquisition (the run pass's `fetchLane('trades', 'tp', ...)`, which the run
160
- * records as the lane's acquisition: the history fetch, the reconcile's re-ask and the live fold read the SAME
161
- * payload): the large lane, the declared history and the one floor. A dollar floor also carries `valuePerUnit`, the US
162
- * dollars one price unit times one size unit of a live print is worth on the chart's market (the run head's
163
- * `wrunMarketDollarUnit`); without it no live print can be priced and none folds (the history rows carry the gateway's
164
- * own dollar value). A raw floor carries exactly what it always did, so 0.5.0's payload is unchanged.
163
+ * records as the lane's acquisition: the history fetch, the reconcile's re-ask, the live channel and the live fold read
164
+ * the SAME payload): the lane, the declared history and the one floor. The lane is the large-print table (`large`)
165
+ * wherever the table holds the market the tape reads (`tradesLargeServesMarket`), else the raw tape (no `large`: a
166
+ * two-hour seed and the raw TRADE live channel, every fill judged on its own, `tradesLaneLimits`): a CME root the
167
+ * collector does not copy (MGC, MCL, M2K, ...) asked the empty table and drew nothing (#feedback-stream 2149). The
168
+ * market is required, so no caller asks a lane without saying which market's tape it reads; `undefined` (a chart
169
+ * with no market metadata) keeps the large lane. A dollar floor also carries `valuePerUnit`, the US dollars one price
170
+ * unit times one size unit of a live print is worth on the chart's market (the run head's `wrunMarketDollarUnit`);
171
+ * without it no live print can be priced and none folds (the history rows carry the gateway's own dollar value). A raw
172
+ * floor on a market the table holds carries exactly what it always did, so 0.5.0's payload is unchanged.
165
173
  */
166
- export declare function wrunTapeLaneExtras(tape: WrunTapeAcquisition, valuePerUnit: number | undefined): Record<string, unknown>;
174
+ export declare function wrunTapeLaneExtras(tape: WrunTapeAcquisition, valuePerUnit: number | undefined, market: TradesLargeMarket | undefined): Record<string, unknown>;
167
175
  export {};
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * The `tape` input source's browser-side contract (WRUN-BIG-TRADES-PLAN C1, and C-DOLLAR for the dollar floor): how a
3
3
  * package's `inputSources.<name> = { source: "tape", min_size | min_value, history }` becomes the ONE acquisition the
4
- * K_TRADES large lane fetches and the live intake folds. Pure: no store, no chart, no fetch; the run pass calls it at
5
- * its head, before any lane fetch, so every refusal here lands by name and at zero fetches.
4
+ * K_TRADES lane fetches and the live intake folds: the large lane wherever the large-print table holds the market, else
5
+ * the raw tape (`wrunTapeLaneExtras`). Pure: no store, no chart, no fetch; the run pass calls it at its head, before any
6
+ * lane fetch, so every refusal here lands by name and at zero fetches.
6
7
  *
7
8
  * - A tape declares exactly ONE floor, `min_size` or `min_value`; both or neither refuses `wrun_tape_floor_invalid`
8
9
  * naming the input. Each is a number literal or a string naming a declared numeric `param`, resolved from the run's
@@ -22,7 +23,8 @@
22
23
  * - The table's own floor ($10k quote on USD-quoted markets, a contracts floor per CME Group root) is a fact a package
23
24
  * cannot lower: a floor below it is served at the table's floor (documented, never enforced here).
24
25
  * - `history: "0" | <duration>`: `"0"` (the default) is the live edge only; a duration `^\d+(s|m|h|d)$` seeds that much
25
- * history from TRADE_LARGE, at most `WRUN_TAPE_HISTORY_MAX_SEC` (30 days); a zero-length spelling ("0m") is the live
26
+ * history from TRADE_LARGE (two hours of the raw tape on a market the table does not hold, `tradesLaneLimits`), at
27
+ * most `WRUN_TAPE_HISTORY_MAX_SEC` (30 days); a zero-length spelling ("0m") is the live
26
28
  * edge too. Anything else refuses `wrun_tape_history_invalid`. The lane serves `min(history, the chart's loaded
27
29
  * window)`, and no more than the gateway's bar limit lets it today (`WRUN_TAPE_HISTORY_SERVED_MAX_SEC`: 15,000
28
30
  * one-minute points, about 10.4 days; k-trades.control.ts opens the ask at the first bar after it), so the
@@ -41,7 +43,7 @@
41
43
  * The om daemon shares the vocabulary (`wrun_tape_floor_invalid`, `wrun_tape_min_size_invalid`,
42
44
  * `wrun_tape_min_value_invalid`, `wrun_tape_history_invalid`).
43
45
  */
44
- import { TRADES_LARGE_BAR_LIMIT_SEC } from '../../kscript-data/controls/live-trades-merge.util.js';
46
+ import { TRADES_LARGE_BAR_LIMIT_SEC, tradesLargeServesMarket, } from '../../kscript-data/controls/live-trades-merge.util.js';
45
47
  /** A tape `min_size` that resolves to nothing servable (a param the package does not declare, non-finite or not
46
48
  * above zero). */
47
49
  export const WRUN_TAPE_MIN_SIZE_INVALID_CODE = 'wrun_tape_min_size_invalid';
@@ -276,19 +278,25 @@ export function wrunTapeAcquisitionFloor(acquisition) {
276
278
  }
277
279
  /**
278
280
  * The K_TRADES payload extras of a tape acquisition (the run pass's `fetchLane('trades', 'tp', ...)`, which the run
279
- * records as the lane's acquisition: the history fetch, the reconcile's re-ask and the live fold read the SAME
280
- * payload): the large lane, the declared history and the one floor. A dollar floor also carries `valuePerUnit`, the US
281
- * dollars one price unit times one size unit of a live print is worth on the chart's market (the run head's
282
- * `wrunMarketDollarUnit`); without it no live print can be priced and none folds (the history rows carry the gateway's
283
- * own dollar value). A raw floor carries exactly what it always did, so 0.5.0's payload is unchanged.
281
+ * records as the lane's acquisition: the history fetch, the reconcile's re-ask, the live channel and the live fold read
282
+ * the SAME payload): the lane, the declared history and the one floor. The lane is the large-print table (`large`)
283
+ * wherever the table holds the market the tape reads (`tradesLargeServesMarket`), else the raw tape (no `large`: a
284
+ * two-hour seed and the raw TRADE live channel, every fill judged on its own, `tradesLaneLimits`): a CME root the
285
+ * collector does not copy (MGC, MCL, M2K, ...) asked the empty table and drew nothing (#feedback-stream 2149). The
286
+ * market is required, so no caller asks a lane without saying which market's tape it reads; `undefined` (a chart
287
+ * with no market metadata) keeps the large lane. A dollar floor also carries `valuePerUnit`, the US dollars one price
288
+ * unit times one size unit of a live print is worth on the chart's market (the run head's `wrunMarketDollarUnit`);
289
+ * without it no live print can be priced and none folds (the history rows carry the gateway's own dollar value). A raw
290
+ * floor on a market the table holds carries exactly what it always did, so 0.5.0's payload is unchanged.
284
291
  */
285
- export function wrunTapeLaneExtras(tape, valuePerUnit) {
292
+ export function wrunTapeLaneExtras(tape, valuePerUnit, market) {
293
+ const lane = market === undefined || tradesLargeServesMarket(market) ? { large: true } : {};
286
294
  if (tape.minValue === undefined)
287
- return { minSize: tape.minSize, history: tape.history, large: true };
295
+ return { minSize: tape.minSize, history: tape.history, ...lane };
288
296
  return {
289
297
  minValue: tape.minValue,
290
298
  ...(valuePerUnit !== undefined && Number.isFinite(valuePerUnit) && valuePerUnit > 0 ? { valuePerUnit } : {}),
291
299
  history: tape.history,
292
- large: true,
300
+ ...lane,
293
301
  };
294
302
  }