@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
@@ -40,8 +40,7 @@ export const WRUN_BROWSER_BUILTIN_SOURCE_CLASSES = [
40
40
  'options_chain',
41
41
  // USD order-size bucketed flow per bar over the chart's K_TRADE_VOLUME_BY_SIZE lane (celled).
42
42
  'trade_volume_by_size',
43
- // The raw prints per bar over the K_TRADES lane (celled): history from TRADE_LARGE, live from
44
- // the raw TRADE channel (wrun-tape-source.util).
43
+ // The big trades per bar (celled): TRADE_LARGE rows, history and live (wrun-tape-source.util).
45
44
  'tape',
46
45
  ];
47
46
  /**
@@ -7,3 +7,15 @@ export declare const BUILTIN_TWIN_OF_SETTING = "builtinTwinOf";
7
7
  * a settings value: read alone, any package could claim a built-in's saved
8
8
  * values, guide, one-per-chart rule and theme by carrying it. */
9
9
  export declare function builtinTwinOf(settings: unknown): string | undefined;
10
+ /** The built-in whose port a registry overlay RUNS, stamp or not: the stamp when
11
+ * it is one (builtinTwinOf), else the built-in the package itself ports
12
+ * (BUILTIN_TWIN_PORTS). The run contract reads this one, the stamp readers
13
+ * above keep the stamp: the Timeframe rule (a selection at or below the chart
14
+ * runs the plain chart path), the lookback the run-interval warm-up sizes from
15
+ * and the alert arm's guards are properties of the package's code, the same
16
+ * through every door (the Indicators list stamps, the store page, a share, a
17
+ * template, the CLI and the agent do not). Read by the stamp alone, the store's
18
+ * copy of an R3 port took a Timeframe finer than the chart as-is, aborted with
19
+ * the engine's words and never drew again after a reload. Undefined for a
20
+ * package that ports no built-in and for anything without a registry identity. */
21
+ export declare function builtinPortOf(settings: unknown): string | undefined;
@@ -38,3 +38,24 @@ export function builtinTwinOf(settings) {
38
38
  return undefined;
39
39
  return builtinTwinOfPackage(packageName) === stamp ? stamp : undefined;
40
40
  }
41
+ /** The built-in whose port a registry overlay RUNS, stamp or not: the stamp when
42
+ * it is one (builtinTwinOf), else the built-in the package itself ports
43
+ * (BUILTIN_TWIN_PORTS). The run contract reads this one, the stamp readers
44
+ * above keep the stamp: the Timeframe rule (a selection at or below the chart
45
+ * runs the plain chart path), the lookback the run-interval warm-up sizes from
46
+ * and the alert arm's guards are properties of the package's code, the same
47
+ * through every door (the Indicators list stamps, the store page, a share, a
48
+ * template, the CLI and the agent do not). Read by the stamp alone, the store's
49
+ * copy of an R3 port took a Timeframe finer than the chart as-is, aborted with
50
+ * the engine's words and never drew again after a reload. Undefined for a
51
+ * package that ports no built-in and for anything without a registry identity. */
52
+ export function builtinPortOf(settings) {
53
+ const stamped = builtinTwinOf(settings);
54
+ if (stamped !== undefined)
55
+ return stamped;
56
+ if (!settings || typeof settings !== 'object')
57
+ return undefined;
58
+ const ref = settings.wrunRegistryRef;
59
+ const packageName = ref && typeof ref === 'object' ? ref.package : undefined;
60
+ return typeof packageName === 'string' && packageName !== '' ? builtinTwinOfPackage(packageName) : undefined;
61
+ }
@@ -30,9 +30,10 @@
30
30
  * other market the chart serves, all priced per unit (spot,
31
31
  * perpetuals, stocks, ETFs, forex, indices, metals, prediction
32
32
  * markets, economic series).
33
- * zone om's venue rule: US listings and POLYGON_INDICES New York,
34
- * the CME family Chicago, LBMA and LME London, every other
35
- * venue 0 (UTC, the clock every 24/7 market keeps).
33
+ * zone om's venue rule: US listings, POLYGON_INDICES and forex
34
+ * (FX_OTC, POLYGON_FX) New York, the CME family Chicago, LBMA
35
+ * and LME London, every other venue 0 (UTC, the clock every
36
+ * 24/7 market keeps).
36
37
  * quote_is_usd the row's quote (`quoteAssetId`, else `quoteCoinName`): USD
37
38
  * 1, anything else 2, a dollar stablecoin included; without
38
39
  * one, US listings and POLYGON_INDICES 1, then the market's
@@ -41,16 +42,22 @@
41
42
  * tail of the directory's normalized symbol `BTC-USDT`), else 0.
42
43
  * session_open om's venue rule: the minute on the venue's clock its trade day
43
44
  * opens, 1020 (17:00 Chicago, WRUN_MARKET_SESSION_OPEN_CME) for
44
- * the CME family, the zone's Chicago branch, else 0 (midnight).
45
+ * the CME family, the zone's Chicago branch, 1020 (17:00 New
46
+ * York, WRUN_MARKET_SESSION_OPEN_FOREX) for forex, whose day
47
+ * runs 17:00 to 17:00 New York, else 0 (midnight).
45
48
  *
46
49
  * Beside the five the host fill carries `market.option_multiplier()` (kit 0.87.0,
47
50
  * om WRUN_OPTION_FACT_FILLS, which only the chart's browser lane fills): the US
48
51
  * dollars one price unit times one size unit of an option on the chart's options
49
- * chain is worth, 100 on OPRA, the CME root's point value, 1 on a crypto chart,
50
- * else 0 (wrunChartOptionMultiplier); and `market.dollar_multiplier()` (kit 0.95.0):
52
+ * chain is worth, 100 on OPRA (a stock twin reading its stock's OPRA chain too:
53
+ * the `optionsExchange` fact), the CME root's point value, 1 on a crypto chart,
54
+ * else 0 (wrunChartOptionMultiplier); `market.dollar_multiplier()` (kit 0.95.0):
51
55
  * the US dollars one size unit of the market's own trades at one price unit is
52
56
  * worth, the market's proven dollar unit (wrunMarketDollarUnit: the CME
53
- * registry's point value, NQ 20; 1 on a market quoted in dollars), else 0.
57
+ * registry's point value, NQ 20; 1 on a market quoted in dollars), else 0; and
58
+ * `market.option_contract()` (C5, a kit word by 0.102.0): 1 when the chart's
59
+ * market is one option contract (an OPRA contract, a CME or crypto option), else
60
+ * 0 (wrunChartOptionContract), so no recipe guesses it from price distance.
54
61
  *
55
62
  * The 0 rule: a fact the chart does not know is 0, never a guess. Main thread
56
63
  * only (the directory read goes through the markets service); the hosted lanes
@@ -58,6 +65,7 @@
58
65
  */
59
66
  import type { WrunMarketKind, WrunMarketQuoteIsUsd } from '@orangecharts/indicator-kit';
60
67
  import type { WrunVenueLegsResult } from '../../host-ports.types.js';
68
+ import type { CmeExchangeDto } from '../../interfaces/cme-realtime.interface.js';
61
69
  import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
62
70
  /** The five facts one run reads, as the codes the module sees. */
63
71
  export interface WrunMarketFacts {
@@ -72,10 +80,13 @@ export interface WrunMarketFacts {
72
80
  /** The minute on the market's clock its trade day opens (0 midnight). */
73
81
  sessionOpen: number;
74
82
  }
75
- /** The option fact the host fill carries beside the five (om WRUN_OPTION_FACT_FILLS, kit 0.87.0). */
83
+ /** The option facts the host fill carries beside the five: the option multiplier (om WRUN_OPTION_FACT_FILLS, kit
84
+ * 0.87.0) and whether the chart is one option contract (C5, `market.option_contract()`). */
76
85
  export interface WrunOptionFacts {
77
86
  /** The US dollars one price unit times one size unit of an option on the chart's options chain is worth (0 none). */
78
87
  optionMultiplier: number;
88
+ /** 1 when the chart's market is one option contract, else 0 (wrunChartOptionContract). */
89
+ optionContract: number;
79
90
  }
80
91
  /** The trade value fact the host fill carries beside the five (kit 0.95.0, `market.dollar_multiplier()`). */
81
92
  export interface WrunDollarFacts {
@@ -90,6 +101,10 @@ export interface WrunFactsMarket {
90
101
  category?: unknown;
91
102
  /** A continuous CME chart's lead contract as the chart stamped it (`ESZ6` under `ES1!`), when it did. */
92
103
  resolvedContract?: unknown;
104
+ /** The exchange of the market whose options the chart reads, as the options seam names it (web:
105
+ * opra-options-gate.util `chartOptionsMarket`): a stock twin's US stock venue (POLYGON) while the opra flag is lit.
106
+ * Absent: the chart's own exchange (every other market answers itself). Read by `wrunChartOptionMultiplier` alone. */
107
+ optionsExchange?: unknown;
93
108
  }
94
109
  /** The directory row fields the facts read, duck-typed like om's (the wire
95
110
  * carries `assetClass` and `quoteAssetId` beside the declared type). */
@@ -106,9 +121,13 @@ export interface CmeRootSpec {
106
121
  pointValue: number;
107
122
  /** The quotation currency of the price the chart draws. */
108
123
  quote: WrunMarketQuoteIsUsd;
124
+ /** The CME Group exchange the root lists on (its contracts and its options). */
125
+ exchange: CmeExchangeDto;
109
126
  }
110
127
  /** Read-only outside this module: the paper venue reads each contract's point value from it. */
111
128
  export declare const CME_ROOT_SPECS: Readonly<Record<string, Readonly<CmeRootSpec>>>;
129
+ /** The CME Group exchange a futures root lists on (`CME_ROOT_SPECS`), or undefined for a root off the table. */
130
+ export declare function wrunCmeRootExchange(root: string): CmeExchangeDto | undefined;
112
131
  /**
113
132
  * The five facts the chart fills for `market` (the module doc): om's rules
114
133
  * over the directory `row` (undefined when the chart has none: not read, not
@@ -131,8 +150,9 @@ export declare const WRUN_DOLLAR_MULTIPLIER_UNPROVEN_CODE = "wrun_dollar_multipl
131
150
  * CME a CME-governed chart reads the chain of its own root: the root's point value (CME_ROOT_SPECS, ES 50,
132
151
  * NQ 20) when the root is quoted in US dollars; a root off the table, or quoted in another unit (a CBOT
133
152
  * grain quotes US cents), is 0.
134
- * OPRA a chart whose options list on OPRA (the venue table: an OPRA contract chart, a US stock or ETF chart):
135
- * 100.
153
+ * OPRA a chart whose options list on OPRA (the venue table over the options seam's market, `optionsExchange`
154
+ * else the chart's own: an OPRA contract chart, a US stock or ETF chart, a stock twin while the opra flag
155
+ * is lit): 100.
136
156
  * crypto a chart on a crypto exchange, whichever venue and category (isCryptoChartVenue): its chain, when it has
137
157
  * one, is a crypto chain (its own option venue's, the coin's Deribit chain, or another crypto venue's that
138
158
  * lists the coin), priced in dollars per coin on every venue: 1. A crypto chart with no chain serves no
@@ -146,11 +166,33 @@ export declare const WRUN_DOLLAR_MULTIPLIER_UNPROVEN_CODE = "wrun_dollar_multipl
146
166
  * multiply). Pure.
147
167
  */
148
168
  export declare function wrunChartOptionMultiplier(market: WrunFactsMarket | undefined): number;
169
+ /** The host_fill word of `market.option_contract()` (C5), a WrunParamHostFill word of the kit the chart pins
170
+ * (0.102.0). The host fills the hidden param `market_option_contract` by this word, never by a slot, so a package
171
+ * compiled without the word keeps every init slot and no scaffold bump is needed. */
172
+ export declare const WRUN_OPTION_CONTRACT_FILL = "option_contract";
173
+ /**
174
+ * `market.option_contract()` of the chart market `market` (C5): 1 when the chart is one option contract, else 0. A
175
+ * recipe that marks the underlying's prices (Option Prints) reads it to draw no marks on a contract's own price axis,
176
+ * instead of guessing from price distance. The add door's identity (cme-option-indicator-availability.util
177
+ * isOptionContractChart, which the option-contract indicator refusals read), widened to the crypto option venues:
178
+ *
179
+ * OPRA every chart on the OPRA venue is one contract, a document saved without its category included.
180
+ * CME a chart whose category is OPTION (`ESZ6 C6000`): the category tells the contract from the future on the
181
+ * same venue (ESZ6, ES1!).
182
+ * crypto a chart whose category is OPTION, or one on a plain option venue whose symbol the venue's grammar parses
183
+ * (isPlainOptionContract: Deribit `BTC-25DEC26-100000-C`), so a contract saved without its category still
184
+ * reads 1 and the venue's perpetual (`BTC-PERPETUAL`) reads 0.
185
+ * else 0: a stock or ETF (SPY/USD, an options underlying), a future, a perpetual, spot, forex, an index, an
186
+ * economic series, a prediction market, an unknown venue, no market.
187
+ *
188
+ * The chart metadata alone decides, synchronously and with no read, like the option multiplier. Pure.
189
+ */
190
+ export declare function wrunChartOptionContract(market: WrunFactsMarket | undefined): number;
149
191
  /** True when the sheet declares one of the market's facts (a host-filled
150
192
  * param on `kind`, `point_value`, `zone`, `quote_is_usd`, `session_open`,
151
- * `option_multiplier` or `dollar_multiplier`): the runs whose host fill
152
- * carries the market's facts. Only a sheet that declares a directory fact
153
- * waits for the read (wrunMarketFactsNeedDirectory). */
193
+ * `option_multiplier`, `dollar_multiplier` or `option_contract`): the runs
194
+ * whose host fill carries the market's facts. Only a sheet that declares a
195
+ * directory fact waits for the read (wrunMarketFactsNeedDirectory). */
154
196
  export declare function wrunReadsMarketFacts(metadata: Pick<WrunIndicatorMetadata, 'params'> | undefined): boolean;
155
197
  /** True when the sheet reads the market's dollar multiplier (a host-filled param on `dollar_multiplier`, kit
156
198
  * 0.95.0): its run proves the market's dollar unit at its head before any fetch (wrun-overlay-run.util), so its
@@ -269,9 +311,11 @@ export declare function wrunMarketFactsSettled(market: WrunFactsMarket | undefin
269
311
  /** The facts the chart fills for `market` now (synchronous): the five over the
270
312
  * directory row once warmWrunMarketFacts settled it, else without one, the
271
313
  * option multiplier of its options chain (wrunChartOptionMultiplier: the
272
- * venue tables alone, no read) and the dollar multiplier of its own trades
273
- * (wrunMarketDollarUnit over the reads warmWrunMarketDollarFacts settled; 0
274
- * while it is not proven). */
314
+ * venue tables alone, no read), whether it is one option contract
315
+ * (wrunChartOptionContract: its metadata alone, no read) and the dollar
316
+ * multiplier of its own trades (wrunMarketDollarUnit over the reads
317
+ * warmWrunMarketDollarFacts settled; 0 while it is not proven). Every word is
318
+ * written on every market, 0 included, so the block keeps one shape. */
275
319
  export declare function wrunMarketFactsFor(market: WrunFactsMarket | undefined): WrunMarketFacts & WrunOptionFacts & WrunDollarFacts;
276
320
  /**
277
321
  * What the instrument registry (StreamRegistryMetadatas, the metadata service's `getSymbolMetadata`) proves about one
@@ -30,9 +30,10 @@
30
30
  * other market the chart serves, all priced per unit (spot,
31
31
  * perpetuals, stocks, ETFs, forex, indices, metals, prediction
32
32
  * markets, economic series).
33
- * zone om's venue rule: US listings and POLYGON_INDICES New York,
34
- * the CME family Chicago, LBMA and LME London, every other
35
- * venue 0 (UTC, the clock every 24/7 market keeps).
33
+ * zone om's venue rule: US listings, POLYGON_INDICES and forex
34
+ * (FX_OTC, POLYGON_FX) New York, the CME family Chicago, LBMA
35
+ * and LME London, every other venue 0 (UTC, the clock every
36
+ * 24/7 market keeps).
36
37
  * quote_is_usd the row's quote (`quoteAssetId`, else `quoteCoinName`): USD
37
38
  * 1, anything else 2, a dollar stablecoin included; without
38
39
  * one, US listings and POLYGON_INDICES 1, then the market's
@@ -41,16 +42,22 @@
41
42
  * tail of the directory's normalized symbol `BTC-USDT`), else 0.
42
43
  * session_open om's venue rule: the minute on the venue's clock its trade day
43
44
  * opens, 1020 (17:00 Chicago, WRUN_MARKET_SESSION_OPEN_CME) for
44
- * the CME family, the zone's Chicago branch, else 0 (midnight).
45
+ * the CME family, the zone's Chicago branch, 1020 (17:00 New
46
+ * York, WRUN_MARKET_SESSION_OPEN_FOREX) for forex, whose day
47
+ * runs 17:00 to 17:00 New York, else 0 (midnight).
45
48
  *
46
49
  * Beside the five the host fill carries `market.option_multiplier()` (kit 0.87.0,
47
50
  * om WRUN_OPTION_FACT_FILLS, which only the chart's browser lane fills): the US
48
51
  * dollars one price unit times one size unit of an option on the chart's options
49
- * chain is worth, 100 on OPRA, the CME root's point value, 1 on a crypto chart,
50
- * else 0 (wrunChartOptionMultiplier); and `market.dollar_multiplier()` (kit 0.95.0):
52
+ * chain is worth, 100 on OPRA (a stock twin reading its stock's OPRA chain too:
53
+ * the `optionsExchange` fact), the CME root's point value, 1 on a crypto chart,
54
+ * else 0 (wrunChartOptionMultiplier); `market.dollar_multiplier()` (kit 0.95.0):
51
55
  * the US dollars one size unit of the market's own trades at one price unit is
52
56
  * worth, the market's proven dollar unit (wrunMarketDollarUnit: the CME
53
- * registry's point value, NQ 20; 1 on a market quoted in dollars), else 0.
57
+ * registry's point value, NQ 20; 1 on a market quoted in dollars), else 0; and
58
+ * `market.option_contract()` (C5, a kit word by 0.102.0): 1 when the chart's
59
+ * market is one option contract (an OPRA contract, a CME or crypto option), else
60
+ * 0 (wrunChartOptionContract), so no recipe guesses it from price distance.
54
61
  *
55
62
  * The 0 rule: a fact the chart does not know is 0, never a guess. Main thread
56
63
  * only (the directory read goes through the markets service); the hosted lanes
@@ -62,8 +69,10 @@ import { isCmeGoverned } from '../chart/cme-realtime.util.js';
62
69
  import { isContinuousSymbol } from '../chart/continuous-contracts.util.js';
63
70
  import { governedContractCoin } from '../chart/governed-contract-coin.util.js';
64
71
  import { checkIsEconomic, getMarketKind } from '../chart/marketKind.util.js';
65
- import { optionVenueForExchange, optionVenueForUnderlyingExchange } from '../options/option-venue.util.js';
66
- import { WRUN_LANE_CURRENCY_AUTO, WRUN_MARKET_FACT_FILLS, WRUN_MARKET_KINDS, WRUN_MARKET_QUOTE_IS_USD, WRUN_MARKET_SESSION_OPEN_CME, wrunLaneCurrency, wrunMarketSizeUnit, wrunMarketZoneCode, wrunCoinLegSource, wrunFollowsCoin, wrunRowVisibleHere, wrunVisibleByNeedsKind, } from './wrun-market-facts.util.js';
72
+ import { optionsMarketUnderlyingVenue, optionVenueForExchange } from '../options/option-venue.util.js';
73
+ import { isPlainOptionContract } from '../options/option-trade-units.util.js';
74
+ import { isOpraGoverned } from '../v2/opra-governed.util.js';
75
+ import { WRUN_LANE_CURRENCY_AUTO, WRUN_MARKET_FACT_FILLS, WRUN_MARKET_KINDS, WRUN_MARKET_QUOTE_IS_USD, WRUN_MARKET_SESSION_OPEN_CME, WRUN_MARKET_SESSION_OPEN_FOREX, wrunLaneCurrency, wrunMarketSizeUnit, wrunMarketZoneCode, wrunCoinLegSource, wrunFollowsCoin, wrunRowVisibleHere, wrunVisibleByNeedsKind, } from './wrun-market-facts.util.js';
67
76
  import { isWrunLegStreamClass } from './wrun-leg-stream-classes.js';
68
77
  import { isTradesDollarQuoteAsset } from '../../kscript-data/controls/live-trades-merge.util.js';
69
78
  import { getExchangeFromSymbol } from '../../helpers/data.helpers.js';
@@ -174,54 +183,59 @@ const UNKNOWN_MULTIPLIER_EXCHANGES = new Set(['ICE', 'PLATTS']);
174
183
  /** Read-only outside this module: the paper venue reads each contract's point value from it. */
175
184
  export const CME_ROOT_SPECS = {
176
185
  // Equity index futures, quoted in index points: the dollar multiplier.
177
- ES: { kind: 'index', pointValue: 50, quote: 'usd' }, // $50 x S&P 500: equities/sp/e-mini-sandp500
178
- MES: { kind: 'index', pointValue: 5, quote: 'usd' }, // $5 x S&P 500: equities/sp/micro-e-mini-sandp-500
179
- NQ: { kind: 'index', pointValue: 20, quote: 'usd' }, // $20 x Nasdaq-100: equities/nasdaq/e-mini-nasdaq-100
180
- MNQ: { kind: 'index', pointValue: 2, quote: 'usd' }, // $2 x Nasdaq-100: equities/nasdaq/micro-e-mini-nasdaq-100
181
- RTY: { kind: 'index', pointValue: 50, quote: 'usd' }, // $50 x Russell 2000: equities/russell/e-mini-russell-2000
182
- M2K: { kind: 'index', pointValue: 5, quote: 'usd' }, // $5 x Russell 2000: equities/russell/micro-e-mini-russell-2000
183
- YM: { kind: 'index', pointValue: 5, quote: 'usd' }, // $5 x DJIA: equities/dow-jones/e-mini-dow
184
- MYM: { kind: 'index', pointValue: 0.5, quote: 'usd' }, // $0.50 x DJIA: equities/dow-jones/micro-e-mini-dow
186
+ ES: { kind: 'index', pointValue: 50, quote: 'usd', exchange: 'CME' }, // $50 x S&P 500: equities/sp/e-mini-sandp500
187
+ MES: { kind: 'index', pointValue: 5, quote: 'usd', exchange: 'CME' }, // $5 x S&P 500: equities/sp/micro-e-mini-sandp-500
188
+ NQ: { kind: 'index', pointValue: 20, quote: 'usd', exchange: 'CME' }, // $20 x Nasdaq-100: equities/nasdaq/e-mini-nasdaq-100
189
+ MNQ: { kind: 'index', pointValue: 2, quote: 'usd', exchange: 'CME' }, // $2 x Nasdaq-100: equities/nasdaq/micro-e-mini-nasdaq-100
190
+ RTY: { kind: 'index', pointValue: 50, quote: 'usd', exchange: 'CME' }, // $50 x Russell 2000: equities/russell/e-mini-russell-2000
191
+ M2K: { kind: 'index', pointValue: 5, quote: 'usd', exchange: 'CME' }, // $5 x Russell 2000: equities/russell/micro-e-mini-russell-2000
192
+ YM: { kind: 'index', pointValue: 5, quote: 'usd', exchange: 'CBOT' }, // $5 x DJIA: equities/dow-jones/e-mini-dow
193
+ MYM: { kind: 'index', pointValue: 0.5, quote: 'usd', exchange: 'CBOT' }, // $0.50 x DJIA: equities/dow-jones/micro-e-mini-dow
185
194
  // FX futures, quoted in US dollars per unit of the foreign currency (6J per yen, 0.00xxxx).
186
- '6E': { kind: 'forex', pointValue: 125_000, quote: 'usd' }, // 125,000 euro: fx/g10/euro-fx
187
- '6B': { kind: 'forex', pointValue: 62_500, quote: 'usd' }, // 62,500 pounds: fx/g10/british-pound
188
- '6J': { kind: 'forex', pointValue: 12_500_000, quote: 'usd' }, // 12,500,000 yen: fx/g10/japanese-yen
189
- '6C': { kind: 'forex', pointValue: 100_000, quote: 'usd' }, // 100,000 CAD: fx/g10/canadian-dollar
195
+ '6E': { kind: 'forex', pointValue: 125_000, quote: 'usd', exchange: 'CME' }, // 125,000 euro: fx/g10/euro-fx
196
+ '6B': { kind: 'forex', pointValue: 62_500, quote: 'usd', exchange: 'CME' }, // 62,500 pounds: fx/g10/british-pound
197
+ '6J': { kind: 'forex', pointValue: 12_500_000, quote: 'usd', exchange: 'CME' }, // 12,500,000 yen: fx/g10/japanese-yen
198
+ '6C': { kind: 'forex', pointValue: 100_000, quote: 'usd', exchange: 'CME' }, // 100,000 CAD: fx/g10/canadian-dollar
190
199
  // US Treasury futures, quoted in points of par (100): the face value / 100 per point.
191
- ZT: { kind: 'unknown', pointValue: 2_000, quote: 'usd' }, // $200,000 face: interest-rates/us-treasury/2-year-us-treasury-note
192
- ZF: { kind: 'unknown', pointValue: 1_000, quote: 'usd' }, // $100,000 face: interest-rates/us-treasury/5-year-us-treasury-note
193
- ZN: { kind: 'unknown', pointValue: 1_000, quote: 'usd' }, // $100,000 face: interest-rates/us-treasury/10-year-us-treasury-note
194
- TN: { kind: 'unknown', pointValue: 1_000, quote: 'usd' }, // $100,000 face: interest-rates/us-treasury/ultra-10-year-us-treasury-note
195
- ZB: { kind: 'unknown', pointValue: 1_000, quote: 'usd' }, // $100,000 face: interest-rates/us-treasury/30-year-us-treasury-bond
196
- UB: { kind: 'unknown', pointValue: 1_000, quote: 'usd' }, // $100,000 face: interest-rates/us-treasury/ultra-t-bond
200
+ ZT: { kind: 'unknown', pointValue: 2_000, quote: 'usd', exchange: 'CBOT' }, // $200,000 face: interest-rates/us-treasury/2-year-us-treasury-note
201
+ ZF: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/5-year-us-treasury-note
202
+ ZN: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/10-year-us-treasury-note
203
+ TN: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/ultra-10-year-us-treasury-note
204
+ ZB: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/30-year-us-treasury-bond
205
+ UB: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/ultra-t-bond
197
206
  // Energy (NYMEX), quoted in US dollars per unit of the commodity.
198
- CL: { kind: 'unknown', pointValue: 1_000, quote: 'usd' }, // 1,000 barrels: energy/crude-oil/light-sweet-crude
199
- MCL: { kind: 'unknown', pointValue: 100, quote: 'usd' }, // 100 barrels: energy/crude-oil/micro-wti-crude-oil
200
- NG: { kind: 'unknown', pointValue: 10_000, quote: 'usd' }, // 10,000 MMBtu: energy/natural-gas/natural-gas
201
- RB: { kind: 'unknown', pointValue: 42_000, quote: 'usd' }, // 42,000 gallons: energy/refined-products/rbob-gasoline
202
- HO: { kind: 'unknown', pointValue: 42_000, quote: 'usd' }, // 42,000 gallons: energy/refined-products/heating-oil
203
- BZ: { kind: 'unknown', pointValue: 1_000, quote: 'usd' }, // 1,000 barrels: energy/crude-oil/brent-crude-oil-last-day
207
+ CL: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'NYMEX' }, // 1,000 barrels: energy/crude-oil/light-sweet-crude
208
+ MCL: { kind: 'unknown', pointValue: 100, quote: 'usd', exchange: 'NYMEX' }, // 100 barrels: energy/crude-oil/micro-wti-crude-oil
209
+ NG: { kind: 'unknown', pointValue: 10_000, quote: 'usd', exchange: 'NYMEX' }, // 10,000 MMBtu: energy/natural-gas/natural-gas
210
+ RB: { kind: 'unknown', pointValue: 42_000, quote: 'usd', exchange: 'NYMEX' }, // 42,000 gallons: energy/refined-products/rbob-gasoline
211
+ HO: { kind: 'unknown', pointValue: 42_000, quote: 'usd', exchange: 'NYMEX' }, // 42,000 gallons: energy/refined-products/heating-oil
212
+ BZ: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'NYMEX' }, // 1,000 barrels: energy/crude-oil/brent-crude-oil-last-day
204
213
  // Metals (COMEX), quoted in US dollars per troy ounce (copper per pound).
205
- GC: { kind: 'metal', pointValue: 100, quote: 'usd' }, // 100 troy ounces: metals/precious/gold
206
- MGC: { kind: 'metal', pointValue: 10, quote: 'usd' }, // 10 troy ounces: metals/precious/e-micro-gold
207
- SI: { kind: 'metal', pointValue: 5_000, quote: 'usd' }, // 5,000 troy ounces: metals/precious/silver
208
- SIL: { kind: 'metal', pointValue: 1_000, quote: 'usd' }, // 1,000 troy ounces: metals/precious/1000-oz-silver
209
- HG: { kind: 'metal', pointValue: 25_000, quote: 'usd' }, // 25,000 pounds: metals/base/copper
210
- MHG: { kind: 'metal', pointValue: 2_500, quote: 'usd' }, // 2,500 pounds: metals/base/micro-copper
214
+ GC: { kind: 'metal', pointValue: 100, quote: 'usd', exchange: 'COMEX' }, // 100 troy ounces: metals/precious/gold
215
+ MGC: { kind: 'metal', pointValue: 10, quote: 'usd', exchange: 'COMEX' }, // 10 troy ounces: metals/precious/e-micro-gold
216
+ SI: { kind: 'metal', pointValue: 5_000, quote: 'usd', exchange: 'COMEX' }, // 5,000 troy ounces: metals/precious/silver
217
+ SIL: { kind: 'metal', pointValue: 1_000, quote: 'usd', exchange: 'COMEX' }, // 1,000 troy ounces: metals/precious/1000-oz-silver
218
+ HG: { kind: 'metal', pointValue: 25_000, quote: 'usd', exchange: 'COMEX' }, // 25,000 pounds: metals/base/copper
219
+ MHG: { kind: 'metal', pointValue: 2_500, quote: 'usd', exchange: 'COMEX' }, // 2,500 pounds: metals/base/micro-copper
211
220
  // Grains (CBOT), quoted in US cents per bushel (soybean oil per pound), the unit the chart
212
221
  // draws (corn near 460): a whole point is one cent, worth the contract size in cents, and
213
222
  // the quote is US cents, not dollars (Pine reads `syminfo.currency` "USX" there).
214
- ZC: { kind: 'unknown', pointValue: 5_000, quote: 'other' }, // 5,000 bushels: agriculture/grains/corn
215
- ZW: { kind: 'unknown', pointValue: 5_000, quote: 'other' }, // 5,000 bushels: agriculture/grains/wheat
216
- KE: { kind: 'unknown', pointValue: 5_000, quote: 'other' }, // 5,000 bushels: agriculture/grains/kc-wheat
217
- ZS: { kind: 'unknown', pointValue: 5_000, quote: 'other' }, // 5,000 bushels: agriculture/oilseeds/soybean
218
- ZL: { kind: 'unknown', pointValue: 60_000, quote: 'other' }, // 60,000 pounds: agriculture/oilseeds/soybean-oil
223
+ ZC: { kind: 'unknown', pointValue: 5_000, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels: agriculture/grains/corn
224
+ ZW: { kind: 'unknown', pointValue: 5_000, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels: agriculture/grains/wheat
225
+ KE: { kind: 'unknown', pointValue: 5_000, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels: agriculture/grains/kc-wheat
226
+ ZS: { kind: 'unknown', pointValue: 5_000, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels: agriculture/oilseeds/soybean
227
+ ZL: { kind: 'unknown', pointValue: 60_000, quote: 'other', exchange: 'CBOT' }, // 60,000 pounds: agriculture/oilseeds/soybean-oil
219
228
  // Cryptocurrency futures (CME), quoted in US dollars per coin.
220
- BTC: { kind: 'crypto', pointValue: 5, quote: 'usd' }, // 5 bitcoin: cryptocurrencies/bitcoin/bitcoin
221
- MBT: { kind: 'crypto', pointValue: 0.1, quote: 'usd' }, // 0.1 bitcoin: cryptocurrencies/bitcoin/micro-bitcoin
222
- ETH: { kind: 'crypto', pointValue: 50, quote: 'usd' }, // 50 ether: cryptocurrencies/ether/ether
223
- MET: { kind: 'crypto', pointValue: 0.1, quote: 'usd' }, // 0.1 ether: cryptocurrencies/ether/micro-ether
229
+ BTC: { kind: 'crypto', pointValue: 5, quote: 'usd', exchange: 'CME' }, // 5 bitcoin: cryptocurrencies/bitcoin/bitcoin
230
+ MBT: { kind: 'crypto', pointValue: 0.1, quote: 'usd', exchange: 'CME' }, // 0.1 bitcoin: cryptocurrencies/bitcoin/micro-bitcoin
231
+ ETH: { kind: 'crypto', pointValue: 50, quote: 'usd', exchange: 'CME' }, // 50 ether: cryptocurrencies/ether/ether
232
+ MET: { kind: 'crypto', pointValue: 0.1, quote: 'usd', exchange: 'CME' }, // 0.1 ether: cryptocurrencies/ether/micro-ether
224
233
  };
234
+ /** The CME Group exchange a futures root lists on (`CME_ROOT_SPECS`), or undefined for a root off the table. */
235
+ export function wrunCmeRootExchange(root) {
236
+ const key = root.trim().toUpperCase();
237
+ return Object.prototype.hasOwnProperty.call(CME_ROOT_SPECS, key) ? CME_ROOT_SPECS[key].exchange : undefined;
238
+ }
225
239
  // ---------------------------------------------------------------------------
226
240
  // The facts of one market
227
241
  // ---------------------------------------------------------------------------
@@ -332,7 +346,8 @@ export function wrunChartMarketFacts(market, row) {
332
346
  const ownKind = spec?.kind ?? (checkIsEconomic(venue) ? 'economic' : undefined);
333
347
  const kind = (row !== undefined ? rowKind(row) : undefined) ?? venueKind(venue, symbol) ?? ownKind ?? 'unknown';
334
348
  const pointValue = cme ? (spec?.pointValue ?? 0) : UNKNOWN_MULTIPLIER_EXCHANGES.has(venue) ? 0 : 1;
335
- const zone = US_LISTING_EXCHANGES.has(venue) || INDEX_EXCHANGES.has(venue)
349
+ const forex = FOREX_EXCHANGES.has(venue);
350
+ const zone = US_LISTING_EXCHANGES.has(venue) || INDEX_EXCHANGES.has(venue) || forex
336
351
  ? NEW_YORK
337
352
  : cme
338
353
  ? CHICAGO
@@ -349,7 +364,7 @@ export function wrunChartMarketFacts(market, row) {
349
364
  ? 'usd'
350
365
  : 'other';
351
366
  const quote = (row !== undefined ? rowQuote(row) : undefined) ?? venueQuote ?? ownQuote ?? 'unknown';
352
- const sessionOpen = cme ? WRUN_MARKET_SESSION_OPEN_CME : 0;
367
+ const sessionOpen = cme ? WRUN_MARKET_SESSION_OPEN_CME : forex ? WRUN_MARKET_SESSION_OPEN_FOREX : 0;
353
368
  return { kind: kindCode(kind), pointValue, zone, quoteIsUsd: quoteCode(quote), sessionOpen };
354
369
  }
355
370
  /** The host_fill word of `market.dollar_multiplier()` (kit 0.95.0). */
@@ -389,8 +404,9 @@ function cmeChainRootSpec(market) {
389
404
  * CME a CME-governed chart reads the chain of its own root: the root's point value (CME_ROOT_SPECS, ES 50,
390
405
  * NQ 20) when the root is quoted in US dollars; a root off the table, or quoted in another unit (a CBOT
391
406
  * grain quotes US cents), is 0.
392
- * OPRA a chart whose options list on OPRA (the venue table: an OPRA contract chart, a US stock or ETF chart):
393
- * 100.
407
+ * OPRA a chart whose options list on OPRA (the venue table over the options seam's market, `optionsExchange`
408
+ * else the chart's own: an OPRA contract chart, a US stock or ETF chart, a stock twin while the opra flag
409
+ * is lit): 100.
394
410
  * crypto a chart on a crypto exchange, whichever venue and category (isCryptoChartVenue): its chain, when it has
395
411
  * one, is a crypto chain (its own option venue's, the coin's Deribit chain, or another crypto venue's that
396
412
  * lists the coin), priced in dollars per coin on every venue: 1. A crypto chart with no chain serves no
@@ -411,24 +427,57 @@ export function wrunChartOptionMultiplier(market) {
411
427
  const spec = cmeChainRootSpec(market);
412
428
  return spec?.quote === 'usd' ? spec.pointValue : 0;
413
429
  }
414
- const options = optionVenueForExchange(venue) ?? optionVenueForUnderlyingExchange(venue);
430
+ // The family of the chain the chart reads: the options seam's market's (a stock twin's US stock) when the host named
431
+ // it, else the chart's own.
432
+ const optionsVenue = upperText(market.optionsExchange) ?? venue;
433
+ const options = optionVenueForExchange(optionsVenue) ?? optionsMarketUnderlyingVenue({ exchange: optionsVenue });
415
434
  if (options?.plane === 'opra')
416
435
  return OPRA_OPTION_MULTIPLIER;
417
436
  return isCryptoChartVenue(venue) ? CRYPTO_OPTION_MULTIPLIER : 0;
418
437
  }
438
+ /** The host_fill word of `market.option_contract()` (C5), a WrunParamHostFill word of the kit the chart pins
439
+ * (0.102.0). The host fills the hidden param `market_option_contract` by this word, never by a slot, so a package
440
+ * compiled without the word keeps every init slot and no scaffold bump is needed. */
441
+ export const WRUN_OPTION_CONTRACT_FILL = 'option_contract';
442
+ /**
443
+ * `market.option_contract()` of the chart market `market` (C5): 1 when the chart is one option contract, else 0. A
444
+ * recipe that marks the underlying's prices (Option Prints) reads it to draw no marks on a contract's own price axis,
445
+ * instead of guessing from price distance. The add door's identity (cme-option-indicator-availability.util
446
+ * isOptionContractChart, which the option-contract indicator refusals read), widened to the crypto option venues:
447
+ *
448
+ * OPRA every chart on the OPRA venue is one contract, a document saved without its category included.
449
+ * CME a chart whose category is OPTION (`ESZ6 C6000`): the category tells the contract from the future on the
450
+ * same venue (ESZ6, ES1!).
451
+ * crypto a chart whose category is OPTION, or one on a plain option venue whose symbol the venue's grammar parses
452
+ * (isPlainOptionContract: Deribit `BTC-25DEC26-100000-C`), so a contract saved without its category still
453
+ * reads 1 and the venue's perpetual (`BTC-PERPETUAL`) reads 0.
454
+ * else 0: a stock or ETF (SPY/USD, an options underlying), a future, a perpetual, spot, forex, an index, an
455
+ * economic series, a prediction market, an unknown venue, no market.
456
+ *
457
+ * The chart metadata alone decides, synchronously and with no read, like the option multiplier. Pure.
458
+ */
459
+ export function wrunChartOptionContract(market) {
460
+ const venue = upperText(market?.exchange);
461
+ if (market === undefined || venue === undefined)
462
+ return 0;
463
+ const symbol = typeof market.symbol === 'string' ? market.symbol : '';
464
+ return isOpraGoverned(venue) || isOptionContract(market.category) || isPlainOptionContract(venue, symbol) ? 1 : 0;
465
+ }
419
466
  /** The host_fill words whose values the host fill carries off the chart's market (wrunMarketFactsFor): the five
420
467
  * market facts, the option multiplier (om WRUN_OPTION_FACT_FILLS, a word of the kit's WrunParamHostFill since
421
- * 0.87.0, which the kit exports no runtime list for) and the dollar multiplier (kit 0.95.0). */
468
+ * 0.87.0, which the kit exports no runtime list for), the dollar multiplier (kit 0.95.0) and the option contract
469
+ * (C5). They ride beside the five and never join WRUN_MARKET_FACT_FILLS, which mirrors the kit's own five. */
422
470
  const WRUN_CHART_MARKET_FILLS = new Set([
423
471
  ...WRUN_MARKET_FACT_FILLS,
424
472
  'option_multiplier',
425
473
  WRUN_DOLLAR_MULTIPLIER_FILL,
474
+ WRUN_OPTION_CONTRACT_FILL,
426
475
  ]);
427
476
  /** True when the sheet declares one of the market's facts (a host-filled
428
477
  * param on `kind`, `point_value`, `zone`, `quote_is_usd`, `session_open`,
429
- * `option_multiplier` or `dollar_multiplier`): the runs whose host fill
430
- * carries the market's facts. Only a sheet that declares a directory fact
431
- * waits for the read (wrunMarketFactsNeedDirectory). */
478
+ * `option_multiplier`, `dollar_multiplier` or `option_contract`): the runs
479
+ * whose host fill carries the market's facts. Only a sheet that declares a
480
+ * directory fact waits for the read (wrunMarketFactsNeedDirectory). */
432
481
  export function wrunReadsMarketFacts(metadata) {
433
482
  return (metadata?.params ?? []).some((param) => param.host_fill !== undefined && WRUN_CHART_MARKET_FILLS.has(param.host_fill));
434
483
  }
@@ -451,7 +500,7 @@ export function wrunDeclaresDollarMultiplier(declarations) {
451
500
  /** The facts the directory row answers: wrunChartMarketFacts reads the row for
452
501
  * `kind` (its asset class) and `quote_is_usd` (its quote) alone. The other
453
502
  * three are the venue tables' (`point_value` the CME root's or the venue's
454
- * unit rule, `zone` the venue's clock, `session_open` the CME family's open):
503
+ * unit rule, `zone` the venue's clock, `session_open` the CME family's and forex's open):
455
504
  * no row moves them. */
456
505
  const WRUN_DIRECTORY_MARKET_FACTS = new Set(['kind', 'quote_is_usd']);
457
506
  /** True when the sheet declares a fact the directory row answers (`kind`,
@@ -746,9 +795,11 @@ export function wrunMarketFactsSettled(market) {
746
795
  /** The facts the chart fills for `market` now (synchronous): the five over the
747
796
  * directory row once warmWrunMarketFacts settled it, else without one, the
748
797
  * option multiplier of its options chain (wrunChartOptionMultiplier: the
749
- * venue tables alone, no read) and the dollar multiplier of its own trades
750
- * (wrunMarketDollarUnit over the reads warmWrunMarketDollarFacts settled; 0
751
- * while it is not proven). */
798
+ * venue tables alone, no read), whether it is one option contract
799
+ * (wrunChartOptionContract: its metadata alone, no read) and the dollar
800
+ * multiplier of its own trades (wrunMarketDollarUnit over the reads
801
+ * warmWrunMarketDollarFacts settled; 0 while it is not proven). Every word is
802
+ * written on every market, 0 included, so the block keeps one shape. */
752
803
  export function wrunMarketFactsFor(market) {
753
804
  const parts = marketKeyParts(market);
754
805
  const row = parts === undefined ? undefined : settledRows.get(directoryKey(parts.venue, parts.symbol));
@@ -756,6 +807,7 @@ export function wrunMarketFactsFor(market) {
756
807
  return {
757
808
  ...wrunChartMarketFacts(market, row ?? undefined),
758
809
  optionMultiplier: wrunChartOptionMultiplier(market),
810
+ optionContract: wrunChartOptionContract(market),
759
811
  dollarMultiplier: dollars.kind === 'dollars' ? dollars.unit : 0,
760
812
  };
761
813
  }
@@ -301,6 +301,15 @@ export declare function wrunVisibilityOwners(metadata: WrunVisibilitySheet | und
301
301
  export declare function wrunParamOutputTargets(param: WrunMetadataParam, outputs: unknown, key: string): Array<Record<string, unknown> & {
302
302
  name: string;
303
303
  }>;
304
+ /** The colour param whose declared targets paint a Style target's `color` exactly (a target with its own alpha
305
+ * paints a derived colour and does not count), with the sheet path it writes: the heir a saved Style colour row
306
+ * hands its pick to when a republish drops the row for the param (wrun-twin-pin-move styleRowHeir). The target
307
+ * is a Style row's (`<output>`, `text:<renderer>`, `box:<name>`, ...); undefined when the sheet does not paint it
308
+ * or no colour param writes that location. */
309
+ export declare function wrunColourTargetOwner(metadata: WrunIndicatorMetadata, target: string): {
310
+ name: string;
311
+ path: ReadonlyArray<string | number>;
312
+ } | undefined;
304
313
  /** Every Style target whose visibility a boolean param owns (wrunVisibilityTargetOwners): an
305
314
  * output by its name, any other drawn kind by its prefixed target. Such a target shows by the
306
315
  * painted sheet alone and offers no Visible row. */
@@ -832,6 +832,39 @@ export function wrunParamOutputTargets(param, outputs, key) {
832
832
  }
833
833
  return written;
834
834
  }
835
+ /** The colour param whose declared targets paint a Style target's `color` exactly (a target with its own alpha
836
+ * paints a derived colour and does not count), with the sheet path it writes: the heir a saved Style colour row
837
+ * hands its pick to when a republish drops the row for the param (wrun-twin-pin-move styleRowHeir). The target
838
+ * is a Style row's (`<output>`, `text:<renderer>`, `box:<name>`, ...); undefined when the sheet does not paint it
839
+ * or no colour param writes that location. */
840
+ export function wrunColourTargetOwner(metadata, target) {
841
+ const write = wrunStyleTargetWrites(metadata, target, 'color', '#000000').find((entry) => entry.kind === 'value');
842
+ if (write === undefined)
843
+ return undefined;
844
+ const resolve = (path) => {
845
+ if (path.length !== 3)
846
+ return undefined;
847
+ const section = metadata[path[0]];
848
+ const key = childKey(section, path[1]);
849
+ return key === undefined ? undefined : [path[0], key, path[2]];
850
+ };
851
+ const wanted = resolve(write.path);
852
+ if (wanted === undefined)
853
+ return undefined;
854
+ for (const param of Array.isArray(metadata.params) ? metadata.params : []) {
855
+ if (param.type !== 'color')
856
+ continue;
857
+ const owns = paramTargets(param).targets.some((candidate) => {
858
+ if (candidate.alpha !== undefined)
859
+ return false;
860
+ const path = resolve(candidate.path);
861
+ return path !== undefined && path.every((segment, at) => segment === wanted[at]);
862
+ });
863
+ if (owns)
864
+ return { name: param.name, path: wanted };
865
+ }
866
+ return undefined;
867
+ }
835
868
  /** Every Style target whose visibility a boolean param owns (wrunVisibilityTargetOwners): an
836
869
  * output by its name, any other drawn kind by its prefixed target. Such a target shows by the
837
870
  * painted sheet alone and offers no Visible row. */
@@ -19,6 +19,11 @@
19
19
  *
20
20
  * Telemetry only in R1: nothing reads the meter to change an ask; a full run hands its summary to the add's attempt
21
21
  * (`downloadBytes` on `wrun-indicator`), the live session counts its reconciles on its own meter.
22
+ *
23
+ * R2 (the download budget's cut, behind `wrun-download-budget-cut`): a run whose projection passes its budget notes
24
+ * it (`noteBudget`: `budgeted`, the bars its reads left unread, the bytes it planned), and each history read it cuts
25
+ * keeps its own tally beside the run's meter (wrun-download-plan.util `createWrunLaneDownloadMeter`, off the boot
26
+ * path), so the read's newest slice measures its own wire bytes while the other reads download beside it.
22
27
  */
23
28
  import type { WrunSourceFetchVerdict } from '../../host-ports.types.js';
24
29
  /** One indicator add may download at most this many bytes at the standard window (the kit's
@@ -66,10 +71,20 @@ export interface WrunDownloadSummary {
66
71
  /** R2: a first slice's bytes plus the older asks still out, projected. */
67
72
  plannedBytes?: number;
68
73
  }
74
+ /** What a run notes of its budget (R2): it planned a cut (`budgeted`), the bars a read left unread (summed over the
75
+ * notes), and the bytes the run planned (its slices' bytes and the older asks it sends, projected; the last note
76
+ * wins). */
77
+ export interface WrunDownloadBudgetNote {
78
+ budgeted?: true;
79
+ cutBars?: number;
80
+ plannedBytes?: number;
81
+ }
69
82
  export interface WrunDownloadMeter extends WrunDownloadMeterPort {
70
83
  readonly budgetBytes: number;
71
84
  spentBytes(): number;
72
85
  remainingBytes(): number;
86
+ /** R2: the run's budget facts for the summary (`budgeted`, `cutBars`, `plannedBytes`). */
87
+ noteBudget(note: WrunDownloadBudgetNote): void;
73
88
  summary(): WrunDownloadSummary;
74
89
  }
75
90
  export declare function createWrunDownloadMeter(windowBars: number): WrunDownloadMeter;
@@ -25,9 +25,20 @@ export function createWrunDownloadMeter(windowBars) {
25
25
  let asks = 0;
26
26
  let cachedAsks = 0;
27
27
  let measure = 'wire';
28
+ let budgeted = false;
29
+ let cutBars = 0;
30
+ let plannedBytes;
28
31
  const bytesByKType = new Map();
29
32
  return {
30
33
  budgetBytes,
34
+ noteBudget(note) {
35
+ if (note.budgeted === true)
36
+ budgeted = true;
37
+ cutBars += countOf(note.cutBars);
38
+ if (note.plannedBytes !== undefined && Number.isFinite(note.plannedBytes)) {
39
+ plannedBytes = Math.max(0, Math.round(note.plannedBytes));
40
+ }
41
+ },
31
42
  charge(charge) {
32
43
  asks += 1;
33
44
  cellBytes += countOf(charge.cellBytes);
@@ -71,9 +82,10 @@ export function createWrunDownloadMeter(windowBars) {
71
82
  windowBars: bars,
72
83
  budgetBytes,
73
84
  over: bytes > budgetBytes,
74
- budgeted: false,
75
- cutBars: 0,
85
+ budgeted,
86
+ cutBars,
76
87
  ...(topSource !== undefined ? { topSource } : {}),
88
+ ...(plannedBytes !== undefined ? { plannedBytes } : {}),
77
89
  };
78
90
  },
79
91
  };