@orangecharts/wrun-chart-host 0.9.0 → 0.11.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 (252) hide show
  1. package/README.md +2 -0
  2. package/dist/constants/feature-flags.constants.d.ts +15 -1
  3. package/dist/constants/feature-flags.constants.js +130 -24
  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/opra-compliance.constants.d.ts +3 -2
  7. package/dist/constants/opra-compliance.constants.js +3 -2
  8. package/dist/constants/option-venues.constants.d.ts +2 -2
  9. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
  10. package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
  11. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
  12. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
  13. package/dist/constants/venue-presets.constants.d.ts +20 -20
  14. package/dist/constants/venue-presets.constants.js +24 -26
  15. package/dist/host-env.d.ts +21 -5
  16. package/dist/host-env.js +6 -0
  17. package/dist/host-ports.types.d.ts +102 -19
  18. package/dist/index.d.ts +18 -0
  19. package/dist/index.js +18 -0
  20. package/dist/interfaces/cancel-reason.interface.d.ts +1 -1
  21. package/dist/interfaces/cme-realtime.interface.d.ts +16 -9
  22. package/dist/interfaces/cme-realtime.interface.js +6 -3
  23. package/dist/interfaces/kscript-diagnostics.interface.d.ts +12 -0
  24. package/dist/interfaces/opra-realtime.interface.d.ts +1 -5
  25. package/dist/interfaces/prediction-market.interface.d.ts +7 -0
  26. package/dist/interfaces/replay.interface.d.ts +8 -0
  27. package/dist/interfaces/stocks-realtime.interface.d.ts +57 -0
  28. package/dist/interfaces/stocks-realtime.interface.js +32 -0
  29. package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
  30. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +62 -94
  31. package/dist/kscript-data/controls/live-trades-merge.util.js +106 -171
  32. package/dist/market-data/billing.interface.d.ts +174 -36
  33. package/dist/market-data/billing.interface.js +58 -8
  34. package/dist/market-data/venue.d.ts +152 -7
  35. package/dist/market-data/venues/cme.contract.copy.json +66 -0
  36. package/dist/market-data/venues/cme.d.ts +126 -0
  37. package/dist/market-data/venues/cme.js +133 -0
  38. package/dist/market-data/venues/index.d.ts +294 -7
  39. package/dist/market-data/venues/index.js +49 -6
  40. package/dist/market-data/venues/opra.contract.copy.json +3 -2
  41. package/dist/market-data/venues/opra.d.ts +2 -2
  42. package/dist/market-data/venues/opra.js +5 -2
  43. package/dist/market-data/venues/stocks.contract.copy.json +64 -0
  44. package/dist/market-data/venues/stocks.d.ts +130 -0
  45. package/dist/market-data/venues/stocks.js +117 -0
  46. package/dist/settings-templates/footprint-rows.js +35 -2
  47. package/dist/settings-templates/form-rows.d.ts +2 -1
  48. package/dist/settings-templates/index.js +7 -3
  49. package/dist/settings-templates/indicator-fields.d.ts +5 -4
  50. package/dist/settings-templates/indicator-fields.js +79 -10
  51. package/dist/settings-templates/tool-rules.d.ts +32 -15
  52. package/dist/settings-templates/tool-rules.js +33 -11
  53. package/dist/settings-templates/tool-tables.generated.js +95 -31
  54. package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
  55. package/dist/utility/chart/book-live-bucket.util.js +47 -0
  56. package/dist/utility/chart/cme-cache-context.util.d.ts +5 -3
  57. package/dist/utility/chart/cme-cache-context.util.js +10 -6
  58. package/dist/utility/chart/cme-realtime.util.js +10 -0
  59. package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +83 -0
  60. package/dist/utility/chart/cme-user-scripts-gate.util.js +142 -0
  61. package/dist/utility/chart/effective-chart-session.util.d.ts +14 -0
  62. package/dist/utility/chart/effective-chart-session.util.js +39 -0
  63. package/dist/utility/chart/host-bar-placement.util.d.ts +28 -0
  64. package/dist/utility/chart/host-bar-placement.util.js +170 -30
  65. package/dist/utility/chart/index-host-tier.util.d.ts +3 -1
  66. package/dist/utility/chart/index-host-tier.util.js +7 -2
  67. package/dist/utility/chart/index-mode-admission.util.js +30 -3
  68. package/dist/utility/chart/kscript-apply-fingerprint.util.js +1 -1
  69. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
  70. package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
  71. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +9 -7
  72. package/dist/utility/chart/kscript-live-coalesce.util.js +13 -8
  73. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +9 -0
  74. package/dist/utility/chart/kscript-live-source-identity.util.js +10 -1
  75. package/dist/utility/chart/kscript-provenance-keys.util.js +13 -0
  76. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +5 -1
  77. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
  78. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
  79. package/dist/utility/chart/kscript-venue-policy.util.d.ts +156 -43
  80. package/dist/utility/chart/kscript-venue-policy.util.js +249 -59
  81. package/dist/utility/chart/live-bucket.util.d.ts +24 -8
  82. package/dist/utility/chart/live-bucket.util.js +85 -27
  83. package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
  84. package/dist/utility/chart/market-session-schedule.util.js +16 -0
  85. package/dist/utility/chart/marketKind.util.js +5 -0
  86. package/dist/utility/chart/mixed-mode.util.d.ts +7 -0
  87. package/dist/utility/chart/mixed-mode.util.js +14 -0
  88. package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
  89. package/dist/utility/chart/opra-read-access.leaf.js +5 -3
  90. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +11 -16
  91. package/dist/utility/chart/opra-user-scripts-gate.util.js +12 -28
  92. package/dist/utility/chart/rth-session.util.d.ts +12 -10
  93. package/dist/utility/chart/rth-session.util.js +25 -21
  94. package/dist/utility/chart/trading-day.util.d.ts +17 -0
  95. package/dist/utility/chart/trading-day.util.js +59 -0
  96. package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
  97. package/dist/utility/chart/window-geometry.leaf.js +22 -6
  98. package/dist/utility/chart/window-owner.leaf.d.ts +23 -2
  99. package/dist/utility/chart/window-owner.leaf.js +45 -3
  100. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +33 -15
  101. package/dist/utility/chart/wrun-bar-session-facts.util.js +70 -20
  102. package/dist/utility/chart/wrun-run-result.util.d.ts +12 -0
  103. package/dist/utility/chart/wrun-run-result.util.js +141 -6
  104. package/dist/utility/intl-locale.util.js +5 -0
  105. package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
  106. package/dist/utility/options/option-bar-anchor.util.js +340 -0
  107. package/dist/utility/options/option-venue.util.d.ts +18 -0
  108. package/dist/utility/options/option-venue.util.js +27 -0
  109. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +4 -0
  110. package/dist/utility/v2/gate-plane.util.d.ts +12 -3
  111. package/dist/utility/v2/gate-plane.util.js +30 -4
  112. package/dist/utility/v2/gate-session-latch.util.js +1 -1
  113. package/dist/utility/v2/stocks-governed.util.d.ts +16 -0
  114. package/dist/utility/v2/stocks-governed.util.js +34 -0
  115. package/dist/utility/wrun/derived-roots.leaf.d.ts +13 -0
  116. package/dist/utility/wrun/derived-roots.leaf.js +27 -0
  117. package/dist/utility/wrun/derived-roots.util.d.ts +205 -0
  118. package/dist/utility/wrun/derived-roots.util.js +451 -0
  119. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +43 -7
  120. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
  121. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
  122. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
  123. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -2
  124. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -2
  125. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +24 -3
  126. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +46 -10
  127. package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
  128. package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
  129. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
  130. package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
  131. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
  132. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +2 -1
  133. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +3 -0
  134. package/dist/utility/wrun/sources/row-lanes/option_prints.js +19 -4
  135. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
  136. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +52 -13
  137. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +88 -19
  138. package/dist/utility/wrun/sources/row-lanes/option_surface.js +2 -1
  139. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
  140. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +24 -9
  141. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +41 -10
  142. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +111 -0
  143. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +133 -0
  144. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +15 -3
  145. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +22 -3
  146. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -0
  147. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +197 -13
  148. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +761 -27
  149. package/dist/utility/wrun/wrun-browser-sources.leaf.js +1 -2
  150. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
  151. package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
  152. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +60 -16
  153. package/dist/utility/wrun/wrun-chart-market-facts.util.js +113 -61
  154. package/dist/utility/wrun/wrun-color-settings.util.d.ts +9 -0
  155. package/dist/utility/wrun/wrun-color-settings.util.js +33 -0
  156. package/dist/utility/wrun/wrun-download-meter.util.d.ts +15 -0
  157. package/dist/utility/wrun/wrun-download-meter.util.js +14 -2
  158. package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
  159. package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
  160. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
  161. package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
  162. package/dist/utility/wrun/wrun-frames.d.ts +27 -6
  163. package/dist/utility/wrun/wrun-frames.js +73 -10
  164. package/dist/utility/wrun/wrun-handles.util.d.ts +7 -3
  165. package/dist/utility/wrun/wrun-handles.util.js +9 -8
  166. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
  167. package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
  168. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +18 -4
  169. package/dist/utility/wrun/wrun-hud-looks.util.js +45 -13
  170. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +68 -0
  171. package/dist/utility/wrun/wrun-input-requirements.leaf.js +163 -7
  172. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
  173. package/dist/utility/wrun/wrun-leg-close.util.d.ts +59 -23
  174. package/dist/utility/wrun/wrun-leg-close.util.js +186 -28
  175. package/dist/utility/wrun/wrun-live-intake.util.d.ts +35 -15
  176. package/dist/utility/wrun/wrun-live-intake.util.js +243 -126
  177. package/dist/utility/wrun/wrun-live-tick.util.d.ts +13 -5
  178. package/dist/utility/wrun/wrun-live-tick.util.js +279 -99
  179. package/dist/utility/wrun/wrun-market-facts.util.d.ts +13 -3
  180. package/dist/utility/wrun/wrun-market-facts.util.js +13 -3
  181. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +60 -11
  182. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +70 -5
  183. package/dist/utility/wrun/wrun-market-size-defaults.util.js +31 -5
  184. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
  185. package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
  186. package/dist/utility/wrun/wrun-option-book-rows.util.d.ts +56 -0
  187. package/dist/utility/wrun/wrun-option-book-rows.util.js +96 -0
  188. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
  189. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
  190. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +23 -6
  191. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +47 -11
  192. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +86 -19
  193. package/dist/utility/wrun/wrun-option-strike-flow.util.js +168 -62
  194. package/dist/utility/wrun/wrun-option-views.util.d.ts +323 -28
  195. package/dist/utility/wrun/wrun-option-views.util.js +484 -71
  196. package/dist/utility/wrun/wrun-options-chain.util.d.ts +3 -3
  197. package/dist/utility/wrun/wrun-options-chain.util.js +2 -0
  198. package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
  199. package/dist/utility/wrun/wrun-output-style.util.js +20 -2
  200. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +32 -2
  201. package/dist/utility/wrun/wrun-overlay-drivers.util.js +13 -3
  202. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
  203. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
  204. package/dist/utility/wrun/wrun-overlay-recovery.util.js +3 -1
  205. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +160 -42
  206. package/dist/utility/wrun/wrun-overlay-run.util.js +1244 -209
  207. package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
  208. package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
  209. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
  210. package/dist/utility/wrun/wrun-panel-mount.util.js +114 -19
  211. package/dist/utility/wrun/wrun-panel-style.util.d.ts +10 -9
  212. package/dist/utility/wrun/wrun-panel-style.util.js +58 -9
  213. package/dist/utility/wrun/wrun-param-map.util.d.ts +14 -11
  214. package/dist/utility/wrun/wrun-param-map.util.js +10 -5
  215. package/dist/utility/wrun/wrun-param-values.util.d.ts +14 -4
  216. package/dist/utility/wrun/wrun-param-values.util.js +4 -0
  217. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +15 -2
  218. package/dist/utility/wrun/wrun-pin-spelling.util.js +39 -14
  219. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
  220. package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
  221. package/dist/utility/wrun/wrun-refusal.util.d.ts +3 -2
  222. package/dist/utility/wrun/wrun-refusal.util.js +22 -0
  223. package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
  224. package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
  225. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +26 -0
  226. package/dist/utility/wrun/wrun-registry-errors.util.js +34 -0
  227. package/dist/utility/wrun/wrun-replay-lane.util.js +3 -2
  228. package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
  229. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +20 -6
  230. package/dist/utility/wrun/wrun-run-interval-session.util.js +22 -7
  231. package/dist/utility/wrun/wrun-run-interval.util.d.ts +43 -9
  232. package/dist/utility/wrun/wrun-run-interval.util.js +58 -15
  233. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +45 -1
  234. package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
  235. package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
  236. package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
  237. package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
  238. package/dist/utility/wrun/wrun-socket-row-source.js +118 -8
  239. package/dist/utility/wrun/wrun-source-rows.util.d.ts +29 -18
  240. package/dist/utility/wrun/wrun-source-rows.util.js +61 -27
  241. package/dist/utility/wrun/wrun-style-words.util.js +6 -4
  242. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
  243. package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
  244. package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
  245. package/dist/utility/wrun/wrun-tape-per-order.util.js +7 -0
  246. package/dist/utility/wrun/wrun-tape-source.util.d.ts +17 -9
  247. package/dist/utility/wrun/wrun-tape-source.util.js +20 -12
  248. package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
  249. package/dist/utils/replay/replay-buffer-math.js +227 -20
  250. package/dist/workers/constants/socket-slots.d.ts +91 -6
  251. package/dist/workers/constants/socket-slots.js +85 -6
  252. package/package.json +5 -5
@@ -289,6 +289,65 @@ export function getTradingDayPeriodStartSec(timestampSec, period, anchor) {
289
289
  const openDate = anchor.openMinutes >= 720 ? shiftCalendarDate(firstTradeDate, -1) : firstTradeDate;
290
290
  return wallInstantMs(anchor.timeZone, openDate, anchor.openMinutes) / 1000;
291
291
  }
292
+ /** 1970-01-01 (date index 0) is a Thursday: the Monday before it is index -3 (titan's lattice). */
293
+ const MONDAY_EPOCH_OFFSET_DAYS = 3;
294
+ const PERIOD_DAY_MS = 86_400_000;
295
+ function dateIndexOf(date) {
296
+ return Math.round(Date.UTC(date.y, date.m - 1, date.d) / PERIOD_DAY_MS);
297
+ }
298
+ function calendarDateOfIndex(index) {
299
+ const date = new Date(index * PERIOD_DAY_MS);
300
+ return { y: date.getUTCFullYear(), m: date.getUTCMonth() + 1, d: date.getUTCDate() };
301
+ }
302
+ /** titan's calendarGroupIndex for weeks (ISO weeks from Monday 1969-12-29) and months (from January 1970). */
303
+ function calendarGroupIndexOf(dateIndex, unit, count) {
304
+ const n = count >= 1 ? Math.floor(count) : 1;
305
+ if (unit === 'month') {
306
+ const date = new Date(dateIndex * PERIOD_DAY_MS);
307
+ return Math.floor(((date.getUTCFullYear() - 1970) * 12 + date.getUTCMonth()) / n);
308
+ }
309
+ return Math.floor(Math.floor((dateIndex + MONDAY_EPOCH_OFFSET_DAYS) / 7) / n);
310
+ }
311
+ /** titan's calendarGroupFirstDateIndex: the first date index of a calendar group. */
312
+ function calendarGroupFirstDateIndexOf(groupIndex, unit, count) {
313
+ const n = count >= 1 ? Math.floor(count) : 1;
314
+ if (unit === 'month') {
315
+ const monthIndex = groupIndex * n;
316
+ const year = 1970 + Math.floor(monthIndex / 12);
317
+ return Math.round(Date.UTC(year, monthIndex - (year - 1970) * 12, 1) / PERIOD_DAY_MS);
318
+ }
319
+ return groupIndex * n * 7 - MONDAY_EPOCH_OFFSET_DAYS;
320
+ }
321
+ /** The open (ms) of the trading day labeled by `date`: evening opens label the next date, so they open the day before. */
322
+ function tradingDateOpenMs(date, anchor) {
323
+ const openDate = anchor.openMinutes >= 720 ? shiftCalendarDate(date, -1) : date;
324
+ return wallInstantMs(anchor.timeZone, openDate, anchor.openMinutes);
325
+ }
326
+ /**
327
+ * The open (ms) of the `count`-unit calendar period holding the TRADING date
328
+ * of `tsMs`: weeks on the ISO Monday lattice, months from January 1970 (so 3
329
+ * is the calendar quarter and 12 the year), grouped as titan groups them
330
+ * (utils/tradingDay.ts calendarGroupIndex), opening with the trading day
331
+ * labeled by the period's first calendar date (Sunday 17:00 America/Chicago
332
+ * for a CME Monday). Titan's `tradingPeriodStartMs`, the grid a session
333
+ * profile folds its weekly and monthly cells on under `calendarPeriodAnchor:
334
+ * 'tradingDay'` (src/renderers/profile/sessionGrid.ts); the fetch-head decider
335
+ * and the history trim mirror it here. `getTradingDayPeriodStartSec` is the
336
+ * same rule for one week, one month and one year, in seconds.
337
+ */
338
+ export function tradingPeriodStartMs(tsMs, anchor, unit, count) {
339
+ if (!Number.isFinite(tsMs))
340
+ return Number.NaN;
341
+ const group = calendarGroupIndexOf(dateIndexOf(tradingDateOf(tsMs, anchor)), unit, count);
342
+ return tradingDateOpenMs(calendarDateOfIndex(calendarGroupFirstDateIndexOf(group, unit, count)), anchor);
343
+ }
344
+ /** The first period open strictly after `tsMs` (the end of the period holding it). */
345
+ export function nextTradingPeriodStartMs(tsMs, anchor, unit, count) {
346
+ if (!Number.isFinite(tsMs))
347
+ return Number.NaN;
348
+ const group = calendarGroupIndexOf(dateIndexOf(tradingDateOf(tsMs, anchor)), unit, count) + 1;
349
+ return tradingDateOpenMs(calendarDateOfIndex(calendarGroupFirstDateIndexOf(group, unit, count)), anchor);
350
+ }
292
351
  /**
293
352
  * The TPO custom-time-range projection of an anchor, or undefined when the
294
353
  * anchor is absent, invalid, or has no wire-expressible projection. The CME
@@ -1,3 +1,11 @@
1
+ /**
2
+ * The owner setting of a window that shows its tables ALONE: the window an add opens beside its chart Indicator
3
+ * (web's window-cell.util writes the same key; the child mount and this geometry read it off the owner's engine
4
+ * settings). Its child mount mounts the `panel.table` children and no other child, and its geometry hides the owner's
5
+ * own pane beside them (settleOwnerPane): the chart Indicator beside the window keeps every other pane, so none shows
6
+ * twice. It means nothing on a cell that is no window.
7
+ */
8
+ export declare const WRUN_WINDOW_TABLES_ONLY_SETTING = "wrunWindowTablesOnly";
1
9
  export type WindowPaneKind = 'table' | 'chart' | 'time';
2
10
  export interface WindowPane {
3
11
  id: string;
@@ -44,7 +44,11 @@
44
44
  * be the window's only pane (never a blank window) and on the reversal; a
45
45
  * pane the reader hid stays theirs. While hidden, the meta carries the
46
46
  * window's mark (window-owner.leaf isPaneHiddenByWindow), so the run gates
47
- * never take it for the reader's collapse: the owner keeps running.
47
+ * never take it for the reader's collapse: the owner keeps running. A window
48
+ * that shows its tables alone (WRUN_WINDOW_TABLES_ONLY_SETTING: the window an
49
+ * add opened beside its chart Indicator) hides the owner's pane beside its
50
+ * tables whatever that pane draws: the chart Indicator beside it shows it
51
+ * already. It still comes back when it would be the window's only pane.
48
52
  *
49
53
  * The reader's own split outranks the plan. The reconcile runs at the end of
50
54
  * EVERY run of the owner (the child mount calls it on each live tick), so a
@@ -70,6 +74,14 @@ import { PANEL_CHART_GRID_HEIGHT, panelGridHeight } from './om-panel.util.js';
70
74
  import { MIN_GRID_HEIGHT_ALLOWED } from './titan-constants.pin.js';
71
75
  import { WRUN_WINDOW_SPLIT_SETTING } from './window-owner.leaf.js';
72
76
  import { wrunChildOverlayParentId } from '../wrun/wrun-child-overlay-id.util.js';
77
+ /**
78
+ * The owner setting of a window that shows its tables ALONE: the window an add opens beside its chart Indicator
79
+ * (web's window-cell.util writes the same key; the child mount and this geometry read it off the owner's engine
80
+ * settings). Its child mount mounts the `panel.table` children and no other child, and its geometry hides the owner's
81
+ * own pane beside them (settleOwnerPane): the chart Indicator beside the window keeps every other pane, so none shows
82
+ * twice. It means nothing on a cell that is no window.
83
+ */
84
+ export const WRUN_WINDOW_TABLES_ONLY_SETTING = 'wrunWindowTablesOnly';
73
85
  /** The split key of a window pane: `self` for the owner, a child's id past `<owner>::`. */
74
86
  export function windowSplitKeyOf(paneId) {
75
87
  const parent = wrunChildOverlayParentId(paneId);
@@ -244,17 +256,21 @@ function showOwnerPane(tc, ownerId) {
244
256
  /**
245
257
  * The owner's own pane under the window layout (C5): hidden while it draws nothing beside another window pane of the
246
258
  * owner, so the plan (the visible panes) leaves it out; shown again once it draws or once it would be the window's
247
- * only pane. Only the pane collapse is used (the owner's eye, which its children follow, is untouched), the meta
248
- * carries the window's mark while hidden (so the run gates tell it from the reader's collapse, window-owner.leaf
249
- * isPaneHiddenByWindow), only a marked pane is shown again, and an engine without the collapse keeps today's pane.
250
- * Returns whether the engine changed.
259
+ * only pane. A window that shows its tables alone (WRUN_WINDOW_TABLES_ONLY_SETTING) hides it beside another window
260
+ * pane whatever it draws (QA 2026-10-22: the window beside an add showed the owner's lower pane the chart beside it
261
+ * already showed), and still shows it when it would be the window's only pane (never a blank window). Only the pane
262
+ * collapse is used (the owner's eye, which its children follow, is untouched), the meta carries the window's mark
263
+ * while hidden (so the run gates tell it from the reader's collapse, window-owner.leaf isPaneHiddenByWindow), only a
264
+ * marked pane is shown again, and an engine without the collapse keeps today's pane. Returns whether the engine
265
+ * changed.
251
266
  */
252
267
  function settleOwnerPane(tc, ownerId) {
253
268
  const owner = tc.metadata.find((meta) => meta.id === ownerId);
254
269
  if (!owner || owner.type !== 'offchart' || owner.hostPaneId)
255
270
  return false;
256
271
  const others = tc.metadata.some((meta) => meta.id !== ownerId && isWindowPaneMeta(meta, ownerId));
257
- if (!others || !ownerPaneDrawsNothing(owner))
272
+ const tablesOnly = owner.settings?.[WRUN_WINDOW_TABLES_ONLY_SETTING] === true;
273
+ if (!others || (!tablesOnly && !ownerPaneDrawsNothing(owner)))
258
274
  return showOwnerPane(tc, ownerId);
259
275
  if (owner.isPaneHidden === true || typeof tc.togglePaneWithAnimation !== 'function')
260
276
  return false;
@@ -10,12 +10,33 @@ export declare const WRUN_WINDOW_SETTING = "wrunWindow";
10
10
  * the flag is.
11
11
  */
12
12
  export declare const WRUN_WINDOW_SPLIT_SETTING = "wrunWindowSplit";
13
- /** An overlay as the window rules read it: its id and its settings bag. */
13
+ /**
14
+ * The built-in Indicators that own a window the way a wrun Indicator does, by indicator type: the nine of the Options
15
+ * panel (NATIVE-WINDOW, 2026-10-28). Another built-in joins by adding its type here; every seam reads this one list.
16
+ */
17
+ export declare const WINDOW_NATIVE_OWNER_TYPES: ReadonlySet<string>;
18
+ /**
19
+ * An overlay as the window rules read it: its id, its type and its settings bag. A workspace row names its Indicator
20
+ * by `type` (its settings hold no `ovType`: an identity key no row keeps); an engine meta by `settings.ovType` (its
21
+ * `type` is the side).
22
+ */
14
23
  export type WindowOwnerOverlay = {
15
24
  id?: unknown;
25
+ type?: unknown;
16
26
  settings?: Record<string, unknown> | null;
17
27
  } | null | undefined;
18
- /** A wrun Indicator overlay (registry, draft or hosted lane) that carries the owner flag. */
28
+ /** The type of a built-in of WINDOW_NATIVE_OWNER_TYPES: a row's `type`, else an engine meta's `settings.ovType`. */
29
+ export declare function windowNativeTypeOf(overlay: WindowOwnerOverlay): string | undefined;
30
+ /** Whether an overlay is a built-in that can own a window (WINDOW_NATIVE_OWNER_TYPES). */
31
+ export declare function isWindowNativeOverlay(overlay: WindowOwnerOverlay): boolean;
32
+ /**
33
+ * Whether a document row can own a window, flagged or not: a saved wrun Indicator (registry or hosted: an editor
34
+ * draft has no row, draft-window.util) or a built-in of WINDOW_NATIVE_OWNER_TYPES. The doors that offer or open a
35
+ * window and the flag writer read it.
36
+ */
37
+ export declare function canOwnWindow(overlay: WindowOwnerOverlay): boolean;
38
+ /** A wrun Indicator overlay (registry, draft or hosted lane) or a built-in of WINDOW_NATIVE_OWNER_TYPES that carries
39
+ * the owner flag. */
19
40
  export declare function isWrunWindowOwner(overlay: WindowOwnerOverlay): boolean;
20
41
  /**
21
42
  * An engine meta as the window's pane mark reads it. The window geometry (window-geometry.leaf, C5) hides an owner's
@@ -3,8 +3,12 @@
3
3
  * window contract) as a leaf with no app import: the owner flag's settings key, the saved split's settings key and
4
4
  * the owner test. The child mount (wrun-panel-mount.util) and the window geometry leaf read them, and they move into
5
5
  * the wrun chart-host package, which the cell readers' reactive draft windows (draft-window.util) may not reach.
6
+ *
7
+ * Two kinds of Indicator can own a window: a wrun Indicator (the feature's name: the flag key stays `wrunWindow`), and
8
+ * a built-in of WINDOW_NATIVE_OWNER_TYPES. Every window seam (the owner test, the doors, the flag writer, the content
9
+ * and name reads) asks this rule, never wrun identity alone.
6
10
  */
7
- import { isWrunPackageOverlaySettings } from '../wrun/wrun-overlay-identity.util.js';
11
+ import { isWrunPackageOverlaySettings, isWrunSavedPackageOverlaySettings } from '../wrun/wrun-overlay-identity.util.js';
8
12
  /** The owner flag's settings key (persisted: `settingsToSave`, indicator.constants). */
9
13
  export const WRUN_WINDOW_SETTING = 'wrunWindow';
10
14
  /**
@@ -17,10 +21,48 @@ export const WRUN_WINDOW_SETTING = 'wrunWindow';
17
21
  * the flag is.
18
22
  */
19
23
  export const WRUN_WINDOW_SPLIT_SETTING = 'wrunWindowSplit';
20
- /** A wrun Indicator overlay (registry, draft or hosted lane) that carries the owner flag. */
24
+ /**
25
+ * The built-in Indicators that own a window the way a wrun Indicator does, by indicator type: the nine of the Options
26
+ * panel (NATIVE-WINDOW, 2026-10-28). Another built-in joins by adding its type here; every seam reads this one list.
27
+ */
28
+ export const WINDOW_NATIVE_OWNER_TYPES = new Set([
29
+ 'OPTIONS_GEX',
30
+ 'OPTIONS_HEATMAP',
31
+ 'OPTIONS_FLOW',
32
+ 'OPTIONS_GEX_CURVE',
33
+ 'OPTIONS_FLOW_PULSE',
34
+ 'OPTIONS_FLOW_EXPIRY',
35
+ 'BINANCE_PUT_CALL_RATIO',
36
+ 'IMPLIED_VOLATILITY_TICKER',
37
+ 'VOLATILITY_INDEX',
38
+ ]);
39
+ /** The type of a built-in of WINDOW_NATIVE_OWNER_TYPES: a row's `type`, else an engine meta's `settings.ovType`. */
40
+ export function windowNativeTypeOf(overlay) {
41
+ for (const type of [overlay?.type, overlay?.settings?.ovType]) {
42
+ if (typeof type === 'string' && WINDOW_NATIVE_OWNER_TYPES.has(type))
43
+ return type;
44
+ }
45
+ return undefined;
46
+ }
47
+ /** Whether an overlay is a built-in that can own a window (WINDOW_NATIVE_OWNER_TYPES). */
48
+ export function isWindowNativeOverlay(overlay) {
49
+ return windowNativeTypeOf(overlay) !== undefined;
50
+ }
51
+ /**
52
+ * Whether a document row can own a window, flagged or not: a saved wrun Indicator (registry or hosted: an editor
53
+ * draft has no row, draft-window.util) or a built-in of WINDOW_NATIVE_OWNER_TYPES. The doors that offer or open a
54
+ * window and the flag writer read it.
55
+ */
56
+ export function canOwnWindow(overlay) {
57
+ return isWrunSavedPackageOverlaySettings(overlay?.settings) || isWindowNativeOverlay(overlay);
58
+ }
59
+ /** A wrun Indicator overlay (registry, draft or hosted lane) or a built-in of WINDOW_NATIVE_OWNER_TYPES that carries
60
+ * the owner flag. */
21
61
  export function isWrunWindowOwner(overlay) {
22
62
  const settings = overlay?.settings;
23
- return !!settings && settings[WRUN_WINDOW_SETTING] === true && isWrunPackageOverlaySettings(settings);
63
+ return (!!settings &&
64
+ settings[WRUN_WINDOW_SETTING] === true &&
65
+ (isWrunPackageOverlaySettings(settings) || isWindowNativeOverlay(overlay)));
24
66
  }
25
67
  /** Whether a meta's pane is hidden by its window (above) and not by the reader: a gate that holds a collapsed pane's
26
68
  * runs lets this owner run, since its runs feed the window's tables (wrun-overlay-recovery.util). */
@@ -3,8 +3,7 @@
3
3
  * C3): `time.trade_date` and `time.session`. Both are facts of the bar's
4
4
  * market (exchange, symbol), its interval and its open time ONLY, never of
5
5
  * the chart's RTH / extended mode, and every hour comes from the chart's own
6
- * session definitions, the RTH window from the kScript engine's table (see
7
- * NYMEX below).
6
+ * session definitions, the RTH window the root's own (see NYMEX below).
8
7
  *
9
8
  * Calendar bars (an interval of one day or longer: 1D, 3D, 1W, 1M) read the
10
9
  * UTC date of their open stamp and 1 on every market: the chart stamps them
@@ -16,27 +15,44 @@
16
15
  * alias): the chart's CME trade date, `cmeSessionBucketMs(t, 1d)`, so the
17
16
  * 17:00 Chicago open belongs to the NEXT date;
18
17
  * - US equities (`getMarketKind` 'tradfi'): the New York calendar date;
19
- * - everything else (crypto, forex, HIP-3, Polymarket, ...): the UTC date.
18
+ * - forex (`getMarketKind` 'forex': FX_OTC, POLYGON_FX): the New York
19
+ * trade date, which opens at 17:00 New York (the forex day runs 17:00 to
20
+ * 17:00 New York, 21:00Z in summer and 22:00Z in winter), so a bar from
21
+ * 17:00 New York on belongs to the NEXT date and Sunday 17:00 New York
22
+ * opens Monday's; the same minute `market.session_open()` fills
23
+ * (WRUN_MARKET_SESSION_OPEN_FOREX);
24
+ * - everything else (crypto, HIP-3, Polymarket, ...): the UTC date.
20
25
  * - session, 1 regular, 2 pre-market, 3 after-hours, 0 closed:
21
26
  * - US equities: `resolveUsEquitySessionPhase`;
22
27
  * - CME family: 0 while the weekly schedule says closed
23
28
  * (`getGovernedFuturesScheduleStatusForSymbol`, which carries the 24/7
24
- * roots); else 1 inside the engine's RTH window
25
- * (`engineRthWindowForSymbol`, 09:30 to 16:15 New York on every mapped
26
- * root; a root without a window is regular all session), 2 before its
27
- * trade date's RTH window and 3 after it;
28
- * - everything else: 1.
29
+ * roots); else 1 inside the root's RTH window
30
+ * (`engineRthWindowForSymbol`, the chart's own: 09:30 to 16:15 New York,
31
+ * 09:00 to 14:30 on the NYMEX energy roots; a root without a window is
32
+ * regular all session), 2 before its trade date's RTH window and 3 after
33
+ * it;
34
+ * - forex and everything else: 1 (forex has no phases; its closed hours
35
+ * print no bars).
36
+ *
37
+ * The chart's own trading-day anchor (trading-day.util `getTradingDayAnchor`,
38
+ * the gate TPO, VWAP, the session dividers and the previous close read) does
39
+ * not carry the forex day yet: like US equities, forex keeps the display day
40
+ * there until that gate gains a New York 17:00 anchor in its own change, so
41
+ * a forex Indicator's trade date rolls at 17:00 New York while the chart's
42
+ * native dividers still roll at midnight.
29
43
  *
30
44
  * The golden vectors every other host (kscript-alerts, kscript-backend, om)
31
45
  * tests against are generated from this module:
32
46
  * src/fixtures/wrun-session-facts/golden.json.
33
47
  *
34
- * NYMEX: the chart judges RTH there on the energy pit session, 09:00 to 14:30
35
- * New York (rth-session.util `rthWindowForExchange`, the gateway's REGULAR
36
- * window), but wrun and kScript session facts on NYMEX follow the kScript
37
- * engine's table, 09:30 to 16:15, until a coordinated change moves the
38
- * engine, the golden and the cloud lanes together. Moving this browser lane
39
- * alone would split the browser and cloud runs of the same indicator.
48
+ * NYMEX: the facts follow the energy pit session, 09:00 to 14:30 New York, the
49
+ * window the chart judges RTH on there (rth-session.util
50
+ * `rthWindowForExchange`, the gateway's REGULAR window), so an indicator's
51
+ * `time.session` reads regular on exactly the bars an RTH chart keeps. The
52
+ * shared host's venue layer (om session-facts-venues.ts) reads the same
53
+ * windows and the golden pins them, so the browser and cloud runs of one
54
+ * indicator agree; the kScript engine's uniform 09:30 to 16:15 table is being
55
+ * retired and binds nothing.
40
56
  *
41
57
  * Cost: the definitions run at microseconds a call (the equities phase reads
42
58
  * dayjs timezone parts, about 30 us), so a 50k-bar run cannot afford one per
@@ -48,6 +64,8 @@
48
64
  * Chicago hours (16:00 and 17:00, the Saturday 02:00 to 04:00 window);
49
65
  * - the equities phase per New York (weekday, half hour): its boundaries are
50
66
  * 04:00, 09:30, 16:00 and 20:00;
67
+ * - the forex trade date per New York (date, hour): its one boundary is the
68
+ * whole hour 17:00;
51
69
  * - the CME RTH window per (window, trade date).
52
70
  * Both zones sit a whole number of hours off UTC, so a reader also keeps its
53
71
  * last answer per UTC hour (CME: the trade date and the schedule bit) or half
@@ -88,7 +106,7 @@ export interface WrunBarVenue {
88
106
  barGrid?: LiveBucketVenue;
89
107
  }
90
108
  /** Which C3 rule a market follows. */
91
- export type WrunBarFactsMarket = 'cme' | 'us_equities' | 'utc';
109
+ export type WrunBarFactsMarket = 'cme' | 'us_equities' | 'forex' | 'utc';
92
110
  export declare function wrunBarFactsMarketOf(exchange: string): WrunBarFactsMarket;
93
111
  /**
94
112
  * The venue of chart metadata (or a live context's market) at the series'
@@ -3,8 +3,7 @@
3
3
  * C3): `time.trade_date` and `time.session`. Both are facts of the bar's
4
4
  * market (exchange, symbol), its interval and its open time ONLY, never of
5
5
  * the chart's RTH / extended mode, and every hour comes from the chart's own
6
- * session definitions, the RTH window from the kScript engine's table (see
7
- * NYMEX below).
6
+ * session definitions, the RTH window the root's own (see NYMEX below).
8
7
  *
9
8
  * Calendar bars (an interval of one day or longer: 1D, 3D, 1W, 1M) read the
10
9
  * UTC date of their open stamp and 1 on every market: the chart stamps them
@@ -16,27 +15,44 @@
16
15
  * alias): the chart's CME trade date, `cmeSessionBucketMs(t, 1d)`, so the
17
16
  * 17:00 Chicago open belongs to the NEXT date;
18
17
  * - US equities (`getMarketKind` 'tradfi'): the New York calendar date;
19
- * - everything else (crypto, forex, HIP-3, Polymarket, ...): the UTC date.
18
+ * - forex (`getMarketKind` 'forex': FX_OTC, POLYGON_FX): the New York
19
+ * trade date, which opens at 17:00 New York (the forex day runs 17:00 to
20
+ * 17:00 New York, 21:00Z in summer and 22:00Z in winter), so a bar from
21
+ * 17:00 New York on belongs to the NEXT date and Sunday 17:00 New York
22
+ * opens Monday's; the same minute `market.session_open()` fills
23
+ * (WRUN_MARKET_SESSION_OPEN_FOREX);
24
+ * - everything else (crypto, HIP-3, Polymarket, ...): the UTC date.
20
25
  * - session, 1 regular, 2 pre-market, 3 after-hours, 0 closed:
21
26
  * - US equities: `resolveUsEquitySessionPhase`;
22
27
  * - CME family: 0 while the weekly schedule says closed
23
28
  * (`getGovernedFuturesScheduleStatusForSymbol`, which carries the 24/7
24
- * roots); else 1 inside the engine's RTH window
25
- * (`engineRthWindowForSymbol`, 09:30 to 16:15 New York on every mapped
26
- * root; a root without a window is regular all session), 2 before its
27
- * trade date's RTH window and 3 after it;
28
- * - everything else: 1.
29
+ * roots); else 1 inside the root's RTH window
30
+ * (`engineRthWindowForSymbol`, the chart's own: 09:30 to 16:15 New York,
31
+ * 09:00 to 14:30 on the NYMEX energy roots; a root without a window is
32
+ * regular all session), 2 before its trade date's RTH window and 3 after
33
+ * it;
34
+ * - forex and everything else: 1 (forex has no phases; its closed hours
35
+ * print no bars).
36
+ *
37
+ * The chart's own trading-day anchor (trading-day.util `getTradingDayAnchor`,
38
+ * the gate TPO, VWAP, the session dividers and the previous close read) does
39
+ * not carry the forex day yet: like US equities, forex keeps the display day
40
+ * there until that gate gains a New York 17:00 anchor in its own change, so
41
+ * a forex Indicator's trade date rolls at 17:00 New York while the chart's
42
+ * native dividers still roll at midnight.
29
43
  *
30
44
  * The golden vectors every other host (kscript-alerts, kscript-backend, om)
31
45
  * tests against are generated from this module:
32
46
  * src/fixtures/wrun-session-facts/golden.json.
33
47
  *
34
- * NYMEX: the chart judges RTH there on the energy pit session, 09:00 to 14:30
35
- * New York (rth-session.util `rthWindowForExchange`, the gateway's REGULAR
36
- * window), but wrun and kScript session facts on NYMEX follow the kScript
37
- * engine's table, 09:30 to 16:15, until a coordinated change moves the
38
- * engine, the golden and the cloud lanes together. Moving this browser lane
39
- * alone would split the browser and cloud runs of the same indicator.
48
+ * NYMEX: the facts follow the energy pit session, 09:00 to 14:30 New York, the
49
+ * window the chart judges RTH on there (rth-session.util
50
+ * `rthWindowForExchange`, the gateway's REGULAR window), so an indicator's
51
+ * `time.session` reads regular on exactly the bars an RTH chart keeps. The
52
+ * shared host's venue layer (om session-facts-venues.ts) reads the same
53
+ * windows and the golden pins them, so the browser and cloud runs of one
54
+ * indicator agree; the kScript engine's uniform 09:30 to 16:15 table is being
55
+ * retired and binds nothing.
40
56
  *
41
57
  * Cost: the definitions run at microseconds a call (the equities phase reads
42
58
  * dayjs timezone parts, about 30 us), so a 50k-bar run cannot afford one per
@@ -48,6 +64,8 @@
48
64
  * Chicago hours (16:00 and 17:00, the Saturday 02:00 to 04:00 window);
49
65
  * - the equities phase per New York (weekday, half hour): its boundaries are
50
66
  * 04:00, 09:30, 16:00 and 20:00;
67
+ * - the forex trade date per New York (date, hour): its one boundary is the
68
+ * whole hour 17:00;
51
69
  * - the CME RTH window per (window, trade date).
52
70
  * Both zones sit a whole number of hours off UTC, so a reader also keeps its
53
71
  * last answer per UTC hour (CME: the trade date and the schedule bit) or half
@@ -59,6 +77,7 @@
59
77
  * Worker-safe: imports only the chart's session utils (no Vue, store, i18n).
60
78
  */
61
79
  import { Intervals } from '../../constants/interval.constants.js';
80
+ import { WRUN_MARKET_SESSION_OPEN_FOREX } from '../wrun/wrun-market-facts.util.js';
62
81
  import { cmeSessionBucketMs } from './cme-session-bucket.util.js';
63
82
  import { isCmeGoverned } from './cme-realtime.util.js';
64
83
  import { liveBucketVenueOf } from './live-bucket.util.js';
@@ -82,7 +101,12 @@ export const WRUN_BAR_SESSION = Object.freeze({
82
101
  export function wrunBarFactsMarketOf(exchange) {
83
102
  if (isCmeGoverned(exchange))
84
103
  return 'cme';
85
- return getMarketKind(exchange) === 'tradfi' ? 'us_equities' : 'utc';
104
+ const kind = getMarketKind(exchange);
105
+ if (kind === 'tradfi')
106
+ return 'us_equities';
107
+ if (kind === 'forex')
108
+ return 'forex';
109
+ return 'utc';
86
110
  }
87
111
  /**
88
112
  * The venue of chart metadata (or a live context's market) at the series'
@@ -257,6 +281,29 @@ function usEquityFactsResolver() {
257
281
  return answer;
258
282
  };
259
283
  }
284
+ // ─── Forex ───────────────────────────────────────────────────────────────────
285
+ /** The forex trade day opens at 17:00 New York: the minute `market.session_open()` fills, as ms. */
286
+ const FOREX_OPEN_MS = WRUN_MARKET_SESSION_OPEN_FOREX * MINUTE_MS;
287
+ function forexFactsResolver() {
288
+ // New York's offset is whole hours and the 17:00 cut sits on the hour, so one UTC hour is one
289
+ // New York (date, hour): one answer for every bar inside it. A bar from 17:00 on belongs to the
290
+ // next date (Sunday 17:00 opens Monday's trade date); every bar is regular.
291
+ let slotMs = Number.NaN;
292
+ let answer = NO_FACTS;
293
+ return (tMs) => {
294
+ const barSlotMs = floorTo(tMs, HOUR_MS);
295
+ if (barSlotMs !== slotMs) {
296
+ const day = zoneDayOf(newYorkClock, tMs);
297
+ const evening = wallSinceMidnightMs(newYorkClock, day, tMs) >= FOREX_OPEN_MS;
298
+ answer = Object.freeze({
299
+ tradeDateSec: (day.dateMs + (evening ? DAY_MS : 0)) / 1000,
300
+ session: WRUN_BAR_SESSION.regular,
301
+ });
302
+ slotMs = barSlotMs;
303
+ }
304
+ return answer;
305
+ };
306
+ }
260
307
  // ─── CME family ──────────────────────────────────────────────────────────────
261
308
  const HOURS_PER_DAY = 24;
262
309
  /** The schedule's open bit per Chicago (weekday, hour), one table per schedule; -1 = not read yet. */
@@ -279,9 +326,10 @@ const TRADE_DATE_WINDOWS_MAX = 4096;
279
326
  const rthWindowByTradeDate = new WeakMap();
280
327
  /**
281
328
  * The RTH window of the CME trade date `tradeDateMs` (00:00Z label): the
282
- * calendar-day window whose open carries that trade date. The 09:30 to 16:15
283
- * New York window sits inside one trade date (the 17:00 Chicago roll is
284
- * after its close), so exactly one window qualifies.
329
+ * calendar-day window whose open carries that trade date. Every root's window
330
+ * (09:30 to 16:15 New York, 09:00 to 14:30 on NYMEX) sits inside one trade
331
+ * date (the 17:00 Chicago roll is after its close), so exactly one window
332
+ * qualifies.
285
333
  */
286
334
  function rthWindowOfTradeDate(window, tradeDateMs) {
287
335
  let byTradeDate = rthWindowByTradeDate.get(window);
@@ -330,7 +378,7 @@ function cmeFactsResolver(symbol) {
330
378
  rth = rthWindowOfTradeDate(window, tradeDateMs);
331
379
  rthTradeDateMs = tradeDateMs;
332
380
  }
333
- // No window on the trade date is unreachable with the uniform window; read it like a root without one.
381
+ // No window on the trade date is unreachable with these windows; read it like a root without one.
334
382
  if (rth === null || (tMs >= rth.openMs && tMs < rth.closeMs))
335
383
  return answers[WRUN_BAR_SESSION.regular];
336
384
  return answers[tMs < rth.openMs ? WRUN_BAR_SESSION.premarket : WRUN_BAR_SESSION.afterHours];
@@ -365,7 +413,9 @@ export function wrunBarSessionFactsResolver(venue) {
365
413
  ? cmeFactsResolver(venue.symbol)
366
414
  : market === 'us_equities'
367
415
  ? usEquityFactsResolver()
368
- : utcFactsResolver();
416
+ : market === 'forex'
417
+ ? forexFactsResolver()
418
+ : utcFactsResolver();
369
419
  return (barOpenMs) => (Number.isFinite(barOpenMs) ? facts(barOpenMs) : NO_FACTS);
370
420
  }
371
421
  /** One bar's facts (a one-off read; hot loops bind `wrunBarSessionFactsResolver` once). */
@@ -774,6 +774,12 @@ export interface WrunRunNote extends RuntimeDiagnostic {
774
774
  export interface WrunRunResult {
775
775
  define: WrunRunDefine;
776
776
  outputs: Record<string, WrunRunResultOutput>;
777
+ /** The owner's HUD headline (wrunHudHeadlineOf): the first `presentation.hud` tile declared `headline: true`
778
+ * (LK05), read on the run's last ready row like the latest-values snapshot reads it: its string slot's text, or
779
+ * its output's value formatted like the card's. The words a panel pane whose frame carries no rows says through its
780
+ * caption (wrun-panel-mount.util), since a HUD card is drawn on a chart cell only and the snapshot that feeds it is
781
+ * published after the children mount. Absent when no tile is a headline or the row holds nothing for it. */
782
+ headline?: string;
777
783
  /** The overlay's container spans the run (kScriptContainerSpansRun): the integration lays it over
778
784
  * the chart's bars from its first row through the run's last bar, as a kScript container spans
779
785
  * its engine timeline. Its outputs arrive as [ts, value] rows the shared preparation keeps only
@@ -785,6 +791,12 @@ export interface WrunRunResult {
785
791
  failureReason?: string;
786
792
  /** The sheet entries the build dropped instead of failing the run (absent when none). */
787
793
  notes?: WrunRunNote[];
794
+ /** The Style targets (wrun-visibility-table) this run drew nothing for (wrunRunEmptyTargets): an output, a range
795
+ * or a fill with no finite value on any ready row (an `omit_if_empty` declaration the build left out, or a plot
796
+ * an input switched off), a drawing, a segment or a handle kind with no record. The Style page draws their lines
797
+ * dimmed with the reason (WrunLayoutPanel), read off the latest-values snapshot the run publishes. Absent when
798
+ * every judged target drew. */
799
+ emptyTargets?: string[];
788
800
  /** Every child's author-facing notices in child order (a TPO whose rows the
789
801
  * rows-per-period cap coarsened); absent when no child has one. The run
790
802
  * still draws: these are warnings (`wrunRunNoticesOf`). */