@orangecharts/wrun-chart-host 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/README.md +3 -1
  2. package/dist/constants/feature-flags.constants.d.ts +9 -0
  3. package/dist/constants/feature-flags.constants.js +86 -16
  4. package/dist/constants/marketCapabilities.constants.d.ts +14 -9
  5. package/dist/constants/marketCapabilities.constants.js +36 -13
  6. package/dist/constants/opra-compliance.constants.d.ts +15 -0
  7. package/dist/constants/opra-compliance.constants.js +15 -0
  8. package/dist/constants/option-venues.constants.d.ts +11 -6
  9. package/dist/constants/option-venues.constants.js +5 -2
  10. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
  11. package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
  12. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
  13. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
  14. package/dist/constants/venue-presets.constants.d.ts +20 -20
  15. package/dist/constants/venue-presets.constants.js +24 -26
  16. package/dist/host-env.d.ts +39 -9
  17. package/dist/host-env.js +6 -0
  18. package/dist/host-ports.types.d.ts +108 -18
  19. package/dist/index.d.ts +14 -0
  20. package/dist/index.js +14 -0
  21. package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
  22. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  23. package/dist/interfaces/opra-realtime.interface.js +10 -10
  24. package/dist/interfaces/replay.interface.d.ts +8 -0
  25. package/dist/interfaces/wrun-runtime.interface.d.ts +52 -15
  26. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +94 -14
  27. package/dist/kscript-data/controls/live-trades-merge.util.js +132 -22
  28. package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
  29. package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
  30. package/dist/market-data/billing.interface.d.ts +227 -42
  31. package/dist/market-data/billing.interface.js +60 -12
  32. package/dist/market-data/venue.d.ts +88 -6
  33. package/dist/market-data/venues/cme.contract.copy.json +66 -0
  34. package/dist/market-data/venues/cme.d.ts +126 -0
  35. package/dist/market-data/venues/cme.js +133 -0
  36. package/dist/market-data/venues/index.d.ts +165 -8
  37. package/dist/market-data/venues/index.js +48 -6
  38. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  39. package/dist/market-data/venues/opra.d.ts +3 -3
  40. package/dist/market-data/venues/opra.js +5 -4
  41. package/dist/replay/replayLadder.js +3 -1
  42. package/dist/settings-templates/index.js +7 -3
  43. package/dist/settings-templates/indicator-fields.d.ts +5 -4
  44. package/dist/settings-templates/indicator-fields.js +45 -6
  45. package/dist/settings-templates/tool-rules.d.ts +27 -17
  46. package/dist/settings-templates/tool-rules.js +27 -11
  47. package/dist/settings-templates/tool-tables.generated.js +91 -31
  48. package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
  49. package/dist/utility/chart/book-live-bucket.util.js +47 -0
  50. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  51. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  52. package/dist/utility/chart/index-mode-admission.util.js +24 -3
  53. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  54. package/dist/utility/chart/index-mode.util.js +23 -13
  55. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
  56. package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
  57. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +7 -2
  58. package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
  59. package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
  60. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
  61. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
  62. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
  63. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -27
  64. package/dist/utility/chart/kscript-venue-policy.util.js +74 -32
  65. package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
  66. package/dist/utility/chart/market-session-schedule.util.js +16 -0
  67. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  68. package/dist/utility/chart/marketKind.util.js +17 -7
  69. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  70. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  71. package/dist/utility/chart/om-panel.util.js +6 -6
  72. package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
  73. package/dist/utility/chart/opra-read-access.leaf.js +5 -3
  74. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  75. package/dist/utility/chart/profile-block-size.util.js +7 -0
  76. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  77. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  78. package/dist/utility/chart/rth-session.util.d.ts +3 -2
  79. package/dist/utility/chart/rth-session.util.js +2 -1
  80. package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
  81. package/dist/utility/chart/window-geometry.leaf.js +22 -6
  82. package/dist/utility/chart/wrun-run-result.util.d.ts +17 -0
  83. package/dist/utility/chart/wrun-run-result.util.js +145 -7
  84. package/dist/utility/common/transformations.util.d.ts +7 -0
  85. package/dist/utility/common/transformations.util.js +11 -0
  86. package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
  87. package/dist/utility/options/option-bar-anchor.util.js +340 -0
  88. package/dist/utility/options/option-venue.util.d.ts +21 -3
  89. package/dist/utility/options/option-venue.util.js +30 -3
  90. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
  91. package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
  92. package/dist/utility/wrun/derived-roots.util.js +471 -0
  93. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
  94. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
  95. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
  96. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
  97. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +5 -3
  98. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +6 -4
  99. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  100. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  101. package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
  102. package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
  103. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
  104. package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
  105. package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
  106. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
  107. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  108. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +15 -6
  109. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -0
  110. package/dist/utility/wrun/sources/row-lanes/option_prints.js +82 -13
  111. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
  112. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -8
  113. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +95 -14
  114. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
  115. package/dist/utility/wrun/sources/row-lanes/option_surface.js +7 -3
  116. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
  117. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +35 -14
  118. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +70 -20
  119. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
  120. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -0
  121. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +45 -1
  122. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +114 -6
  123. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +56 -5
  124. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +224 -26
  125. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +822 -58
  126. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  127. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  128. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  129. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  130. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
  131. package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
  132. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  133. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  134. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  135. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +192 -13
  136. package/dist/utility/wrun/wrun-chart-market-facts.util.js +437 -55
  137. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  138. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  139. package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
  140. package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
  141. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  142. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  143. package/dist/utility/wrun/wrun-download-meter.util.d.ts +107 -0
  144. package/dist/utility/wrun/wrun-download-meter.util.js +134 -0
  145. package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
  146. package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
  147. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
  148. package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
  149. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
  150. package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
  151. package/dist/utility/wrun/wrun-frames.d.ts +27 -6
  152. package/dist/utility/wrun/wrun-frames.js +78 -15
  153. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  154. package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
  155. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
  156. package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
  157. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +51 -21
  158. package/dist/utility/wrun/wrun-hud-looks.util.js +74 -28
  159. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
  160. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  161. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  162. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  163. package/dist/utility/wrun/wrun-live-intake.util.d.ts +19 -9
  164. package/dist/utility/wrun/wrun-live-intake.util.js +213 -45
  165. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
  166. package/dist/utility/wrun/wrun-live-tick.util.js +246 -49
  167. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  168. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  169. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +205 -48
  170. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +277 -34
  171. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
  172. package/dist/utility/wrun/wrun-market-size-defaults.util.js +340 -56
  173. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
  174. package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
  175. package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
  176. package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
  177. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
  178. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
  179. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +26 -6
  180. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +50 -11
  181. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +109 -19
  182. package/dist/utility/wrun/wrun-option-strike-flow.util.js +222 -61
  183. package/dist/utility/wrun/wrun-option-views.util.d.ts +96 -18
  184. package/dist/utility/wrun/wrun-option-views.util.js +246 -51
  185. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  186. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  187. package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
  188. package/dist/utility/wrun/wrun-output-style.util.js +20 -2
  189. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +20 -0
  190. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  191. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  192. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
  193. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
  194. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
  195. package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
  196. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  197. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  198. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +134 -37
  199. package/dist/utility/wrun/wrun-overlay-run.util.js +1118 -254
  200. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
  201. package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
  202. package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
  203. package/dist/utility/wrun/wrun-pack.util.js +20 -9
  204. package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
  205. package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
  206. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
  207. package/dist/utility/wrun/wrun-panel-mount.util.js +63 -13
  208. package/dist/utility/wrun/wrun-panel-style.util.d.ts +37 -24
  209. package/dist/utility/wrun/wrun-panel-style.util.js +100 -29
  210. package/dist/utility/wrun/wrun-param-map.util.d.ts +15 -11
  211. package/dist/utility/wrun/wrun-param-map.util.js +13 -5
  212. package/dist/utility/wrun/wrun-param-values.util.d.ts +21 -3
  213. package/dist/utility/wrun/wrun-param-values.util.js +6 -0
  214. package/dist/utility/wrun/wrun-pin-spelling.util.js +12 -11
  215. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  216. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
  217. package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
  218. package/dist/utility/wrun/wrun-refusal.util.js +10 -1
  219. package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
  220. package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
  221. package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
  222. package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
  223. package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
  224. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +52 -1
  225. package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
  226. package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
  227. package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
  228. package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
  229. package/dist/utility/wrun/wrun-socket-row-source.js +113 -8
  230. package/dist/utility/wrun/wrun-source-rows.util.d.ts +9 -1
  231. package/dist/utility/wrun/wrun-source-rows.util.js +108 -43
  232. package/dist/utility/wrun/wrun-style-words.util.js +6 -4
  233. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
  234. package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
  235. package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
  236. package/dist/utility/wrun/wrun-tape-per-order.util.js +26 -0
  237. package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
  238. package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
  239. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  240. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  241. package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
  242. package/dist/utils/replay/replay-buffer-math.js +227 -20
  243. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  244. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  245. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  246. package/package.json +5 -5
@@ -44,6 +44,22 @@ export declare function resolveProfileRowHeight(settings: ProfileRowSettings, mi
44
44
  * re-grid refetch.
45
45
  */
46
46
  export declare function resolveAdoptedProfileBlockSize(servedBlockSize: unknown, persistedMinimumBarHeight: unknown): number | null;
47
+ /**
48
+ * The block an answer's rows are built on: the overlay's held base when the
49
+ * served block is finer and the base is a whole multiple of it, else the
50
+ * served block. The gateway serves each answer on its own row (the requested
51
+ * row raised to the coarsest grid in the window, tsdb-gateway docs/vp-grid.md),
52
+ * so a short window can answer finer than the base a long window adopted
53
+ * (COINBASE BTC-USD 1d, 2026-10-22: the history on 10, the forming-tail poll
54
+ * on 5). Built on the base, those rows merge whole into base rows the way a
55
+ * "Ticks per bar" multiple merges them, so an overlay keeps one grid and its
56
+ * newest columns stop drawing on another one. A served block that is coarser,
57
+ * or does not nest (a legacy grid), keeps its own grid. Shared by the workers
58
+ * (the grid they build on) and the response adopt (which then has nothing to
59
+ * adopt), so both read one rule.
60
+ */
61
+ export declare function resolveHeldProfileBlockSize(servedBlockSize: number, heldBlockSize: unknown): number;
62
+ export declare function resolveHeldProfileBlockSize(servedBlockSize: number | undefined, heldBlockSize: unknown): number | undefined;
47
63
  /**
48
64
  * The effective row size the "Ticks per bar" multiplier produces
49
65
  * (minimumBarHeight x multiplier), formatted at the base block's precision so
@@ -106,6 +106,13 @@ export function resolveAdoptedProfileBlockSize(servedBlockSize, persistedMinimum
106
106
  const scale = Math.max(servedBlockSize, persistedMinimumBarHeight);
107
107
  return Math.abs(servedBlockSize - persistedMinimumBarHeight) > scale * 1e-9 ? servedBlockSize : null;
108
108
  }
109
+ export function resolveHeldProfileBlockSize(servedBlockSize, heldBlockSize) {
110
+ if (!isPositiveFinite(servedBlockSize) || !isPositiveFinite(heldBlockSize))
111
+ return servedBlockSize;
112
+ const ratio = heldBlockSize / servedBlockSize;
113
+ const whole = Math.round(ratio);
114
+ return whole >= 2 && Math.abs(ratio - whole) <= whole * 1e-9 ? heldBlockSize : servedBlockSize;
115
+ }
109
116
  /**
110
117
  * The effective row size the "Ticks per bar" multiplier produces
111
118
  * (minimumBarHeight x multiplier), formatted at the base block's precision so
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Perpetual venues that publish quotes and never trades: Variational Omni, an RFQ venue (VARIATIONAL carries its
3
+ * perpetuals, crypto and RWA alike; VARIATIONAL_SWAP its swaps). The backend prints each market as raw TICKER points
4
+ * and serves its candles as TICKER_AGG on tsdb-gateway v2 (open/high/low/close, no volume), plus FUNDING_RATE_AGG and
5
+ * OPEN_INTEREST_AGG; no trade type lists them (the gateway's `tickerPricedExchanges`, open_interest_agg.go). See
6
+ * docs/features/data/quote-perp-venues.md.
7
+ *
8
+ * A leaf on purpose, with no imports, like crypto-index.leaf: the market-kind table (`marketKind.util`) and the ticker
9
+ * hub (`index-mode.util`) both read it, and web code asks `checkIsQuotePerp` here, never through those two modules,
10
+ * which over a hundred specs mock with partial factories.
11
+ */
12
+ export declare const QUOTE_PERP_EXCHANGES: readonly ["VARIATIONAL", "VARIATIONAL_SWAP"];
13
+ /**
14
+ * A quote-priced perpetual venue (`QUOTE_PERP_EXCHANGES`), the `'quotePerp'` market kind. Case-insensitive like the
15
+ * kind table, and a foreign shape (a persisted object, a number) is no venue, never a throw.
16
+ */
17
+ export declare function checkIsQuotePerp(exchange: string | undefined | null): boolean;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Perpetual venues that publish quotes and never trades: Variational Omni, an RFQ venue (VARIATIONAL carries its
3
+ * perpetuals, crypto and RWA alike; VARIATIONAL_SWAP its swaps). The backend prints each market as raw TICKER points
4
+ * and serves its candles as TICKER_AGG on tsdb-gateway v2 (open/high/low/close, no volume), plus FUNDING_RATE_AGG and
5
+ * OPEN_INTEREST_AGG; no trade type lists them (the gateway's `tickerPricedExchanges`, open_interest_agg.go). See
6
+ * docs/features/data/quote-perp-venues.md.
7
+ *
8
+ * A leaf on purpose, with no imports, like crypto-index.leaf: the market-kind table (`marketKind.util`) and the ticker
9
+ * hub (`index-mode.util`) both read it, and web code asks `checkIsQuotePerp` here, never through those two modules,
10
+ * which over a hundred specs mock with partial factories.
11
+ */
12
+ export const QUOTE_PERP_EXCHANGES = ['VARIATIONAL', 'VARIATIONAL_SWAP'];
13
+ const QUOTE_PERP_EXCHANGES_SET = new Set(QUOTE_PERP_EXCHANGES);
14
+ /**
15
+ * A quote-priced perpetual venue (`QUOTE_PERP_EXCHANGES`), the `'quotePerp'` market kind. Case-insensitive like the
16
+ * kind table, and a foreign shape (a persisted object, a number) is no venue, never a throw.
17
+ */
18
+ export function checkIsQuotePerp(exchange) {
19
+ return typeof exchange === 'string' && QUOTE_PERP_EXCHANGES_SET.has(exchange.toUpperCase());
20
+ }
@@ -236,13 +236,14 @@ export declare function rthSessionCloseMs(symbol: unknown, tsMs: number): number
236
236
  /**
237
237
  * The instant a FOLDED footprint bucket stops changing, on either fold grid:
238
238
  * anchored buckets end at `min(start + tf, session close)`
239
- * (`rthAnchoredBucketEndMs`); utc-grid buckets nominally end at `start + tf`
239
+ * (`rthAnchoredBucketEndMs`); 'eth'-grid buckets (the market's own full-session
240
+ * grid, whose starts the caller keys) nominally end at `start + tf`
240
241
  * but the RTH filter stops feeding them at the session close, so the bucket
241
242
  * holding the close is complete at 20:15Z, not at the top of the next hour.
242
243
  * Forming/closed classification (the poll-apply gate) must use this end or a
243
244
  * closed stub/close-straddling row would count as forming long after it froze.
244
245
  */
245
- export declare function footprintFoldBucketEndMs(symbol: unknown, bucketStartMs: number, tfMs: number, bucketMode: 'anchored' | 'utc'): number | null;
246
+ export declare function footprintFoldBucketEndMs(symbol: unknown, bucketStartMs: number, tfMs: number, bucketMode: 'anchored' | 'eth'): number | null;
246
247
  /**
247
248
  * Does the bucket `[bucketStartMs, bucketStartMs + tfMs)` overlap its venue
248
249
  * day's RTH session at all? The live gate for FOLDED footprints on the utc
@@ -659,7 +659,8 @@ export function rthSessionCloseMs(symbol, tsMs) {
659
659
  /**
660
660
  * The instant a FOLDED footprint bucket stops changing, on either fold grid:
661
661
  * anchored buckets end at `min(start + tf, session close)`
662
- * (`rthAnchoredBucketEndMs`); utc-grid buckets nominally end at `start + tf`
662
+ * (`rthAnchoredBucketEndMs`); 'eth'-grid buckets (the market's own full-session
663
+ * grid, whose starts the caller keys) nominally end at `start + tf`
663
664
  * but the RTH filter stops feeding them at the session close, so the bucket
664
665
  * holding the close is complete at 20:15Z, not at the top of the next hour.
665
666
  * Forming/closed classification (the poll-apply gate) must use this end or a
@@ -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;
@@ -648,6 +648,11 @@ export interface WrunRunResultOptions {
648
648
  * at or after it and is merged row by row (wrun-batched-marks.util `tailFromTs`). Full runs,
649
649
  * reseeds and pans leave it absent: every child builds its whole window under the cell budget. */
650
650
  batchedTailFromTs?: number;
651
+ /** The chart market's dollar unit (wrunMarketDollarUnit when proven), handed to the batched children: a marks
652
+ * child carries it on its settings and readout, where the `units` caption and hover divide a record's dollar value
653
+ * by it (wrun-batched-marks.util `valuePerUnit`). Every build passes the one its market proves, a live tick's
654
+ * tail the same as its full run; absent where none is proven. */
655
+ valuePerUnit?: number;
651
656
  /** WRUN-STYLE: the mounted overlay's id, handed to the levels child
652
657
  * builders (absent = the sheet id stands in). */
653
658
  overlayId?: string;
@@ -769,6 +774,12 @@ export interface WrunRunNote extends RuntimeDiagnostic {
769
774
  export interface WrunRunResult {
770
775
  define: WrunRunDefine;
771
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;
772
783
  /** The overlay's container spans the run (kScriptContainerSpansRun): the integration lays it over
773
784
  * the chart's bars from its first row through the run's last bar, as a kScript container spans
774
785
  * its engine timeline. Its outputs arrive as [ts, value] rows the shared preparation keeps only
@@ -780,6 +791,12 @@ export interface WrunRunResult {
780
791
  failureReason?: string;
781
792
  /** The sheet entries the build dropped instead of failing the run (absent when none). */
782
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[];
783
800
  /** Every child's author-facing notices in child order (a TPO whose rows the
784
801
  * rows-per-period cap coarsened); absent when no child has one. The run
785
802
  * still draws: these are warnings (`wrunRunNoticesOf`). */
@@ -555,8 +555,10 @@ import { assertWrunCandleMemberLook, isWrunGlowClampDisabled, landWrunGlowPx, la
555
555
  import { wrunAbiVersion, wrunFramesOf } from '../wrun/wrun-pack.util.js';
556
556
  import { formatWrunValue, isWrunValueFormat, WRUN_VALUE_FORMATS } from '../wrun/wrun-pane-format.util.js';
557
557
  import { createWrunRenderBudget, selectWrunRenderables, wrunRenderValueBytes, wrunSelectionBytes, } from '../wrun/wrun-render-select.util.js';
558
- import { parseWrunThemeToken, wrunThemeTokenOfPacked, wrunThemeTokenScaleAlpha, wrunThemeTokenWithAlpha, wrunThemeTokenWord, } from '../wrun/wrun-style-words.util.js';
558
+ import { formatWrunNumber, parseWrunThemeToken, wrunThemeTokenOfPacked, wrunThemeTokenScaleAlpha, wrunThemeTokenWithAlpha, wrunThemeTokenWord, } from '../wrun/wrun-style-words.util.js';
559
+ import { substituteWrunChartNames } from '../wrun/wrun-chart-names.util.js';
559
560
  import { wrunCornerLabelLook, wrunTextLookPayload } from '../wrun/wrun-text-look.util.js';
561
+ import { wrunPanelFrameNotices, } from '../wrun/wrun-frames.js';
560
562
  import { resolveWrunCustomTitle, wrunParamChoices, wrunParamWordsShape, wrunRunOverlayPalette, wrunVisibilityTargets, } from '../wrun/wrun-script-inputs.util.js';
561
563
  import { wrunCodedWords } from '../wrun/wrun-setting-words.util.js';
562
564
  import { decodeWrunPackedColor, isWrunStyleTargetHidden, wrunColorSettingString, wrunVisibilityOwnedOutputs, } from '../wrun/wrun-color-settings.util.js';
@@ -744,7 +746,13 @@ export function buildWrunRunResult(options) {
744
746
  // A strategy output exists only after a run, which loaded the shared host first.
745
747
  if (strategy !== undefined)
746
748
  budget.spend(wrunChartHostEnv().sharedHost().wrunStrategyWireBytes(strategy));
747
- return buildWrunRunResultWithSelection({ ...options, selection, handles, strategy }, memo);
749
+ const result = buildWrunRunResultWithSelection({ ...options, selection, handles, strategy }, memo);
750
+ // The HUD headline rides the result (the object as built: nothing keys it by identity yet), so a pane whose frame
751
+ // carries no rows can say why with the run's own words.
752
+ const headline = wrunHudHeadlineOf(options);
753
+ if (headline !== undefined)
754
+ result.headline = headline;
755
+ return result;
748
756
  }
749
757
  catch (error) {
750
758
  if (!(error instanceof Error) || !error.message.startsWith('wrun_frame_invalid:'))
@@ -769,6 +777,55 @@ export function buildWrunRunResult(options) {
769
777
  };
770
778
  }
771
779
  }
780
+ /**
781
+ * The run's HUD headline (WrunRunResult.headline): the first tile of `presentation.hud` declared `headline: true`
782
+ * (LK05, one per card; the first card that has one), read on the last ready row the way the latest-values snapshot
783
+ * reads it (wrun-overlay-run.util wrunLatestSnapshotOf): a `slot` tile's string slot text (the chart's names put in),
784
+ * else an `output` tile's value formatted like the card's (formatWrunNumber over the tile's `format`, the chart's
785
+ * price digits). Volatility Character's card names its character word this way ("Mean-reverting"). Undefined when no
786
+ * tile is a headline, no row is ready, or the row holds no text, a blank text or a non-finite value for it.
787
+ */
788
+ function wrunHudHeadlineOf(options) {
789
+ const cards = options.metadata.presentation?.hud;
790
+ if (!Array.isArray(cards))
791
+ return undefined;
792
+ let tile;
793
+ for (const card of cards) {
794
+ tile = (Array.isArray(card?.tiles) ? card.tiles : []).find((candidate) => candidate?.headline === true);
795
+ if (tile !== undefined)
796
+ break;
797
+ }
798
+ if (tile === undefined)
799
+ return undefined;
800
+ let last;
801
+ for (let at = options.rows.length - 1; at >= 0 && last === undefined; at -= 1) {
802
+ const row = options.rows[at];
803
+ if (row?.outputs !== null && row?.outputs !== undefined && Number.isFinite(row.ts))
804
+ last = row;
805
+ }
806
+ if (last === undefined)
807
+ return undefined;
808
+ let text;
809
+ if (typeof tile.slot === 'string') {
810
+ const slot = (options.metadata.string_slots ?? []).find((candidate) => candidate.name === tile.slot);
811
+ const raw = slot === undefined ? undefined : last.strings?.[slot.index];
812
+ if (typeof raw === 'string')
813
+ text = substituteWrunChartNames(raw, options.selectContext?.chartNames);
814
+ }
815
+ else if (typeof tile.output === 'string') {
816
+ const output = options.metadata.outputs.find((candidate) => candidate.name === tile.output);
817
+ const value = output === undefined ? undefined : last.outputs?.[output.index];
818
+ if (typeof value === 'number' && Number.isFinite(value)) {
819
+ const priceDigits = options.selectContext?.priceDigits;
820
+ text = formatWrunNumber(value, {
821
+ ...(typeof tile.format === 'string' ? { format: tile.format } : {}),
822
+ ...(priceDigits !== undefined ? { priceDigits } : {}),
823
+ });
824
+ }
825
+ }
826
+ const trimmed = text?.trim();
827
+ return trimmed ? trimmed : undefined;
828
+ }
772
829
  /** A run result's author-facing notices (every canvas child's, in child
773
830
  * order; a fresh array, empty when there are none). A run seam publishes
774
831
  * them as warning rows (wrun-canvases.util `wrunCanvasNoticeDiagnostics`). */
@@ -1204,6 +1261,56 @@ function wrunRowsCarryValue(rows, columns) {
1204
1261
  return typeof value === 'number' && Number.isFinite(value);
1205
1262
  }));
1206
1263
  }
1264
+ /** Each painted sheet's visibility targets, walked once: a live session builds every tick from one sheet. */
1265
+ const emptyTargetSheets = new WeakMap();
1266
+ /**
1267
+ * The Style targets a run drew nothing for (WrunRunResult.emptyTargets), in the visibility table's order. A drawn
1268
+ * output (a candle group as its first output, all four values on one row), a range (both edges on one row) or a fill
1269
+ * (both sides on one row) whose columns no ready row carries finite: the `rowsCarry` rule `omit_if_empty` mounts
1270
+ * by, so every declaration that rule left out is one, and so is a plain output an input switched off (NaN on every
1271
+ * row: it mounts and draws nothing). A `drawing` group target (a drawing, a segment, a handle kind) no delivered
1272
+ * record names. A target the market leaves out (`visible_by`) is never one: it mounts nothing whatever its values.
1273
+ * Not judged here: an inset output, a box and every `skip` target (renderers, canvases, levels, panels), whose own
1274
+ * builders hold whether they drew, and a shape's `shape_where` gate (its value column decides).
1275
+ */
1276
+ function wrunRunEmptyTargets(metadata, facts) {
1277
+ let targets = emptyTargetSheets.get(metadata);
1278
+ if (targets === undefined) {
1279
+ targets = wrunVisibilityTargets(metadata);
1280
+ emptyTargetSheets.set(metadata, targets);
1281
+ }
1282
+ const columnOf = (name) => typeof name === 'string' && !facts.hidden.has(name) ? facts.outputIndexByName.get(name) : undefined;
1283
+ const empty = [];
1284
+ for (const target of targets) {
1285
+ if (target.group === 'drawing') {
1286
+ if (!facts.drawn.has(target.target))
1287
+ empty.push(target.target);
1288
+ continue;
1289
+ }
1290
+ let columns;
1291
+ if (target.section === 'outputs' && target.group === 'nested') {
1292
+ const group = facts.candleGroupByOpen.get(target.target);
1293
+ columns =
1294
+ group === undefined || facts.hidden.has(target.target)
1295
+ ? [columnOf(target.target)]
1296
+ : group.map((member) => member.index);
1297
+ }
1298
+ else if (target.section === 'ranges') {
1299
+ columns = [columnOf(target.entry.upper), columnOf(target.entry.lower)];
1300
+ }
1301
+ else if (target.section === 'fills') {
1302
+ const between = Array.isArray(target.entry.between) ? target.entry.between : [];
1303
+ columns = between.length === 2 ? between.map(columnOf) : [undefined];
1304
+ }
1305
+ else {
1306
+ continue;
1307
+ }
1308
+ if (columns.every((column) => column !== undefined) && !facts.carries(columns)) {
1309
+ empty.push(target.target);
1310
+ }
1311
+ }
1312
+ return empty;
1313
+ }
1207
1314
  /** A payload with its declared look (WRUN-STYLE DW26) folded in: the frozen
1208
1315
  * fields keep their engine key order and their per-record values (a ladder
1209
1316
  * pick wins over the look's static word); the look adds every key the
@@ -3590,7 +3697,10 @@ function buildWrunRunResultWithSelection(options, memo) {
3590
3697
  // The batched marks (WRUN-BATCHED-MARKS): one row-backed child per marks, spans and rays section,
3591
3698
  // its rows read off the run's own rows by output index; a full build charges the cell budget
3592
3699
  // before any row is copied, a live tick builds its changed tail only.
3593
- childOverlays.push(...wrunBatchedMarksChildren(metadata, rows, options.batchedTailFromTs !== undefined ? { tailFromTs: options.batchedTailFromTs } : {}));
3700
+ childOverlays.push(...wrunBatchedMarksChildren(metadata, rows, {
3701
+ ...(options.batchedTailFromTs !== undefined ? { tailFromTs: options.batchedTailFromTs } : {}),
3702
+ ...(options.valuePerUnit !== undefined ? { valuePerUnit: options.valuePerUnit } : {}),
3703
+ }));
3594
3704
  childOverlays.push(...wrunProfileChildren(metadata, options.cellRows, {
3595
3705
  intervalMs: rowIntervalMs,
3596
3706
  outputRows: rows,
@@ -3839,12 +3949,32 @@ function buildWrunRunResultWithSelection(options, memo) {
3839
3949
  // A parent that homes in a declared pane takes that pane's scale look and
3840
3950
  // axis format on its own define (OT18 OT19).
3841
3951
  const homeDeclaration = homePane === undefined ? undefined : paneByName.get(homePane);
3842
- // Every canvas child's author-facing notices (a coarsened TPO), in child order, then a line per
3843
- // dropped entry (WrunRunNote), so the author sees why the fill is missing.
3952
+ // Every canvas child's author-facing notices (a coarsened TPO) and every panel's (a legend text drawn
3953
+ // clipped to its cap, wrun-frames), in child order, then a line per dropped entry (WrunRunNote), so the
3954
+ // author sees why the fill is missing.
3844
3955
  const notices = [
3845
- ...childOverlays.flatMap((child) => child.kind === 'heatmap' || child.kind === 'profile' || child.kind === 'matrix' ? (child.notices ?? []) : []),
3956
+ ...childOverlays.flatMap((child) => child.kind === 'heatmap' || child.kind === 'profile' || child.kind === 'matrix'
3957
+ ? (child.notices ?? [])
3958
+ : child.kind === 'panel'
3959
+ ? wrunPanelFrameNotices(child.frame)
3960
+ : []),
3846
3961
  ...runNotes.map((note) => note.message),
3847
3962
  ];
3963
+ // The Style targets this run drew nothing for (WrunRunResult.emptyTargets), read before the commit: a live
3964
+ // build's memo answers `rowsCarry` over these rows only until then.
3965
+ const drawnTargets = new Set();
3966
+ const paneDrawings = seriesChildren.flatMap((child) => child.kind === 'series' ? (child.result.drawings ?? []) : []);
3967
+ for (const drawing of [...drawings, ...paneDrawings]) {
3968
+ if (drawing.styleTarget !== undefined)
3969
+ drawnTargets.add(drawing.styleTarget);
3970
+ }
3971
+ const emptyTargets = wrunRunEmptyTargets(metadata, {
3972
+ carries: rowsCarry,
3973
+ hidden: hiddenOutputs,
3974
+ candleGroupByOpen,
3975
+ outputIndexByName,
3976
+ drawn: drawnTargets,
3977
+ });
3848
3978
  // The build completed: the memo now holds its units.
3849
3979
  memo?.commit();
3850
3980
  // The child list rides a wrun-4 result, a result with children, and every result of a sheet that declares
@@ -3860,6 +3990,7 @@ function buildWrunRunResultWithSelection(options, memo) {
3860
3990
  ...(carriesChildren ? { childOverlays } : {}),
3861
3991
  ...(notices.length > 0 ? { notices } : {}),
3862
3992
  ...(runNotes.length > 0 ? { notes: runNotes } : {}),
3993
+ ...(emptyTargets.length > 0 ? { emptyTargets } : {}),
3863
3994
  ...(drawings.length > 0 ||
3864
3995
  handleSet !== undefined ||
3865
3996
  metadata.drawings?.some((drawing) => drawing.kind === 'card' || drawing.kind === 'ladder' || drawing.kind === 'feed' || drawing.kind === 'meter')
@@ -5167,7 +5298,13 @@ const ENGINE_LABEL_Y_ALIGN = new Map([
5167
5298
  * from the anchored edge (left and top to the right and down, right and
5168
5299
  * bottom to the left and up, a centre axis signed: the rule titan's
5169
5300
  * paneAnchorOffset places every other anchored mark by), so x flips on a
5170
- * right anchor and y on a bottom one. */
5301
+ * right anchor and y on a bottom one. A top corner (top_left, top_center,
5302
+ * top_right) also carries `safeArea: 'chrome'`: titan moves that label down
5303
+ * by the host's card safe-area insets for its pane (`topLeft` on the left,
5304
+ * `topRight` on the centre and the right), so a note never draws behind the
5305
+ * chart's top chrome (the symbol title, interval pill and info button row
5306
+ * over the canvas). A kScript plotLabel never carries the flag, and the
5307
+ * hosted lane (om `wrunCornerLabelPayload`) sets the same one. */
5171
5308
  function cornerLabelPayload(label, position, color, size, offset, look) {
5172
5309
  const horizontal = position.includes('left') ? 'left' : position.includes('right') ? 'right' : 'center';
5173
5310
  const vertical = position.includes('top') ? 'top' : position.includes('bottom') ? 'bottom' : 'middle';
@@ -5191,5 +5328,6 @@ function cornerLabelPayload(label, position, color, size, offset, look) {
5191
5328
  y: vertical === 'bottom' ? flipped(payload.y) : payload.y,
5192
5329
  xAlign: ENGINE_LABEL_X_ALIGN.get(String(payload.xAlign)) ?? payload.xAlign,
5193
5330
  yAlign: ENGINE_LABEL_Y_ALIGN.get(String(payload.yAlign)) ?? payload.yAlign,
5331
+ ...(vertical === 'top' ? { safeArea: 'chrome' } : {}),
5194
5332
  };
5195
5333
  }
@@ -40,6 +40,13 @@ export declare function extractTokensFromTransformations(transformations: string
40
40
  symbol?: string;
41
41
  token: string;
42
42
  }[];
43
+ /**
44
+ * Whether any `EX|SYM` leg of a series formula sits on a venue `isVenue` accepts. The legs are walked the way the
45
+ * fetch path reads them (extractTokensFromTransformations), so a leg the chart loads is a leg this sees. It is the one
46
+ * leg walk the licence doors share: the chart-read and export policy, and the OPRA display boundary, for a main
47
+ * series formula and an overlay's alike. False for a missing or blank formula.
48
+ */
49
+ export declare function transformationsTouchVenue(transformations: unknown, isVenue: (exchange: string) => boolean): boolean;
43
50
  export declare function subscribeOverlayToLiveFeed(subscribeToEachLiveFeed: Function, params: {
44
51
  exchange: string;
45
52
  symbol: string;
@@ -299,6 +299,17 @@ export function extractTokensFromTransformations(transformations, allowDuplicate
299
299
  });
300
300
  return tokens;
301
301
  }
302
+ /**
303
+ * Whether any `EX|SYM` leg of a series formula sits on a venue `isVenue` accepts. The legs are walked the way the
304
+ * fetch path reads them (extractTokensFromTransformations), so a leg the chart loads is a leg this sees. It is the one
305
+ * leg walk the licence doors share: the chart-read and export policy, and the OPRA display boundary, for a main
306
+ * series formula and an overlay's alike. False for a missing or blank formula.
307
+ */
308
+ export function transformationsTouchVenue(transformations, isVenue) {
309
+ if (typeof transformations !== 'string' || !transformations.trim())
310
+ return false;
311
+ return extractTokensFromTransformations(transformations, true).some(({ exchange }) => typeof exchange === 'string' && isVenue(exchange));
312
+ }
302
313
  export function subscribeOverlayToLiveFeed(subscribeToEachLiveFeed, params, overlayId) {
303
314
  const multiSymbolExchanges = params?.multiSymbolExchanges;
304
315
  const tokens = isNil(multiSymbolExchanges) || multiSymbolExchanges.length === 0
@@ -0,0 +1,145 @@
1
+ /**
2
+ * The bars a grouped option read lays (OPTLOAD-READ-CONTRACT 3.2 to 3.4): the app's ONE mirror of tsdb-gateway's anchor
3
+ * rules, read at origin/main d83cbbf20 (pkg/tsdb/selects/option_read_shape.go `barAnchorRules`, `optionReadAnchorReads`,
4
+ * `OptionReadGridOf` and each rule's `fitTier`, `bar`, `session`, `boundary`, `barEnd` and `lays`;
5
+ * option_print_agg_group.go `optionPrintAggCMESessionScopes`; trade_agg.go `cmeRegularSessionAnchor` and
6
+ * `cmeEnergySessionAnchor`; cme.go `cmeSessionDay`, `cmeSessionOpen`, `cmeCurrentSessionLabel` and `isCMEGroupExchange`).
7
+ * Every option read that names a `barAnchor` takes the anchors, their bars, the venues they lay and the reads that take
8
+ * them from here: the strike and contract flow groupings (wrun-option-strike-flow.util), the flow scopes' bars
9
+ * (option-print-agg-scope.worker.util), the prints' per-bar cut (k-option-print.worker), the surface pick
10
+ * (k-option-surface.worker) and the delayed bound's grid (option-read-grid.util). The rules are keyed by pb-common's
11
+ * `BarAnchor`, so an anchor the protocol adds fails the type check until it has a rule here, and the class guard
12
+ * (tests/utility/options/option-bar-anchor.class.spec.ts) fails by name on any other module that names an anchor.
13
+ *
14
+ * - UTC: bars on the Unix epoch, every row counted; its session is the UTC date.
15
+ * - US_EQUITY_RTH, CME_RTH and CME_ENERGY_RTH: a regular session on the New York wall clock (09:30 to 16:00; 09:30 to
16
+ * 16:15, the CME platform session the CME candles keep; 09:00 to 14:30, the energy pit session), weekdays only, bars
17
+ * open + k * width, only rows of [open, close) counted, the last bar of a day short; no holiday is modelled, as the
18
+ * charts model none. The two CME anchors lay bars over the CME group's rows alone, built from tiers dividing 15 and 30
19
+ * minutes; daylight saving comes from the tz database on both sides.
20
+ * - CME_SESSION: the Globex trade date (17:00 Chicago opens the next; a weekday holiday's session belongs to the next
21
+ * trade date on the CME calendar, a weekend day keeps its own date), each bar stamped at the 17:00 open of its first
22
+ * session day; a 604,800 s bar is the ISO week of a trade date. The CME group's alone, taken by OPTION_PRINT_AGG's
23
+ * COIN, MARKET, STRIKE, EXPIRY, EXPIRY_STRIKE and CONTRACT scopes alone, from a tier dividing an hour. It drops no
24
+ * row: an always-on root's weekend rows land on their own dates, as the chart's lattice books them.
25
+ *
26
+ * A decider proves an anchor's bars against the chart's own: a bucket the anchor lays no bar for may fall on a chart bar
27
+ * only where the chart's product holds no trading (`optionChartClosedAt`, its schedule), never because the anchor's own
28
+ * hours leave it out (a CME regular session's weekend on an always-on root).
29
+ *
30
+ * Pure and worker-safe: the zone clock (ny-calendar.util), the CME lattice's trade calendar (cme-session-bucket.util) and
31
+ * the CME products' schedules (market-session-schedule.util).
32
+ */
33
+ import { BarAnchor } from '@orangecharts/orange-v2-pb-common';
34
+ /** pb-common `BarAnchor` by name: the values a request names (the gateway decodes JSON enums as numbers). */
35
+ export declare const OPTION_BAR_ANCHOR: Readonly<{
36
+ readonly UTC: BarAnchor.UTC;
37
+ readonly US_EQUITY_RTH: BarAnchor.US_EQUITY_RTH;
38
+ readonly CME_SESSION: BarAnchor.CME_SESSION;
39
+ readonly CME_RTH: BarAnchor.CME_RTH;
40
+ readonly CME_ENERGY_RTH: BarAnchor.CME_ENERGY_RTH;
41
+ }>;
42
+ /** A read that names `barAnchor`, as the gateway registers it: its type, and on OPTION_PRINT_AGG its scope. */
43
+ export type OptionBarAnchorRead = 'OPTION_PRINT_AGG/COIN' | 'OPTION_PRINT_AGG/MARKET' | 'OPTION_PRINT_AGG/VENUE' | 'OPTION_PRINT_AGG/PRINTS' | 'OPTION_PRINT_AGG/STRIKE' | 'OPTION_PRINT_AGG/EXPIRY' | 'OPTION_PRINT_AGG/EXPIRY_STRIKE' | 'OPTION_PRINT_AGG/CONTRACT' | 'OPTION_PRINT' | 'OPTION_SURFACE' | 'OPTION_STRIKE_AGG' | 'OPTION_STRIKE_FLOW_AGG';
44
+ /** A regular session on a wall clock: its zone, and its open and close as minutes after the zone's midnight. */
45
+ export interface OptionBarAnchorSession {
46
+ zone: string;
47
+ openMinutes: number;
48
+ closeMinutes: number;
49
+ }
50
+ /** One anchor's rule: the gateway's `barAnchorRule` and what admits it (`optionReadAnchorReads`, `lays`). */
51
+ export interface OptionBarAnchorRule {
52
+ readonly anchor: BarAnchor;
53
+ /** pb-common's name of the anchor (the read shape's words name it). */
54
+ readonly name: string;
55
+ /** The trade date its sessions key by (`sessionKeySQL`): a zone's wall clock plus hours, cut to a date. */
56
+ readonly tradeDate: Readonly<{
57
+ zone: string;
58
+ offsetHours: number;
59
+ }>;
60
+ /** The regular session it lays (the three RTH anchors); undefined for UTC and CME_SESSION. */
61
+ readonly session?: Readonly<OptionBarAnchorSession>;
62
+ /** The venues it lays bars over: every venue's rows, or the CME group's alone. */
63
+ readonly venues: 'every' | 'cme';
64
+ /** Whether it lays bars over an exchange's rows (`lays`); a read reaching any other venue is refused by name. */
65
+ lays(exchange: unknown): boolean;
66
+ /** Whether a read takes it (`optionReadAnchorReads`): every read naming `barAnchor`, but CME_SESSION's few. */
67
+ takes(read: OptionBarAnchorRead): boolean;
68
+ /** Whether a tier `tierMs` wide builds its bars `barMs` wide (0: the tier's own buckets), or sessions (`fitTier`). */
69
+ fitsTier(tierMs: number, barMs: number, session: boolean): boolean;
70
+ /** The open of the bar `barMs` wide holding `tMs` (`tMs` itself at 0), null where it lands in none (`bar`). */
71
+ barOpenMs(tMs: number, barMs: number): number | null;
72
+ /** The open of the session `tMs` trades in, null where none (`session`). */
73
+ sessionOpenMs(tMs: number): number | null;
74
+ /** Whether a window may start or end at `tMs` without splitting a bar or a session (`boundary`). */
75
+ isBoundary(tMs: number, barMs: number, session: boolean): boolean;
76
+ /** The latest instant at or before `tMs` a window may end at: a boundary. */
77
+ floorBoundaryMs(tMs: number, barMs: number, session: boolean): number;
78
+ /** The end of the bar (or session) stamped `openMs` (`barEnd`). */
79
+ barEndMs(openMs: number, barMs: number, session: boolean): number;
80
+ }
81
+ /** Every anchor's rule, by pb-common's value (`barAnchorRules`): a value without a rule fails the type check. */
82
+ export declare const OPTION_BAR_ANCHOR_RULES: Readonly<Record<BarAnchor, OptionBarAnchorRule>>;
83
+ /** The rule of an anchor value, or undefined for a value no rule lays (the gateway refuses it by name). */
84
+ export declare function optionBarAnchorRuleOf(anchor: unknown): OptionBarAnchorRule | undefined;
85
+ /**
86
+ * The anchors a read takes on a venue, in pb-common's order: every anchor the read takes that lays every venue's rows,
87
+ * and one laid over a venue group's alone only when the read names a venue of that group (`exchange`, the chain's): the
88
+ * gateway refuses a CME anchor by name on any other venue (OPRA, Deribit) and on a read that names none.
89
+ */
90
+ export declare function optionBarAnchorsTaken(read: OptionBarAnchorRead, exchange?: string): OptionBarAnchorRule[];
91
+ /**
92
+ * Where a bar proof may drop a bucket the chart lays a bar for: only at an instant the chart's own product holds no
93
+ * trading at, by its schedule (market-session-schedule.util `isGovernedFuturesSymbolOpenAt`). This is the one drop
94
+ * exemption every decider proves an anchor's bars with (the strike and contract flow groupings, the flow scopes' bars,
95
+ * the prints' per-bar cut). An anchor's own hours are not it: a CME regular session lays no bar on a weekend day, which a
96
+ * weekday product's regular-hours chart lays empty bars for, while an always-on root (crypto since 2026-05-29, 1OZ since
97
+ * 2026-07-24) trades through it. So on an always-on root's chart the session lands on no bars that hold weekend rows,
98
+ * and the decider falls back (UTC bars where they land, else today's fold). A chart off the CME group has no schedule
99
+ * here, so nothing it lays may be dropped.
100
+ */
101
+ export declare function optionChartClosedAt(grid: {
102
+ exchange?: unknown;
103
+ symbol?: unknown;
104
+ } | null | undefined): (tMs: number) => boolean;
105
+ /** A chain's trade-date clock, as option-trade-date.util decides it. */
106
+ export interface OptionBarAnchorClock {
107
+ zone: string;
108
+ rule: {
109
+ offsetHours: number;
110
+ weekendsToMonday?: true;
111
+ };
112
+ }
113
+ /**
114
+ * The anchor whose sessions are a chain's trade dates (contract 3.4), or undefined where none is: the first anchor the
115
+ * read takes on the venue whose session key (`tradeDate`) is the clock's own rule, a clock that moves its weekends to
116
+ * Monday matching none. New York's clock reads US_EQUITY_RTH's sessions, the UTC date UTC's, the Globex trade date
117
+ * (Chicago's wall clock plus 7 hours) CME_SESSION's on a CME group venue; a CME crypto root's clock (16:00 Chicago,
118
+ * weekends on Monday) is no anchor's.
119
+ */
120
+ export declare function optionSessionAnchorOf(clock: OptionBarAnchorClock, read: OptionBarAnchorRead, exchange?: string): OptionBarAnchorRule | undefined;
121
+ /** Where a grouped read's rows land (`OptionReadGrid`): bars `seconds` wide laid by `anchor`, or with `session` one
122
+ * group per trade date of the anchor. */
123
+ export interface OptionBarAnchorGrid {
124
+ anchor: BarAnchor;
125
+ seconds: number;
126
+ session: boolean;
127
+ }
128
+ /**
129
+ * The grid an `optionRead` groups on (`OptionReadGridOf`), or null when it groups nothing (no `barSeconds`, span BAR). A
130
+ * day bar is a UTC day's row on UTC and US_EQUITY_RTH, and keeps its anchor on every other (a trade date on
131
+ * CME_SESSION).
132
+ */
133
+ export declare function optionBarAnchorGridOf(shape: unknown): OptionBarAnchorGrid | null;
134
+ /** The open of the bar (or session) holding `tMs` on a grid (`OptionReadGrid.Bar`), null where it lands in none or
135
+ * where no rule lays the grid's anchor. */
136
+ export declare function optionGridBarOpenMs(grid: OptionBarAnchorGrid, tMs: number): number | null;
137
+ /** Whether a window may start or end at `tMs` on a grid (`OptionReadGrid.Boundary`); an anchor no rule lays splits
138
+ * nothing. */
139
+ export declare function optionGridIsBoundary(grid: OptionBarAnchorGrid, tMs: number): boolean;
140
+ /** The latest instant at or before `tMs` a window may end at on a grid, so a window cut there ends with its last whole
141
+ * bar. */
142
+ export declare function optionGridFloorBoundaryMs(grid: OptionBarAnchorGrid, tMs: number): number;
143
+ /** The first instant at or after `tMs` a window may start or end at on a grid (`OptionReadGrid.Ceil`): `tMs` on a
144
+ * boundary, else the end of the bar (or session) holding it, or of the bar after it, until one ends on a boundary. */
145
+ export declare function optionGridCeilBoundaryMs(grid: OptionBarAnchorGrid, tMs: number): number;