@orangecharts/wrun-chart-host 0.10.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 (145) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/feature-flags.constants.d.ts +9 -0
  3. package/dist/constants/feature-flags.constants.js +67 -4
  4. package/dist/constants/governed-exchanges.constants.d.ts +12 -0
  5. package/dist/constants/governed-exchanges.constants.js +16 -0
  6. package/dist/constants/option-venues.constants.d.ts +2 -2
  7. package/dist/host-env.d.ts +1 -9
  8. package/dist/host-ports.types.d.ts +36 -7
  9. package/dist/index.d.ts +6 -1
  10. package/dist/index.js +6 -1
  11. package/dist/interfaces/cancel-reason.interface.d.ts +1 -1
  12. package/dist/interfaces/cme-realtime.interface.d.ts +16 -9
  13. package/dist/interfaces/cme-realtime.interface.js +6 -3
  14. package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
  15. package/dist/interfaces/opra-realtime.interface.d.ts +1 -5
  16. package/dist/interfaces/prediction-market.interface.d.ts +7 -0
  17. package/dist/interfaces/stocks-realtime.interface.d.ts +57 -0
  18. package/dist/interfaces/stocks-realtime.interface.js +32 -0
  19. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +48 -117
  20. package/dist/kscript-data/controls/live-trades-merge.util.js +97 -207
  21. package/dist/market-data/billing.interface.d.ts +86 -12
  22. package/dist/market-data/billing.interface.js +23 -4
  23. package/dist/market-data/venue.d.ts +65 -2
  24. package/dist/market-data/venues/index.d.ts +135 -5
  25. package/dist/market-data/venues/index.js +2 -1
  26. package/dist/market-data/venues/opra.contract.copy.json +3 -2
  27. package/dist/market-data/venues/opra.d.ts +2 -2
  28. package/dist/market-data/venues/opra.js +5 -2
  29. package/dist/market-data/venues/stocks.contract.copy.json +64 -0
  30. package/dist/market-data/venues/stocks.d.ts +130 -0
  31. package/dist/market-data/venues/stocks.js +117 -0
  32. package/dist/settings-templates/footprint-rows.js +35 -2
  33. package/dist/settings-templates/form-rows.d.ts +2 -1
  34. package/dist/settings-templates/indicator-fields.js +34 -4
  35. package/dist/settings-templates/tool-rules.d.ts +12 -5
  36. package/dist/settings-templates/tool-rules.js +11 -5
  37. package/dist/settings-templates/tool-tables.generated.js +4 -0
  38. package/dist/utility/chart/cme-cache-context.util.d.ts +5 -3
  39. package/dist/utility/chart/cme-cache-context.util.js +10 -6
  40. package/dist/utility/chart/cme-realtime.util.js +10 -0
  41. package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +83 -0
  42. package/dist/utility/chart/cme-user-scripts-gate.util.js +142 -0
  43. package/dist/utility/chart/effective-chart-session.util.d.ts +14 -0
  44. package/dist/utility/chart/effective-chart-session.util.js +39 -0
  45. package/dist/utility/chart/host-bar-placement.util.d.ts +28 -0
  46. package/dist/utility/chart/host-bar-placement.util.js +170 -30
  47. package/dist/utility/chart/index-host-tier.util.d.ts +3 -1
  48. package/dist/utility/chart/index-host-tier.util.js +7 -2
  49. package/dist/utility/chart/index-mode-admission.util.js +25 -11
  50. package/dist/utility/chart/kscript-apply-fingerprint.util.js +1 -1
  51. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +6 -9
  52. package/dist/utility/chart/kscript-live-coalesce.util.js +8 -9
  53. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +9 -0
  54. package/dist/utility/chart/kscript-live-source-identity.util.js +10 -1
  55. package/dist/utility/chart/kscript-provenance-keys.util.js +7 -0
  56. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
  57. package/dist/utility/chart/kscript-venue-policy.util.d.ts +115 -21
  58. package/dist/utility/chart/kscript-venue-policy.util.js +194 -40
  59. package/dist/utility/chart/live-bucket.util.d.ts +24 -8
  60. package/dist/utility/chart/live-bucket.util.js +85 -27
  61. package/dist/utility/chart/marketKind.util.js +5 -0
  62. package/dist/utility/chart/mixed-mode.util.d.ts +7 -0
  63. package/dist/utility/chart/mixed-mode.util.js +14 -0
  64. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +11 -16
  65. package/dist/utility/chart/opra-user-scripts-gate.util.js +12 -28
  66. package/dist/utility/chart/rth-session.util.d.ts +9 -8
  67. package/dist/utility/chart/rth-session.util.js +23 -20
  68. package/dist/utility/chart/trading-day.util.d.ts +17 -0
  69. package/dist/utility/chart/trading-day.util.js +59 -0
  70. package/dist/utility/chart/window-owner.leaf.d.ts +23 -2
  71. package/dist/utility/chart/window-owner.leaf.js +45 -3
  72. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +33 -15
  73. package/dist/utility/chart/wrun-bar-session-facts.util.js +70 -20
  74. package/dist/utility/intl-locale.util.js +5 -0
  75. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
  76. package/dist/utility/v2/gate-plane.util.d.ts +12 -3
  77. package/dist/utility/v2/gate-plane.util.js +30 -4
  78. package/dist/utility/v2/gate-session-latch.util.js +1 -1
  79. package/dist/utility/v2/stocks-governed.util.d.ts +16 -0
  80. package/dist/utility/v2/stocks-governed.util.js +34 -0
  81. package/dist/utility/wrun/derived-roots.leaf.d.ts +13 -0
  82. package/dist/utility/wrun/derived-roots.leaf.js +27 -0
  83. package/dist/utility/wrun/derived-roots.util.d.ts +1 -9
  84. package/dist/utility/wrun/derived-roots.util.js +3 -23
  85. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +4 -3
  86. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +24 -3
  87. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +46 -10
  88. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +2 -0
  89. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +63 -16
  90. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +58 -14
  91. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +34 -11
  92. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +106 -30
  93. package/dist/utility/wrun/wrun-browser-sources.leaf.js +1 -2
  94. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +7 -4
  95. package/dist/utility/wrun/wrun-chart-market-facts.util.js +12 -8
  96. package/dist/utility/wrun/wrun-color-settings.util.d.ts +9 -0
  97. package/dist/utility/wrun/wrun-color-settings.util.js +33 -0
  98. package/dist/utility/wrun/wrun-handles.util.d.ts +7 -3
  99. package/dist/utility/wrun/wrun-handles.util.js +9 -8
  100. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +68 -0
  101. package/dist/utility/wrun/wrun-input-requirements.leaf.js +163 -7
  102. package/dist/utility/wrun/wrun-leg-close.util.d.ts +59 -23
  103. package/dist/utility/wrun/wrun-leg-close.util.js +186 -28
  104. package/dist/utility/wrun/wrun-live-intake.util.d.ts +26 -12
  105. package/dist/utility/wrun/wrun-live-intake.util.js +219 -155
  106. package/dist/utility/wrun/wrun-live-tick.util.d.ts +9 -5
  107. package/dist/utility/wrun/wrun-live-tick.util.js +130 -94
  108. package/dist/utility/wrun/wrun-market-facts.util.d.ts +13 -3
  109. package/dist/utility/wrun/wrun-market-facts.util.js +13 -3
  110. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +20 -10
  111. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +10 -5
  112. package/dist/utility/wrun/wrun-option-book-rows.util.d.ts +56 -0
  113. package/dist/utility/wrun/wrun-option-book-rows.util.js +96 -0
  114. package/dist/utility/wrun/wrun-option-views.util.d.ts +281 -20
  115. package/dist/utility/wrun/wrun-option-views.util.js +391 -50
  116. package/dist/utility/wrun/wrun-options-chain.util.d.ts +3 -3
  117. package/dist/utility/wrun/wrun-options-chain.util.js +2 -0
  118. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +15 -2
  119. package/dist/utility/wrun/wrun-overlay-drivers.util.js +13 -3
  120. package/dist/utility/wrun/wrun-overlay-recovery.util.js +3 -1
  121. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +60 -11
  122. package/dist/utility/wrun/wrun-overlay-run.util.js +529 -113
  123. package/dist/utility/wrun/wrun-panel-mount.util.js +51 -6
  124. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +15 -2
  125. package/dist/utility/wrun/wrun-pin-spelling.util.js +27 -3
  126. package/dist/utility/wrun/wrun-refusal.util.d.ts +3 -2
  127. package/dist/utility/wrun/wrun-refusal.util.js +22 -0
  128. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +26 -0
  129. package/dist/utility/wrun/wrun-registry-errors.util.js +34 -0
  130. package/dist/utility/wrun/wrun-replay-lane.util.js +3 -2
  131. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +20 -6
  132. package/dist/utility/wrun/wrun-run-interval-session.util.js +22 -7
  133. package/dist/utility/wrun/wrun-run-interval.util.d.ts +39 -7
  134. package/dist/utility/wrun/wrun-run-interval.util.js +49 -9
  135. package/dist/utility/wrun/wrun-socket-row-source.js +7 -2
  136. package/dist/utility/wrun/wrun-source-rows.util.d.ts +29 -22
  137. package/dist/utility/wrun/wrun-source-rows.util.js +62 -41
  138. package/dist/utility/wrun/wrun-tape-per-order.util.js +1 -20
  139. package/dist/utility/wrun/wrun-tape-source.util.d.ts +17 -9
  140. package/dist/utility/wrun/wrun-tape-source.util.js +20 -12
  141. package/dist/workers/constants/socket-slots.d.ts +91 -6
  142. package/dist/workers/constants/socket-slots.js +85 -6
  143. package/package.json +11 -11
  144. package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +0 -56
  145. package/dist/kscript-data/controls/live-trades-order-gate.util.js +0 -107
@@ -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,7 +42,9 @@
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
@@ -69,7 +72,7 @@ import { checkIsEconomic, getMarketKind } from '../chart/marketKind.util.js';
69
72
  import { optionsMarketUnderlyingVenue, optionVenueForExchange } from '../options/option-venue.util.js';
70
73
  import { isPlainOptionContract } from '../options/option-trade-units.util.js';
71
74
  import { isOpraGoverned } from '../v2/opra-governed.util.js';
72
- 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';
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';
73
76
  import { isWrunLegStreamClass } from './wrun-leg-stream-classes.js';
74
77
  import { isTradesDollarQuoteAsset } from '../../kscript-data/controls/live-trades-merge.util.js';
75
78
  import { getExchangeFromSymbol } from '../../helpers/data.helpers.js';
@@ -343,7 +346,8 @@ export function wrunChartMarketFacts(market, row) {
343
346
  const ownKind = spec?.kind ?? (checkIsEconomic(venue) ? 'economic' : undefined);
344
347
  const kind = (row !== undefined ? rowKind(row) : undefined) ?? venueKind(venue, symbol) ?? ownKind ?? 'unknown';
345
348
  const pointValue = cme ? (spec?.pointValue ?? 0) : UNKNOWN_MULTIPLIER_EXCHANGES.has(venue) ? 0 : 1;
346
- 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
347
351
  ? NEW_YORK
348
352
  : cme
349
353
  ? CHICAGO
@@ -360,7 +364,7 @@ export function wrunChartMarketFacts(market, row) {
360
364
  ? 'usd'
361
365
  : 'other';
362
366
  const quote = (row !== undefined ? rowQuote(row) : undefined) ?? venueQuote ?? ownQuote ?? 'unknown';
363
- 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;
364
368
  return { kind: kindCode(kind), pointValue, zone, quoteIsUsd: quoteCode(quote), sessionOpen };
365
369
  }
366
370
  /** The host_fill word of `market.dollar_multiplier()` (kit 0.95.0). */
@@ -496,7 +500,7 @@ export function wrunDeclaresDollarMultiplier(declarations) {
496
500
  /** The facts the directory row answers: wrunChartMarketFacts reads the row for
497
501
  * `kind` (its asset class) and `quote_is_usd` (its quote) alone. The other
498
502
  * three are the venue tables' (`point_value` the CME root's or the venue's
499
- * 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):
500
504
  * no row moves them. */
501
505
  const WRUN_DIRECTORY_MARKET_FACTS = new Set(['kind', 'quote_is_usd']);
502
506
  /** True when the sheet declares a fact the directory row answers (`kind`,
@@ -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. */
@@ -224,9 +224,10 @@ export declare function wrunDrawStylePropClears(spec: WrunDrawStylePropSpec): bo
224
224
  * polygon fill) and a line's fill toward its `fill_to` line (`fillColor`,
225
225
  * on the wire only while a target is set; alpha is the fill's opacity);
226
226
  * `border` is a label's `border`; `glow` is every kind's `glowColor`;
227
- * `emblem` a label's `emblemColor`; `gradient_end` a box's `gradient:
228
- * [backgroundColor at the call, end]` (and `gradientDirection: "vertical"`
229
- * when unset); `text` a box's `textColor`. */
227
+ * `emblem` a label's `emblemColor`; `gradient_end` a box's or (since kit
228
+ * scaffold 104) a polyline's `gradient: [its fill at the call, end]` (a
229
+ * box's `backgroundColor`, a polyline's `fillColor`; and `gradientDirection:
230
+ * "vertical"` when unset); `text` a box's `textColor`. */
230
231
  export declare const WRUN3_COLOR_PROPS: {
231
232
  readonly stroke: 0;
232
233
  readonly fill: 1;
@@ -495,6 +496,9 @@ export interface WrunHandlePolylineLookProps {
495
496
  opacity?: number;
496
497
  zOrder?: number;
497
498
  fillColor?: string;
499
+ /** Colour prop 5 and style prop 26 (DW34 on a polyline, kit scaffold 104). */
500
+ gradient?: string[];
501
+ gradientDirection?: WrunHandleGradientDirection;
498
502
  closed?: true;
499
503
  smooth?: true;
500
504
  arrow?: WrunHandleArrow;
@@ -284,7 +284,7 @@ export const WRUN3_STYLE_PROP_SPECS = [
284
284
  {
285
285
  prop: WRUN3_STYLE_PROPS.gradient_direction,
286
286
  name: 'gradient_direction',
287
- kinds: ['box'],
287
+ kinds: ['box', 'polyline'],
288
288
  integer: true,
289
289
  words: WRUN_GRADIENT_DIRECTIONS,
290
290
  },
@@ -322,9 +322,10 @@ export function wrunDrawStylePropClears(spec) {
322
322
  * polygon fill) and a line's fill toward its `fill_to` line (`fillColor`,
323
323
  * on the wire only while a target is set; alpha is the fill's opacity);
324
324
  * `border` is a label's `border`; `glow` is every kind's `glowColor`;
325
- * `emblem` a label's `emblemColor`; `gradient_end` a box's `gradient:
326
- * [backgroundColor at the call, end]` (and `gradientDirection: "vertical"`
327
- * when unset); `text` a box's `textColor`. */
325
+ * `emblem` a label's `emblemColor`; `gradient_end` a box's or (since kit
326
+ * scaffold 104) a polyline's `gradient: [its fill at the call, end]` (a
327
+ * box's `backgroundColor`, a polyline's `fillColor`; and `gradientDirection:
328
+ * "vertical"` when unset); `text` a box's `textColor`. */
328
329
  export const WRUN3_COLOR_PROPS = {
329
330
  stroke: 0,
330
331
  fill: 1,
@@ -341,7 +342,7 @@ export const WRUN3_COLOR_PROP_SPECS = [
341
342
  { prop: WRUN3_COLOR_PROPS.border, name: 'border', kinds: ['label'] },
342
343
  { prop: WRUN3_COLOR_PROPS.glow, name: 'glow', kinds: ['line', 'box', 'label', 'polyline'] },
343
344
  { prop: WRUN3_COLOR_PROPS.emblem, name: 'emblem', kinds: ['label'] },
344
- { prop: WRUN3_COLOR_PROPS.gradient_end, name: 'gradient_end', kinds: ['box'] },
345
+ { prop: WRUN3_COLOR_PROPS.gradient_end, name: 'gradient_end', kinds: ['box', 'polyline'] },
345
346
  { prop: WRUN3_COLOR_PROPS.text, name: 'text', kinds: ['box'] },
346
347
  ];
347
348
  /** Caps: a breach refuses the evaluation by name, never drops or truncates.
@@ -1920,8 +1921,8 @@ function applyStyle(kind, spec, value, slotText, props) {
1920
1921
  * fill keys, a label's background, a polyline's polygon fill, and a line's
1921
1922
  * fill half (kept raw, on the wire only beside its fill_to target); border,
1922
1923
  * glow, emblem and text land on their own keys; gradient_end snapshots the
1923
- * box's fill colour at the call as the first stop and defaults the
1924
- * direction to vertical. */
1924
+ * fill colour at the call (a box's backgroundColor, a polyline's fillColor)
1925
+ * as the first stop and defaults the direction to vertical. */
1925
1926
  function applyColor(kind, spec, color, props) {
1926
1927
  switch (spec.name) {
1927
1928
  case 'stroke':
@@ -1952,7 +1953,7 @@ function applyColor(kind, spec, color, props) {
1952
1953
  props.emblemColor = color;
1953
1954
  break;
1954
1955
  case 'gradient_end':
1955
- props.gradient = [props.backgroundColor, color];
1956
+ props.gradient = [kind === 'polyline' ? props.fillColor : props.backgroundColor, color];
1956
1957
  if (props.gradientDirection === undefined)
1957
1958
  props.gradientDirection = 'vertical';
1958
1959
  break;
@@ -61,6 +61,9 @@ export type WrunInputRequirement = ({
61
61
  * Recorded only on a lane whose absence can hold the run: a quiet lane's readers (book, trades,
62
62
  * oi, liquidations, tape) draw without it whatever they declare. Absent: none is optional. */
63
63
  optional?: readonly string[];
64
+ /** The inputs follow the chart's coin to another venue's market (`follow: "coin"`, kit 0.77.0 coin legs): read by
65
+ * the chart's coin whatever their kind (`wrunRequirementReadsChartCoin`). Absent: they read no coin's market. */
66
+ followsCoin?: true;
64
67
  };
65
68
  /** The gateway type each chart-market class's lane fetches (its K control's data type). */
66
69
  export declare const CHART_MARKET_GATEWAY_TYPES: Readonly<Record<string, string>>;
@@ -81,6 +84,36 @@ export declare function wrunRequirementClasses(): string[];
81
84
  * chart-market requirement with an empty gateway type: unknown, never "needs nothing".
82
85
  */
83
86
  export declare function wrunInputRequirements(effectiveSheet: WrunIndicatorMetadata): WrunInputRequirement[];
87
+ /**
88
+ * Whether a requirement reads by the chart's coin: the options chain and every chain lane (`options`: the chain
89
+ * decision reads the coin's chain on a market that is no options venue), every provider lane (`provider`: its coin
90
+ * list, the Deribit coin set or the chart's coin itself) and every coin leg (`followsCoin`: the coin's market on
91
+ * another venue). Every other input reads the chart market's own series, a pinned market, a governed plane or
92
+ * nothing of the market.
93
+ */
94
+ export declare function wrunRequirementReadsChartCoin(req: Pick<WrunInputRequirement, 'kind' | 'followsCoin'>): boolean;
95
+ /**
96
+ * The prediction-market wall (Kyle 2026-10-29: options indicators on a Polymarket chart make no sense). A prediction
97
+ * market's price is the odds of an outcome, and the coin its chart carries is no asset that price follows: the symbol
98
+ * pipeline's coin match places no series key and answers BTC (symbol-resolve.util `getCoin`), and an event about a coin
99
+ * names that coin. An input read by the chart's coin (`wrunRequirementReadsChartCoin`) would draw another market's
100
+ * options, volatility or flows under the odds, so every prediction venue (`isPredictionExchangeName`: Polymarket,
101
+ * HIP4) refuses it whatever fill it declares: a wall like the CME and OPRA ones, since the fill would stand in for a
102
+ * series the market can never have. Whether the market reads the input at all (`needed_by`, a `when` setting) is the
103
+ * caller's to settle first. The picker's verdict and the works-on list (wrun-input-requirements.util) and the run's
104
+ * head (`wrunPredictionMarketWalledInput`) read this one rule.
105
+ */
106
+ export declare function wrunPredictionMarketWalls(req: Pick<WrunInputRequirement, 'kind' | 'followsCoin'>, exchange: string | undefined | null): boolean;
107
+ /**
108
+ * The first input of a sheet the prediction-market wall refuses on `exchange` (`wrunPredictionMarketWalls`), with its
109
+ * source class, in input order. Undefined off a prediction venue, or when no input the market demands reads by the
110
+ * chart's coin: the sheet is the one the run reads there (its settings applied and its lane demand at the market's size
111
+ * unit, so a `when` setting that is off or a `needed_by` leaving the unit out marks the input `undemanded`).
112
+ */
113
+ export declare function wrunPredictionMarketWalledInput(sheet: WrunIndicatorMetadata, exchange: string | undefined | null): {
114
+ name: string;
115
+ sourceClass: string;
116
+ } | undefined;
84
117
  /**
85
118
  * Whether an input reads its declared fill over an empty lane instead of holding the run (the
86
119
  * honest-picture rule's quiet reader): a scalar input's `missing: "nan"` blanks the outputs it
@@ -120,6 +153,8 @@ export interface WrunUnservedLane {
120
153
  exchange: string;
121
154
  symbol: string;
122
155
  };
156
+ /** The run market a lane on the chart's own market was judged on (a Trades chart's tape); absent: the chart's. */
157
+ judgedExchange?: string;
123
158
  /** The first reader the market demands (by input index) that cannot draw without the lane
124
159
  * (`wrunInputDrawsWithoutLane`): the run refuses by its name. Absent: the lane stays undispatched
125
160
  * and every reader reads its fill. */
@@ -151,5 +186,38 @@ export declare function wrunUnservedLanes(sheet: Pick<WrunIndicatorMetadata, 'in
151
186
  coin: string;
152
187
  }, opts?: {
153
188
  nativeLanes?: readonly string[];
189
+ runMarket?: {
190
+ exchange: string;
191
+ } | null;
154
192
  }): WrunUnservedLane[];
193
+ /** How a lane class reads the run market: where its trades print, where its rows came from, the chart's own, none. */
194
+ export type WrunRunMarketRead = 'run-market' | 'candle-source' | 'chart-market' | 'none';
195
+ /** Every lane class declares its read here: a class left out reads the stored market by accident (the guard spec). */
196
+ export declare const WRUN_RUN_MARKET_READS: Readonly<Record<string, WrunRunMarketRead>>;
197
+ /** A lane class's read, undefined for a class the table does not name. */
198
+ export declare function wrunRunMarketReadOfClass(sourceClass: unknown): WrunRunMarketRead | undefined;
199
+ /** The chart fetch type a class asks its chart-market rows through, undefined when it asks none of its own. */
200
+ export declare function wrunRunMarketFetchTypeOf(sourceClass: string): string | undefined;
201
+ /** How an ask of a fetch type reads the run market (`fetchLane` decides by its type); an unlisted type stays put. */
202
+ export declare function wrunRunMarketReadOfFetchType(type: string): WrunRunMarketRead;
203
+ /** The market a class reading the chart's own market is judged on: the run market, which then names its facts. */
204
+ export declare function wrunRunMarketOn(sourceClass: string, market: {
205
+ exchange: string | undefined;
206
+ coin: string;
207
+ }, runMarket: {
208
+ exchange: string;
209
+ } | null | undefined): {
210
+ exchange: string | undefined;
211
+ coin: string;
212
+ };
213
+ /** Whether a sheet reads the run market: a demanded input of a run-market class on the chart's own market. */
214
+ export declare function wrunSheetReadsRunMarket(sheet: Pick<WrunIndicatorMetadata, 'inputs' | 'inputSources'>): boolean;
215
+ /** Whether a source reads the run market: a run-market type on the chart's own market (history pin and live map). */
216
+ export declare function wrunSourceReadsRunMarket(type: string, payload: {
217
+ exchange?: unknown;
218
+ symbol?: unknown;
219
+ }, chart: {
220
+ exchange?: unknown;
221
+ symbol?: unknown;
222
+ } | null | undefined): boolean;
155
223
  export {};
@@ -11,6 +11,7 @@
11
11
  */
12
12
  import { Intervals } from '../../constants/interval.constants.js';
13
13
  import { wrunLaneServiceOnMarket } from '../chart/index-mode-admission.util.js';
14
+ import { isPredictionExchangeName } from '../chart/prediction-identity.util.js';
14
15
  import { wrunFollowsCoin } from './wrun-market-facts.util.js';
15
16
  import { WRUN_OPTION_SUMMARY_LANES } from './wrun-option-summary-lane.util.js';
16
17
  import { wrunRowLaneClasses, wrunRowLaneOfClass } from './sources/row-lane-registry.js';
@@ -29,8 +30,7 @@ export const CHART_MARKET_GATEWAY_TYPES = Object.freeze({
29
30
  oi: 'OPEN_INTEREST_AGG',
30
31
  volume_profile: 'VOLUME_PROFILE_AGG',
31
32
  trade_volume_by_size: 'TRADE_VOLUME_BY_SIZE_AGG',
32
- // The tape's live prints ride the raw TRADE channel (its history reads TRADE_LARGE, a copy of the
33
- // same prints): the markets that list raw trades.
33
+ // Listed by TRADE: the registrar lists no TRADE_LARGE twin, though the tape reads TRADE_LARGE rows.
34
34
  tape: 'TRADE',
35
35
  liquidations: 'LIQUIDATION_AGG',
36
36
  funding: 'FUNDING_RATE_AGG',
@@ -255,7 +255,8 @@ export function wrunInputRequirements(effectiveSheet) {
255
255
  // undemanded input nowhere, so it keeps `needed_by`).
256
256
  const neededBy = source?.needed_by?.size_unit;
257
257
  const keepsNeededBy = row.kind !== 'pinned' && (row.kind !== 'options' || row.sourceClass !== undefined);
258
- const shape = Array.isArray(neededBy) && keepsNeededBy ? { ...row, neededBy } : row;
258
+ const demanded = Array.isArray(neededBy) && keepsNeededBy ? { ...row, neededBy } : row;
259
+ const shape = source !== undefined && wrunFollowsCoin(source) ? { ...demanded, followsCoin: true } : demanded;
259
260
  const key = JSON.stringify(shape);
260
261
  // Whether the input is optional rides beside the shape, never in it: inputs that need the same
261
262
  // thing share one requirement whatever fills they declare.
@@ -277,6 +278,55 @@ export function wrunInputRequirements(effectiveSheet) {
277
278
  return [...byKey.values()];
278
279
  }
279
280
  // ---------------------------------------------------------------------------
281
+ // The prediction-market wall
282
+ // ---------------------------------------------------------------------------
283
+ /**
284
+ * Whether a requirement reads by the chart's coin: the options chain and every chain lane (`options`: the chain
285
+ * decision reads the coin's chain on a market that is no options venue), every provider lane (`provider`: its coin
286
+ * list, the Deribit coin set or the chart's coin itself) and every coin leg (`followsCoin`: the coin's market on
287
+ * another venue). Every other input reads the chart market's own series, a pinned market, a governed plane or
288
+ * nothing of the market.
289
+ */
290
+ export function wrunRequirementReadsChartCoin(req) {
291
+ return req.kind === 'options' || req.kind === 'provider' || req.followsCoin === true;
292
+ }
293
+ /**
294
+ * The prediction-market wall (Kyle 2026-10-29: options indicators on a Polymarket chart make no sense). A prediction
295
+ * market's price is the odds of an outcome, and the coin its chart carries is no asset that price follows: the symbol
296
+ * pipeline's coin match places no series key and answers BTC (symbol-resolve.util `getCoin`), and an event about a coin
297
+ * names that coin. An input read by the chart's coin (`wrunRequirementReadsChartCoin`) would draw another market's
298
+ * options, volatility or flows under the odds, so every prediction venue (`isPredictionExchangeName`: Polymarket,
299
+ * HIP4) refuses it whatever fill it declares: a wall like the CME and OPRA ones, since the fill would stand in for a
300
+ * series the market can never have. Whether the market reads the input at all (`needed_by`, a `when` setting) is the
301
+ * caller's to settle first. The picker's verdict and the works-on list (wrun-input-requirements.util) and the run's
302
+ * head (`wrunPredictionMarketWalledInput`) read this one rule.
303
+ */
304
+ export function wrunPredictionMarketWalls(req, exchange) {
305
+ return wrunRequirementReadsChartCoin(req) && isPredictionExchangeName(exchange);
306
+ }
307
+ /**
308
+ * The first input of a sheet the prediction-market wall refuses on `exchange` (`wrunPredictionMarketWalls`), with its
309
+ * source class, in input order. Undefined off a prediction venue, or when no input the market demands reads by the
310
+ * chart's coin: the sheet is the one the run reads there (its settings applied and its lane demand at the market's size
311
+ * unit, so a `when` setting that is off or a `needed_by` leaving the unit out marks the input `undemanded`).
312
+ */
313
+ export function wrunPredictionMarketWalledInput(sheet, exchange) {
314
+ if (!isPredictionExchangeName(exchange))
315
+ return undefined;
316
+ for (const req of wrunInputRequirements(sheet)) {
317
+ if (!wrunPredictionMarketWalls(req, exchange))
318
+ continue;
319
+ for (const name of req.inputs) {
320
+ const source = sheet.inputSources?.[name];
321
+ if (source?.undemanded === true)
322
+ continue;
323
+ const sourceClass = source?.source ?? sheet.inputs.find((input) => input.name === name)?.source;
324
+ return { name, sourceClass: typeof sourceClass === 'string' ? sourceClass : '' };
325
+ }
326
+ }
327
+ return undefined;
328
+ }
329
+ // ---------------------------------------------------------------------------
280
330
  // The run's admission (the capability rule, WRUN-REFUSALS U3a step 5)
281
331
  // ---------------------------------------------------------------------------
282
332
  /**
@@ -418,6 +468,10 @@ export function wrunUnservedLanes(sheet, market, opts = {}) {
418
468
  ...verdict,
419
469
  inputNames: readers.map((input) => input.name),
420
470
  ...(legMarket !== undefined ? { market: legMarket } : {}),
471
+ // The refusal's words name the market the lane was judged on, never the stored one it never read.
472
+ ...(legMarket === undefined && on.exchange !== market.exchange && on.exchange !== undefined
473
+ ? { judgedExchange: on.exchange }
474
+ : {}),
421
475
  ...(holding !== undefined ? { holding: { name: holding.name, celled: holding.cellType === 'array' } } : {}),
422
476
  });
423
477
  };
@@ -426,18 +480,20 @@ export function wrunUnservedLanes(sheet, market, opts = {}) {
426
480
  const source = sheet.inputSources[input.name];
427
481
  return source?.source === lane && source.undemanded !== true;
428
482
  });
483
+ // A class on the chart's own market is judged on the run market (a Trades chart's tape), never the stored one.
484
+ const own = wrunRunMarketOn(lane, market, opts.runMarket);
429
485
  if (lane !== 'trades' && !isWrunLaneStreamClass(lane)) {
430
- judge(lane, readers, market);
486
+ judge(lane, readers, own);
431
487
  continue;
432
488
  }
433
489
  // A pinned trades input (and a lane stream pinned to another market) is judged on its leg's market; an
434
490
  // unresolved coin leg or a half pin nowhere (the row builder refuses it by name).
435
- const own = [];
491
+ const ownReaders = [];
436
492
  const legs = new Map();
437
493
  for (const input of readers) {
438
494
  const { exchange, symbol, ...source } = sheet.inputSources[input.name];
439
495
  if (exchange === undefined && symbol === undefined && !wrunFollowsCoin(source))
440
- own.push(input);
496
+ ownReaders.push(input);
441
497
  else if (typeof exchange === 'string' && typeof symbol === 'string') {
442
498
  const key = `${exchange}|${symbol}`;
443
499
  const leg = legs.get(key) ?? { market: { exchange, symbol }, readers: [] };
@@ -445,9 +501,109 @@ export function wrunUnservedLanes(sheet, market, opts = {}) {
445
501
  legs.set(key, leg);
446
502
  }
447
503
  }
448
- judge(lane, own, market);
504
+ judge(lane, ownReaders, own);
449
505
  for (const leg of legs.values())
450
506
  judge(lane, leg.readers, { exchange: leg.market.exchange, coin: market.coin }, leg.market);
451
507
  }
452
508
  return unserved;
453
509
  }
510
+ /** Every lane class declares its read here: a class left out reads the stored market by accident (the guard spec). */
511
+ export const WRUN_RUN_MARKET_READS = Object.freeze({
512
+ // Built from the chart's trades, so asked where they print (the decider awaited once, before the capability rule).
513
+ trades: 'run-market',
514
+ volume_profile: 'run-market',
515
+ trade_volume_by_size: 'run-market',
516
+ tape: 'run-market',
517
+ volume_profile_candles: 'run-market',
518
+ // The chart's candles: the rows' own market in the series ref alone, synchronous, so the shape stays the chart's.
519
+ ohlcv: 'candle-source',
520
+ candles: 'candle-source',
521
+ intrabar: 'candle-source',
522
+ // The chart's own market, judged on the run market (no tape serves them, so a Trades chart drops them by its facts).
523
+ book: 'chart-market',
524
+ oi: 'chart-market',
525
+ oi_candles: 'chart-market',
526
+ liquidations: 'chart-market',
527
+ funding: 'chart-market',
528
+ long_short_ratio: 'chart-market',
529
+ // A pinned market, a provider or coin series, an options chain or the bar clock: no chart market to move.
530
+ odds: 'none',
531
+ time: 'none',
532
+ implied_volatility: 'none',
533
+ skew: 'none',
534
+ etf_flow: 'none',
535
+ options_chain: 'none',
536
+ bitfinex_funding: 'none',
537
+ economic: 'none',
538
+ etf_holdings: 'none',
539
+ etf_premium: 'none',
540
+ ethena_positions: 'none',
541
+ option_daily: 'none',
542
+ option_stats_10m: 'none',
543
+ options_flow: 'none',
544
+ options_oi: 'none',
545
+ options_volume: 'none',
546
+ series: 'none',
547
+ token_supply: 'none',
548
+ treasury_balance: 'none',
549
+ volatility_index: 'none',
550
+ option_contract_flow: 'none',
551
+ option_contract_state: 'none',
552
+ option_prints: 'none',
553
+ option_strike_flow: 'none',
554
+ option_strikes: 'none',
555
+ option_surface: 'none',
556
+ });
557
+ /** A lane class's read, undefined for a class the table does not name. */
558
+ export function wrunRunMarketReadOfClass(sourceClass) {
559
+ return typeof sourceClass === 'string' && Object.hasOwn(WRUN_RUN_MARKET_READS, sourceClass)
560
+ ? WRUN_RUN_MARKET_READS[sourceClass]
561
+ : undefined;
562
+ }
563
+ /** The chart fetch type a class asks its chart-market rows through, undefined when it asks none of its own. */
564
+ export function wrunRunMarketFetchTypeOf(sourceClass) {
565
+ if (isWrunLegStreamClass(sourceClass))
566
+ return WRUN_LEG_STREAM_CLASSES[sourceClass].fetchType;
567
+ if (sourceClass === 'ohlcv' || sourceClass === 'intrabar')
568
+ return 'ohlcv';
569
+ return WRUN_ADMISSION_LANES.get(sourceClass);
570
+ }
571
+ /** The read of each fetch type, built once from the class table (the guard spec holds its classes to one read). */
572
+ const WRUN_RUN_MARKET_READ_BY_FETCH_TYPE = new Map(Object.entries(WRUN_RUN_MARKET_READS).flatMap(([sourceClass, read]) => {
573
+ const fetchType = wrunRunMarketFetchTypeOf(sourceClass);
574
+ return fetchType === undefined ? [] : [[fetchType, read]];
575
+ }));
576
+ /** How an ask of a fetch type reads the run market (`fetchLane` decides by its type); an unlisted type stays put. */
577
+ export function wrunRunMarketReadOfFetchType(type) {
578
+ return WRUN_RUN_MARKET_READ_BY_FETCH_TYPE.get(type) ?? 'chart-market';
579
+ }
580
+ /** The market a class reading the chart's own market is judged on: the run market, which then names its facts. */
581
+ export function wrunRunMarketOn(sourceClass, market, runMarket) {
582
+ const read = WRUN_RUN_MARKET_READS[sourceClass];
583
+ return runMarket && (read === 'run-market' || read === 'chart-market')
584
+ ? { exchange: runMarket.exchange, coin: market.coin }
585
+ : market;
586
+ }
587
+ /** Whether a sheet reads the run market: a demanded input of a run-market class on the chart's own market. */
588
+ export function wrunSheetReadsRunMarket(sheet) {
589
+ return sheet.inputs.some((input) => {
590
+ const source = sheet.inputSources[input.name];
591
+ if (source === undefined || source.undemanded === true)
592
+ return false;
593
+ if (wrunRunMarketReadOfClass(source.source) !== 'run-market')
594
+ return false;
595
+ return source.exchange === undefined && source.symbol === undefined && !wrunFollowsCoin(source);
596
+ });
597
+ }
598
+ /** Whether a source reads the run market: a run-market type on the chart's own market (history pin and live map). */
599
+ export function wrunSourceReadsRunMarket(type, payload, chart) {
600
+ if (wrunRunMarketReadOfFetchType(type.toLowerCase()) !== 'run-market')
601
+ return false;
602
+ // The engine's current-market placeholders name the chart's own market.
603
+ const exchange = payload.exchange === 'currentExchange' || payload.exchange === undefined ? chart?.exchange : payload.exchange;
604
+ const symbol = payload.symbol === 'currentSymbol' ? chart?.symbol : payload.symbol;
605
+ return (typeof exchange === 'string' &&
606
+ exchange === chart?.exchange &&
607
+ typeof symbol === 'string' &&
608
+ symbol === chart?.symbol);
609
+ }