@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.
- package/README.md +2 -0
- package/dist/constants/feature-flags.constants.d.ts +15 -1
- package/dist/constants/feature-flags.constants.js +130 -24
- package/dist/constants/governed-exchanges.constants.d.ts +12 -0
- package/dist/constants/governed-exchanges.constants.js +16 -0
- package/dist/constants/opra-compliance.constants.d.ts +3 -2
- package/dist/constants/opra-compliance.constants.js +3 -2
- package/dist/constants/option-venues.constants.d.ts +2 -2
- package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +20 -20
- package/dist/constants/venue-presets.constants.js +24 -26
- package/dist/host-env.d.ts +21 -5
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +102 -19
- package/dist/index.d.ts +18 -0
- package/dist/index.js +18 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +1 -1
- package/dist/interfaces/cme-realtime.interface.d.ts +16 -9
- package/dist/interfaces/cme-realtime.interface.js +6 -3
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +12 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +1 -5
- package/dist/interfaces/prediction-market.interface.d.ts +7 -0
- package/dist/interfaces/replay.interface.d.ts +8 -0
- package/dist/interfaces/stocks-realtime.interface.d.ts +57 -0
- package/dist/interfaces/stocks-realtime.interface.js +32 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +62 -94
- package/dist/kscript-data/controls/live-trades-merge.util.js +106 -171
- package/dist/market-data/billing.interface.d.ts +174 -36
- package/dist/market-data/billing.interface.js +58 -8
- package/dist/market-data/venue.d.ts +152 -7
- package/dist/market-data/venues/cme.contract.copy.json +66 -0
- package/dist/market-data/venues/cme.d.ts +126 -0
- package/dist/market-data/venues/cme.js +133 -0
- package/dist/market-data/venues/index.d.ts +294 -7
- package/dist/market-data/venues/index.js +49 -6
- package/dist/market-data/venues/opra.contract.copy.json +3 -2
- package/dist/market-data/venues/opra.d.ts +2 -2
- package/dist/market-data/venues/opra.js +5 -2
- package/dist/market-data/venues/stocks.contract.copy.json +64 -0
- package/dist/market-data/venues/stocks.d.ts +130 -0
- package/dist/market-data/venues/stocks.js +117 -0
- package/dist/settings-templates/footprint-rows.js +35 -2
- package/dist/settings-templates/form-rows.d.ts +2 -1
- package/dist/settings-templates/index.js +7 -3
- package/dist/settings-templates/indicator-fields.d.ts +5 -4
- package/dist/settings-templates/indicator-fields.js +79 -10
- package/dist/settings-templates/tool-rules.d.ts +32 -15
- package/dist/settings-templates/tool-rules.js +33 -11
- package/dist/settings-templates/tool-tables.generated.js +95 -31
- package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
- package/dist/utility/chart/book-live-bucket.util.js +47 -0
- package/dist/utility/chart/cme-cache-context.util.d.ts +5 -3
- package/dist/utility/chart/cme-cache-context.util.js +10 -6
- package/dist/utility/chart/cme-realtime.util.js +10 -0
- package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +83 -0
- package/dist/utility/chart/cme-user-scripts-gate.util.js +142 -0
- package/dist/utility/chart/effective-chart-session.util.d.ts +14 -0
- package/dist/utility/chart/effective-chart-session.util.js +39 -0
- package/dist/utility/chart/host-bar-placement.util.d.ts +28 -0
- package/dist/utility/chart/host-bar-placement.util.js +170 -30
- package/dist/utility/chart/index-host-tier.util.d.ts +3 -1
- package/dist/utility/chart/index-host-tier.util.js +7 -2
- package/dist/utility/chart/index-mode-admission.util.js +30 -3
- package/dist/utility/chart/kscript-apply-fingerprint.util.js +1 -1
- package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +9 -7
- package/dist/utility/chart/kscript-live-coalesce.util.js +13 -8
- package/dist/utility/chart/kscript-live-source-identity.util.d.ts +9 -0
- package/dist/utility/chart/kscript-live-source-identity.util.js +10 -1
- package/dist/utility/chart/kscript-provenance-keys.util.js +13 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +5 -1
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +156 -43
- package/dist/utility/chart/kscript-venue-policy.util.js +249 -59
- package/dist/utility/chart/live-bucket.util.d.ts +24 -8
- package/dist/utility/chart/live-bucket.util.js +85 -27
- package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
- package/dist/utility/chart/market-session-schedule.util.js +16 -0
- package/dist/utility/chart/marketKind.util.js +5 -0
- package/dist/utility/chart/mixed-mode.util.d.ts +7 -0
- package/dist/utility/chart/mixed-mode.util.js +14 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
- package/dist/utility/chart/opra-read-access.leaf.js +5 -3
- package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +11 -16
- package/dist/utility/chart/opra-user-scripts-gate.util.js +12 -28
- package/dist/utility/chart/rth-session.util.d.ts +12 -10
- package/dist/utility/chart/rth-session.util.js +25 -21
- package/dist/utility/chart/trading-day.util.d.ts +17 -0
- package/dist/utility/chart/trading-day.util.js +59 -0
- package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
- package/dist/utility/chart/window-geometry.leaf.js +22 -6
- package/dist/utility/chart/window-owner.leaf.d.ts +23 -2
- package/dist/utility/chart/window-owner.leaf.js +45 -3
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +33 -15
- package/dist/utility/chart/wrun-bar-session-facts.util.js +70 -20
- package/dist/utility/chart/wrun-run-result.util.d.ts +12 -0
- package/dist/utility/chart/wrun-run-result.util.js +141 -6
- package/dist/utility/intl-locale.util.js +5 -0
- package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
- package/dist/utility/options/option-bar-anchor.util.js +340 -0
- package/dist/utility/options/option-venue.util.d.ts +18 -0
- package/dist/utility/options/option-venue.util.js +27 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +4 -0
- package/dist/utility/v2/gate-plane.util.d.ts +12 -3
- package/dist/utility/v2/gate-plane.util.js +30 -4
- package/dist/utility/v2/gate-session-latch.util.js +1 -1
- package/dist/utility/v2/stocks-governed.util.d.ts +16 -0
- package/dist/utility/v2/stocks-governed.util.js +34 -0
- package/dist/utility/wrun/derived-roots.leaf.d.ts +13 -0
- package/dist/utility/wrun/derived-roots.leaf.js +27 -0
- package/dist/utility/wrun/derived-roots.util.d.ts +205 -0
- package/dist/utility/wrun/derived-roots.util.js +451 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +43 -7
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -2
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -2
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +24 -3
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +46 -10
- package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
- package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +2 -1
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +3 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +19 -4
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +52 -13
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +88 -19
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +2 -1
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +24 -9
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +41 -10
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +111 -0
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +133 -0
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +15 -3
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +22 -3
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +197 -13
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +761 -27
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +1 -2
- package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +60 -16
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +113 -61
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +33 -0
- package/dist/utility/wrun/wrun-download-meter.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +14 -2
- package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
- package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
- package/dist/utility/wrun/wrun-frames.d.ts +27 -6
- package/dist/utility/wrun/wrun-frames.js +73 -10
- package/dist/utility/wrun/wrun-handles.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-handles.util.js +9 -8
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +18 -4
- package/dist/utility/wrun/wrun-hud-looks.util.js +45 -13
- package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +68 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +163 -7
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +59 -23
- package/dist/utility/wrun/wrun-leg-close.util.js +186 -28
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +35 -15
- package/dist/utility/wrun/wrun-live-intake.util.js +243 -126
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +13 -5
- package/dist/utility/wrun/wrun-live-tick.util.js +279 -99
- package/dist/utility/wrun/wrun-market-facts.util.d.ts +13 -3
- package/dist/utility/wrun/wrun-market-facts.util.js +13 -3
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +60 -11
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +70 -5
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +31 -5
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
- package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
- package/dist/utility/wrun/wrun-option-book-rows.util.d.ts +56 -0
- package/dist/utility/wrun/wrun-option-book-rows.util.js +96 -0
- package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
- package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +23 -6
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +47 -11
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +86 -19
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +168 -62
- package/dist/utility/wrun/wrun-option-views.util.d.ts +323 -28
- package/dist/utility/wrun/wrun-option-views.util.js +484 -71
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-options-chain.util.js +2 -0
- package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-output-style.util.js +20 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +32 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +13 -3
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +3 -1
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +160 -42
- package/dist/utility/wrun/wrun-overlay-run.util.js +1244 -209
- package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +114 -19
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +10 -9
- package/dist/utility/wrun/wrun-panel-style.util.js +58 -9
- package/dist/utility/wrun/wrun-param-map.util.d.ts +14 -11
- package/dist/utility/wrun/wrun-param-map.util.js +10 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +14 -4
- package/dist/utility/wrun/wrun-param-values.util.js +4 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +15 -2
- package/dist/utility/wrun/wrun-pin-spelling.util.js +39 -14
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-refusal.util.js +22 -0
- package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +26 -0
- package/dist/utility/wrun/wrun-registry-errors.util.js +34 -0
- package/dist/utility/wrun/wrun-replay-lane.util.js +3 -2
- package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +20 -6
- package/dist/utility/wrun/wrun-run-interval-session.util.js +22 -7
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +43 -9
- package/dist/utility/wrun/wrun-run-interval.util.js +58 -15
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +45 -1
- package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
- package/dist/utility/wrun/wrun-socket-row-source.js +118 -8
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +29 -18
- package/dist/utility/wrun/wrun-source-rows.util.js +61 -27
- package/dist/utility/wrun/wrun-style-words.util.js +6 -4
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
- package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-tape-per-order.util.js +7 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +17 -9
- package/dist/utility/wrun/wrun-tape-source.util.js +20 -12
- package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
- package/dist/utils/replay/replay-buffer-math.js +227 -20
- package/dist/workers/constants/socket-slots.d.ts +91 -6
- package/dist/workers/constants/socket-slots.js +85 -6
- package/package.json +5 -5
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { type OverlayRunInterval } from '../chart/indicator-run-interval.util.js';
|
|
2
|
+
/** The chart's session fields a replaying chart's session market reads (isWrunRunIntervalSessionMarket). */
|
|
3
|
+
export interface WrunChartSessionFields {
|
|
4
|
+
symbol?: unknown;
|
|
5
|
+
sessionType?: unknown;
|
|
6
|
+
}
|
|
2
7
|
/** The param a twin selects its timeframe with, and the one that says whether to wait for closes. */
|
|
3
8
|
export declare const WRUN_TIMEFRAME_PARAM = "timeframe";
|
|
4
9
|
export declare const WRUN_WAIT_FOR_CLOSE_PARAM = "wait_for_close";
|
|
@@ -37,7 +42,7 @@ export interface WrunRunIntervalInput {
|
|
|
37
42
|
settings: unknown;
|
|
38
43
|
/** The chart's interval, as a key ("5m") or milliseconds. */
|
|
39
44
|
chartInterval: unknown;
|
|
40
|
-
/** Market replay keeps the package's own path. */
|
|
45
|
+
/** Market replay keeps the package's own path, except on a session market (`sessionMarket`). */
|
|
41
46
|
replay?: boolean;
|
|
42
47
|
/** An index-mode chart (forex, equities, DEX) keeps the package's own path. */
|
|
43
48
|
indexMode?: boolean;
|
|
@@ -48,6 +53,12 @@ export interface WrunRunIntervalInput {
|
|
|
48
53
|
* the session lattice: OverlayRunInterval.sessionLattice).
|
|
49
54
|
*/
|
|
50
55
|
unsupportedMarket?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The chart's market rides a session calendar (isWrunRunIntervalSessionMarket): its run bars are
|
|
58
|
+
* no fold of the epoch grid the package's own resampler keys, so market replay runs at the run
|
|
59
|
+
* interval there too, on the run bars the live run computes over.
|
|
60
|
+
*/
|
|
61
|
+
sessionMarket?: boolean;
|
|
51
62
|
}
|
|
52
63
|
/** The label of the timeframe option a twin's settings select: through its persisted select's
|
|
53
64
|
* `optionLabels`, else the twins' fixed list. Undefined when unreadable. */
|
|
@@ -59,8 +70,10 @@ export declare function wrunTimeframeLabel(settings: unknown): string | undefine
|
|
|
59
70
|
* chart path too, its Timeframe forced to the chart option in the init args
|
|
60
71
|
* (wrunSettingsForRunInterval): its selected-timeframe branch shows each bar one closed bar late at
|
|
61
72
|
* the chart's interval and refuses (or draws nothing) below it. Read the built-in's way: every
|
|
62
|
-
*
|
|
63
|
-
*
|
|
73
|
+
* port of a built-in (`builtinPortOf`: the proven twin's stamp or the package itself, so the store's
|
|
74
|
+
* copy of a port reads as the Indicators list's), listed in WRUN_RUN_INTERVAL_TWINS or not, on
|
|
75
|
+
* replay, index mode and the unsupported markets alike; an authored Indicator's own `timeframe`
|
|
76
|
+
* param is its author's.
|
|
64
77
|
*/
|
|
65
78
|
export declare function wrunTimeframeIsChartOrFiner(settings: unknown, chartInterval: unknown): boolean;
|
|
66
79
|
/** Whether a twin waits for the selected bar to close (the param defaults on). */
|
|
@@ -68,9 +81,10 @@ export declare function wrunWaitsForClose(settings: unknown): boolean;
|
|
|
68
81
|
/**
|
|
69
82
|
* The interval a wrun overlay's package runs at when it is coarser than the chart's, else null (the
|
|
70
83
|
* package runs on the chart's bars, as before): a proven twin listed in WRUN_RUN_INTERVAL_TWINS,
|
|
71
|
-
* off
|
|
72
|
-
*
|
|
73
|
-
* is the chart's own
|
|
84
|
+
* off index mode and the markets one candle ask cannot serve (`unsupportedMarket`), live or in
|
|
85
|
+
* replay on a session market (`sessionMarket`, the live run's bars), whose timeframe selects an
|
|
86
|
+
* interval coarser than the chart. A selection at or below the chart's interval is the chart's own
|
|
87
|
+
* (wrunTimeframeIsChartOrFiner).
|
|
74
88
|
*/
|
|
75
89
|
export declare function resolveWrunRunInterval(input: WrunRunIntervalInput): WrunRunInterval | null;
|
|
76
90
|
/** Whether one candle ask at the chart's venue and symbol cannot stand in for the chart's own series
|
|
@@ -79,16 +93,36 @@ export declare function resolveWrunRunInterval(input: WrunRunIntervalInput): Wru
|
|
|
79
93
|
* (isRunIntervalUnsupportedMarket), a CME-family venue is supported: its run bars are read on the
|
|
80
94
|
* session lattice. */
|
|
81
95
|
export declare function isWrunRunIntervalUnsupportedMarket(exchange: string | undefined, transformations: string | null | undefined): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Whether a chart's market rides a session calendar its twins' own resampler cannot fold from the
|
|
98
|
+
* chart's bars (see WrunRunIntervalInput.sessionMarket): a venue on the CME session lattice
|
|
99
|
+
* (isCmeSessionLatticeExchange: its 4h bars on the 17:00 Chicago lattice), or a chart whose own bars
|
|
100
|
+
* ride a session filter (wrunBarsSessionFiltered at the chart's interval: RTH on a CME chart, where
|
|
101
|
+
* a run bar above 30m is anchored on the session open and a 1D run bar holds the whole session).
|
|
102
|
+
*/
|
|
103
|
+
export declare function isWrunRunIntervalSessionMarket(exchange: string | undefined, chart: WrunChartSessionFields | null | undefined, chartInterval: unknown): boolean;
|
|
82
104
|
/**
|
|
83
105
|
* The run interval of one mounted wrun overlay: its settings against the chart's interval, venue,
|
|
84
|
-
* series (`chartTransformations`, a formula chart's legs)
|
|
106
|
+
* series (`chartTransformations`, a formula chart's legs), session (`chartMarket`: the symbol and the
|
|
107
|
+
* session type a replaying chart's session market reads) and replay state. `chartExchange` is the
|
|
85
108
|
* chart's venue; omitted, the overlay's own `settings.exchange` stands in. A venue that rides the CME
|
|
86
109
|
* session lattice (CME, CBOT, NYMEX, COMEX: isCmeSessionLatticeExchange, the rule the chart's own
|
|
87
|
-
* live bars and the run bars' live fold key on) stamps the run `sessionLattice`.
|
|
110
|
+
* live bars and the run bars' live fold key on) stamps the run `sessionLattice`. The same question
|
|
111
|
+
* with replay off is liveOverlayWrunRunInterval.
|
|
88
112
|
*/
|
|
89
113
|
export declare function overlayWrunRunInterval(chartIndex: number, overlay: {
|
|
90
114
|
settings?: unknown;
|
|
91
|
-
} | null | undefined, chartInterval: unknown, chartExchange?: string | null, chartTransformations?: string | null): WrunRunInterval | null;
|
|
115
|
+
} | null | undefined, chartInterval: unknown, chartExchange?: string | null, chartTransformations?: string | null, chartMarket?: WrunChartSessionFields | null): WrunRunInterval | null;
|
|
116
|
+
/**
|
|
117
|
+
* The run interval of one mounted wrun overlay as a live run computes it, whatever the chart's replay:
|
|
118
|
+
* overlayWrunRunInterval's settings, venue, series and session with replay off. The alerts engine
|
|
119
|
+
* evaluates live, so an Indicator arm made while its chart replays reads what live reads
|
|
120
|
+
* (alert-overlay-target `runsAtOwnTimeframe`), where the replay run keeps the package's own path off a
|
|
121
|
+
* session market.
|
|
122
|
+
*/
|
|
123
|
+
export declare function liveOverlayWrunRunInterval(overlay: {
|
|
124
|
+
settings?: unknown;
|
|
125
|
+
} | null | undefined, chartInterval: unknown, chartExchange?: string | null, chartTransformations?: string | null, chartMarket?: WrunChartSessionFields | null): WrunRunInterval | null;
|
|
92
126
|
/**
|
|
93
127
|
* The settings a run at another interval sends the package: the twin's `timeframe` forced to its
|
|
94
128
|
* chart option, on a copy. Only the values the package computes with (the init args); the
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Run interval for the wrun Indicators that stand in for the built-ins (WRUN-HTF-NATIVE-PLAN.md):
|
|
3
3
|
* TradingView's Timeframe model, at the host.
|
|
4
4
|
*
|
|
5
|
-
* A
|
|
5
|
+
* A built-in's port (`builtinPortOf`, wrun-builtin-twin.util: the proven twin's stamp or the
|
|
6
|
+
* package itself, whichever door mounted it) carries the built-in's `timeframe`
|
|
6
7
|
* select (option values "0".."7", labels chart, 5m, 15m, 30m, 1h, 4h, 1D, 1W) and, inside the
|
|
7
8
|
* package, rebuilt the selected timeframe from the chart's loaded bars (./sdk/resample), so smoothed
|
|
8
9
|
* values never settled and long windows stayed blank until the user zoomed out. When the selected
|
|
@@ -25,14 +26,24 @@
|
|
|
25
26
|
* rule reads a run bar's span on the session calendar (runBarSpan: a 1D bar is its trade date,
|
|
26
27
|
* stamped 00:00Z after its 17:00 Chicago open; a 1W bar its trade-date week; a 4h bar the 17:00
|
|
27
28
|
* lattice) and steps over the session gaps, as the built-in's native higher-timeframe leg does.
|
|
29
|
+
*
|
|
30
|
+
* Market replay runs a twin on the same run bars as live wherever they ride a session calendar
|
|
31
|
+
* (isWrunRunIntervalSessionMarket: the CME session lattice, a chart on a session filter such as RTH):
|
|
32
|
+
* the package's own resampler keys its 5m to 4h buckets on the epoch grid, so on an RTH chart its 1h
|
|
33
|
+
* would fold UTC hours (under daylight time 13:00Z holds the 09:30 and 09:45 bars) where the live run
|
|
34
|
+
* steps on the 09:30-anchored hours. The replay lane computes the run bars as of its cutoff
|
|
35
|
+
* (wrunReplayRunBars). Everywhere else replay keeps the package's own path: its fold of the chart's
|
|
36
|
+
* bars is the run bars' own grid.
|
|
28
37
|
*/
|
|
29
38
|
import { wrunChartHostEnv } from '../../host-env.js';
|
|
30
39
|
import { runIntervalOfTimeframeLabel, timeframeIsChartOrFiner, } from '../chart/indicator-run-interval.util.js';
|
|
31
40
|
import { isCmeSessionLatticeExchange } from '../chart/cme-session-bucket.util.js';
|
|
32
41
|
import { checkIsIndexMode } from '../chart/index-mode.util.js';
|
|
42
|
+
import { chartIntervalToMs } from '../chart/rth-session.util.js';
|
|
33
43
|
import { isRunIntervalUnservableMarket } from '../chart/run-interval-unservable.leaf.js';
|
|
34
44
|
import { runIntervalWarmupBars } from '../chart/run-interval-warmup.leaf.js';
|
|
35
|
-
import {
|
|
45
|
+
import { builtinPortOf } from './wrun-builtin-twin.util.js';
|
|
46
|
+
import { wrunBarsSessionFiltered } from './wrun-run-interval-session.util.js';
|
|
36
47
|
/** The param a twin selects its timeframe with, and the one that says whether to wait for closes. */
|
|
37
48
|
export const WRUN_TIMEFRAME_PARAM = 'timeframe';
|
|
38
49
|
export const WRUN_WAIT_FOR_CLOSE_PARAM = 'wait_for_close';
|
|
@@ -107,7 +118,7 @@ export const WRUN_RUN_INTERVAL_TWINS = {
|
|
|
107
118
|
* own bars hands it to the warm-up ask as the declared lookback (local-kscript-warmup-backfill-ask.util).
|
|
108
119
|
*/
|
|
109
120
|
export function wrunTwinLookbackBars(settings) {
|
|
110
|
-
const twin =
|
|
121
|
+
const twin = builtinPortOf(settings);
|
|
111
122
|
const lookback = twin ? WRUN_RUN_INTERVAL_TWINS[twin] : undefined;
|
|
112
123
|
return lookback ? lookback(settings) : null;
|
|
113
124
|
}
|
|
@@ -139,11 +150,13 @@ export function wrunTimeframeLabel(settings) {
|
|
|
139
150
|
* chart path too, its Timeframe forced to the chart option in the init args
|
|
140
151
|
* (wrunSettingsForRunInterval): its selected-timeframe branch shows each bar one closed bar late at
|
|
141
152
|
* the chart's interval and refuses (or draws nothing) below it. Read the built-in's way: every
|
|
142
|
-
*
|
|
143
|
-
*
|
|
153
|
+
* port of a built-in (`builtinPortOf`: the proven twin's stamp or the package itself, so the store's
|
|
154
|
+
* copy of a port reads as the Indicators list's), listed in WRUN_RUN_INTERVAL_TWINS or not, on
|
|
155
|
+
* replay, index mode and the unsupported markets alike; an authored Indicator's own `timeframe`
|
|
156
|
+
* param is its author's.
|
|
144
157
|
*/
|
|
145
158
|
export function wrunTimeframeIsChartOrFiner(settings, chartInterval) {
|
|
146
|
-
return
|
|
159
|
+
return builtinPortOf(settings) !== undefined && timeframeIsChartOrFiner(wrunTimeframeLabel(settings), chartInterval);
|
|
147
160
|
}
|
|
148
161
|
/** Whether a twin waits for the selected bar to close (the param defaults on). */
|
|
149
162
|
export function wrunWaitsForClose(settings) {
|
|
@@ -153,12 +166,13 @@ export function wrunWaitsForClose(settings) {
|
|
|
153
166
|
/**
|
|
154
167
|
* The interval a wrun overlay's package runs at when it is coarser than the chart's, else null (the
|
|
155
168
|
* package runs on the chart's bars, as before): a proven twin listed in WRUN_RUN_INTERVAL_TWINS,
|
|
156
|
-
* off
|
|
157
|
-
*
|
|
158
|
-
* is the chart's own
|
|
169
|
+
* off index mode and the markets one candle ask cannot serve (`unsupportedMarket`), live or in
|
|
170
|
+
* replay on a session market (`sessionMarket`, the live run's bars), whose timeframe selects an
|
|
171
|
+
* interval coarser than the chart. A selection at or below the chart's interval is the chart's own
|
|
172
|
+
* (wrunTimeframeIsChartOrFiner).
|
|
159
173
|
*/
|
|
160
174
|
export function resolveWrunRunInterval(input) {
|
|
161
|
-
if (input.
|
|
175
|
+
if (input.indexMode || input.unsupportedMarket || (input.replay && !input.sessionMarket))
|
|
162
176
|
return null;
|
|
163
177
|
const lookbackBars = wrunTwinLookbackBars(input.settings);
|
|
164
178
|
if (lookbackBars === null)
|
|
@@ -176,24 +190,53 @@ export function resolveWrunRunInterval(input) {
|
|
|
176
190
|
export function isWrunRunIntervalUnsupportedMarket(exchange, transformations) {
|
|
177
191
|
return isRunIntervalUnservableMarket(exchange, transformations);
|
|
178
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Whether a chart's market rides a session calendar its twins' own resampler cannot fold from the
|
|
195
|
+
* chart's bars (see WrunRunIntervalInput.sessionMarket): a venue on the CME session lattice
|
|
196
|
+
* (isCmeSessionLatticeExchange: its 4h bars on the 17:00 Chicago lattice), or a chart whose own bars
|
|
197
|
+
* ride a session filter (wrunBarsSessionFiltered at the chart's interval: RTH on a CME chart, where
|
|
198
|
+
* a run bar above 30m is anchored on the session open and a 1D run bar holds the whole session).
|
|
199
|
+
*/
|
|
200
|
+
export function isWrunRunIntervalSessionMarket(exchange, chart, chartInterval) {
|
|
201
|
+
return (isCmeSessionLatticeExchange(exchange) ||
|
|
202
|
+
wrunBarsSessionFiltered({ ...chart, exchange }, chartIntervalToMs(chartInterval)));
|
|
203
|
+
}
|
|
179
204
|
/**
|
|
180
205
|
* The run interval of one mounted wrun overlay: its settings against the chart's interval, venue,
|
|
181
|
-
* series (`chartTransformations`, a formula chart's legs)
|
|
206
|
+
* series (`chartTransformations`, a formula chart's legs), session (`chartMarket`: the symbol and the
|
|
207
|
+
* session type a replaying chart's session market reads) and replay state. `chartExchange` is the
|
|
182
208
|
* chart's venue; omitted, the overlay's own `settings.exchange` stands in. A venue that rides the CME
|
|
183
209
|
* session lattice (CME, CBOT, NYMEX, COMEX: isCmeSessionLatticeExchange, the rule the chart's own
|
|
184
|
-
* live bars and the run bars' live fold key on) stamps the run `sessionLattice`.
|
|
210
|
+
* live bars and the run bars' live fold key on) stamps the run `sessionLattice`. The same question
|
|
211
|
+
* with replay off is liveOverlayWrunRunInterval.
|
|
185
212
|
*/
|
|
186
|
-
export function overlayWrunRunInterval(chartIndex, overlay, chartInterval, chartExchange, chartTransformations) {
|
|
213
|
+
export function overlayWrunRunInterval(chartIndex, overlay, chartInterval, chartExchange, chartTransformations, chartMarket) {
|
|
214
|
+
// The replay flags are web's (replay/replayFlags.ts `isChartReplaying`, the same Set read at call time).
|
|
215
|
+
const replay = wrunChartHostEnv().chart.isReplaying(chartIndex);
|
|
216
|
+
return overlayRunIntervalUnder(replay, overlay, chartInterval, chartExchange, chartTransformations, chartMarket);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* The run interval of one mounted wrun overlay as a live run computes it, whatever the chart's replay:
|
|
220
|
+
* overlayWrunRunInterval's settings, venue, series and session with replay off. The alerts engine
|
|
221
|
+
* evaluates live, so an Indicator arm made while its chart replays reads what live reads
|
|
222
|
+
* (alert-overlay-target `runsAtOwnTimeframe`), where the replay run keeps the package's own path off a
|
|
223
|
+
* session market.
|
|
224
|
+
*/
|
|
225
|
+
export function liveOverlayWrunRunInterval(overlay, chartInterval, chartExchange, chartTransformations, chartMarket) {
|
|
226
|
+
return overlayRunIntervalUnder(false, overlay, chartInterval, chartExchange, chartTransformations, chartMarket);
|
|
227
|
+
}
|
|
228
|
+
/** overlayWrunRunInterval's composition under a replay state the caller names. */
|
|
229
|
+
function overlayRunIntervalUnder(replay, overlay, chartInterval, chartExchange, chartTransformations, chartMarket) {
|
|
187
230
|
const settings = overlay?.settings;
|
|
188
231
|
const exchange = chartExchange ?? settings?.exchange;
|
|
189
232
|
const venue = typeof exchange === 'string' ? exchange : undefined;
|
|
190
233
|
const run = resolveWrunRunInterval({
|
|
191
234
|
settings,
|
|
192
235
|
chartInterval,
|
|
193
|
-
|
|
194
|
-
replay: wrunChartHostEnv().chart.isReplaying(chartIndex),
|
|
236
|
+
replay,
|
|
195
237
|
indexMode: checkIsIndexMode(venue),
|
|
196
238
|
unsupportedMarket: isWrunRunIntervalUnsupportedMarket(venue, chartTransformations),
|
|
239
|
+
sessionMarket: isWrunRunIntervalSessionMarket(venue, chartMarket, chartInterval),
|
|
197
240
|
});
|
|
198
241
|
return run && isCmeSessionLatticeExchange(venue) ? { ...run, sessionLattice: true } : run;
|
|
199
242
|
}
|
|
@@ -37,7 +37,9 @@
|
|
|
37
37
|
* - `option_labels`: a select's labels, parallel to `options` (the schema's
|
|
38
38
|
* numeric option values) or, without `options`, to the integers min..max.
|
|
39
39
|
* - Typed-inputs keys (WRUN-INPUTS-PLAN 1.1): `hint`, `row`, `when`,
|
|
40
|
-
* `hide`, `slider` and `host` ride the row verbatim
|
|
40
|
+
* `hide`, `slider` and `host` ride the row verbatim (a `when` is one clause
|
|
41
|
+
* over another row's value, parseWrunWhen: `name`, `!name`, `name=v`,
|
|
42
|
+
* `name!=v`, `name in v1,v2`, read by wrunWhenActive); `hidden` and
|
|
41
43
|
* `host_fill` rows are never rendered; `range` / `list` / `session`
|
|
42
44
|
* members and a `unit` pair each collapse into ONE virtual composite row
|
|
43
45
|
* named by the composite (`virtual: true`, `members` in the frozen
|
|
@@ -158,6 +160,8 @@ export interface WrunScriptInputDeclaration {
|
|
|
158
160
|
order?: number;
|
|
159
161
|
hint?: string;
|
|
160
162
|
row?: string;
|
|
163
|
+
/** The gate the row dims (or, with `hide`, leaves the page) behind: one clause over another row's value, verbatim
|
|
164
|
+
* from the sheet (parseWrunWhen reads it, wrunWhenActive decides). */
|
|
161
165
|
when?: string;
|
|
162
166
|
hide?: boolean;
|
|
163
167
|
slider?: boolean;
|
|
@@ -178,6 +182,10 @@ export interface WrunScriptInputDeclaration {
|
|
|
178
182
|
* createScript's socket worker) rebuilds one colour param per member
|
|
179
183
|
* (wrunSheetParamsFromDeclarations) and packs element i as member i. */
|
|
180
184
|
members?: string[];
|
|
185
|
+
/** A colour-array (`color[]`) row: the gate of each member that declares one, by member name, verbatim from the
|
|
186
|
+
* sheet (the `when` grammar). The row's own presentation keys, `when` among them, are its first member's; a
|
|
187
|
+
* member's own gate dims that member's swatch alone (WrunLayoutPanel), and the colour list stays as stored. */
|
|
188
|
+
memberWhen?: Record<string, string>;
|
|
181
189
|
/** A host-applied param (the sheet's `host`): the browser host rewrites
|
|
182
190
|
* the bound inputs' field, interval or market from it, and the cloud
|
|
183
191
|
* applies the same picks from the hosted map (C1). Carried on the row so
|
|
@@ -224,6 +232,7 @@ export interface WrunScriptSection {
|
|
|
224
232
|
/** The toggle param the section header draws (its own row is never placed). */
|
|
225
233
|
toggle?: string;
|
|
226
234
|
collapsed?: boolean;
|
|
235
|
+
/** The section's gate, the rows' `when` grammar: the section dims while it is closed. */
|
|
227
236
|
when?: string;
|
|
228
237
|
/** Flat declarations (and layout-only divider / note rows) with `page`,
|
|
229
238
|
* `section` and `order` set. */
|
|
@@ -408,6 +417,41 @@ export declare function coerceWrunRowValue(row: WrunScriptInputDeclaration, raw:
|
|
|
408
417
|
* The run head's market-scaled defaults (wrun-market-size-defaults.util) read
|
|
409
418
|
* a row through it too, so "unchanged" there is the reset icon's own test. */
|
|
410
419
|
export declare function wrunRowValue(settings: Readonly<Record<string, unknown>>, row: WrunScriptInputDeclaration): unknown;
|
|
420
|
+
/**
|
|
421
|
+
* A `when` gate read apart (a param's or a layout section's, the typed-inputs key; the clause forms joined the
|
|
422
|
+
* bare name on 2026-10-25 with the om SDK, settings no-op audit SC4): `"<param>"` holds while the param's value is
|
|
423
|
+
* truthy (the original form: a toggle on, an option or a number other than 0), `"!<param>"` while it is falsy,
|
|
424
|
+
* `"<param>=<v>"` while it equals v, `"<param>!=<v>"` while it does not, `"<param> in <v1>,<v2>"` while it is one of
|
|
425
|
+
* the list. Every v is a number (wrunWhenGateNumber says what it is compared with). Whitespace around the operators
|
|
426
|
+
* and the list reads; anything else is no clause.
|
|
427
|
+
*/
|
|
428
|
+
export type WrunWhenClause = {
|
|
429
|
+
readonly param: string;
|
|
430
|
+
readonly op: 'truthy';
|
|
431
|
+
} | {
|
|
432
|
+
readonly param: string;
|
|
433
|
+
readonly op: 'falsy';
|
|
434
|
+
} | {
|
|
435
|
+
readonly param: string;
|
|
436
|
+
readonly op: 'eq' | 'ne' | 'in';
|
|
437
|
+
readonly values: readonly number[];
|
|
438
|
+
};
|
|
439
|
+
/** A `when` gate's clause (WrunWhenClause), undefined for anything that is no clause: no string, an empty one, an
|
|
440
|
+
* operator without its param or value, a value that is no number, a list with an empty slot, two clauses. */
|
|
441
|
+
export declare function parseWrunWhen(when: unknown): WrunWhenClause | undefined;
|
|
442
|
+
/**
|
|
443
|
+
* The number a `when` comparison reads off a gate's value: a toggle 1 / 0, a choice its option's index in the
|
|
444
|
+
* gating row's options (a select, a line style), any other value the number it reads as (a number, a numeric
|
|
445
|
+
* text, a multi's mask). Undefined for a value that reads as no number (a colour, a word).
|
|
446
|
+
*/
|
|
447
|
+
export declare function wrunWhenGateNumber(gate: WrunScriptInputDeclaration | undefined, value: unknown): number | undefined;
|
|
448
|
+
/**
|
|
449
|
+
* Whether a row (or a layout section) gated by `when` is live under `settings`: its clause (parseWrunWhen) over the
|
|
450
|
+
* gating row's value (`gateOf` finds the row a name declares). No gate is live. A gate the panel cannot read never
|
|
451
|
+
* closes: no clause, a param nobody declares or holds, a comparison over a value that is no number. A dim the
|
|
452
|
+
* panel cannot explain hides a live control, which is the class this grammar exists to end.
|
|
453
|
+
*/
|
|
454
|
+
export declare function wrunWhenActive(settings: Readonly<Record<string, unknown>>, when: unknown, gateOf: (name: string) => WrunScriptInputDeclaration | undefined): boolean;
|
|
411
455
|
/** Equality the way the run reads values back: a toggle as 1/0, a select's
|
|
412
456
|
* numeric string as its number, a colour array element by element. */
|
|
413
457
|
export declare function wrunValuesEqual(a: unknown, b: unknown): boolean;
|
|
@@ -37,7 +37,9 @@
|
|
|
37
37
|
* - `option_labels`: a select's labels, parallel to `options` (the schema's
|
|
38
38
|
* numeric option values) or, without `options`, to the integers min..max.
|
|
39
39
|
* - Typed-inputs keys (WRUN-INPUTS-PLAN 1.1): `hint`, `row`, `when`,
|
|
40
|
-
* `hide`, `slider` and `host` ride the row verbatim
|
|
40
|
+
* `hide`, `slider` and `host` ride the row verbatim (a `when` is one clause
|
|
41
|
+
* over another row's value, parseWrunWhen: `name`, `!name`, `name=v`,
|
|
42
|
+
* `name!=v`, `name in v1,v2`, read by wrunWhenActive); `hidden` and
|
|
41
43
|
* `host_fill` rows are never rendered; `range` / `list` / `session`
|
|
42
44
|
* members and a `unit` pair each collapse into ONE virtual composite row
|
|
43
45
|
* named by the composite (`virtual: true`, `members` in the frozen
|
|
@@ -105,7 +107,7 @@ import { footprintPaintsVolumeColor } from './wrun-footprint-modes.util.js';
|
|
|
105
107
|
import { isWrunColorWord, wrunThemeTokenOfPacked, wrunThemeTokenWord } from './wrun-style-words.util.js';
|
|
106
108
|
import { isWrunColorParam, isWrunStyleParam, wrunColorArrayKey, wrunColorPalette, wrunColorParamDefault, wrunColorSettingString, wrunLineStyles, wrunParamChoices, wrunSelectOptionValue, wrunStyleBinding, parseWrunStyleTarget, wrunVisibilityOwnedOutputs, wrunVisibilityOwners, } from './wrun-color-settings.util.js';
|
|
107
109
|
import { findWrunVisibilityTarget, WRUN_HANDLE_KIND_RULES, WRUN_VISIBILITY_RULES, wrunVisibilityEntryTarget, wrunVisibilityTargetAt, } from './wrun-visibility-table.js';
|
|
108
|
-
import { wrunCodedWords } from './wrun-setting-words.util.js';
|
|
110
|
+
import { isTruthySetting, wrunCodedWords } from './wrun-setting-words.util.js';
|
|
109
111
|
import { wrunRowVisibleHere } from './wrun-market-facts.util.js';
|
|
110
112
|
import { bitmaskValue, finiteNumber, nonEmptyString, numericValue, toggleValue, wrunMultiLabels, wrunTimeValue, } from './wrun-param-values.util.js';
|
|
111
113
|
import { wrunLegendLiteral, wrunTextParamCap, wrunTextParamDefault, wrunTextValueWithinCap, } from './wrun-text-params.util.js';
|
|
@@ -1056,10 +1058,16 @@ export function buildWrunScriptInputs(metadata, options) {
|
|
|
1056
1058
|
if (arrayKey !== undefined) {
|
|
1057
1059
|
if (isReservedKScriptProvenanceKey(arrayKey))
|
|
1058
1060
|
continue;
|
|
1061
|
+
// Each member's own gate rides the row by its name (memberWhen): the row keeps its first member's keys only,
|
|
1062
|
+
// so a later member's `when` (RSI's extremes colours) would otherwise never reach its swatch.
|
|
1063
|
+
const when = nonEmptyString(param.when);
|
|
1064
|
+
const memberWhen = when === undefined ? undefined : { [param.name]: when };
|
|
1059
1065
|
const row = colorArrays.get(arrayKey);
|
|
1060
1066
|
if (row) {
|
|
1061
1067
|
row.defaultValue.push(wrunColorParamDefault(param));
|
|
1062
1068
|
row.members.push(param.name);
|
|
1069
|
+
if (memberWhen !== undefined)
|
|
1070
|
+
row.memberWhen = { ...row.memberWhen, ...memberWhen };
|
|
1063
1071
|
}
|
|
1064
1072
|
else {
|
|
1065
1073
|
// The row stands for the kScript `color[]` input named by the key:
|
|
@@ -1078,6 +1086,7 @@ export function buildWrunScriptInputs(metadata, options) {
|
|
|
1078
1086
|
type: 'color[]',
|
|
1079
1087
|
defaultValue: [wrunColorParamDefault(param)],
|
|
1080
1088
|
members: [param.name],
|
|
1089
|
+
...(memberWhen !== undefined ? { memberWhen } : {}),
|
|
1081
1090
|
};
|
|
1082
1091
|
colorArrays.set(arrayKey, created);
|
|
1083
1092
|
rows.push(created);
|
|
@@ -1843,6 +1852,104 @@ export function wrunRowValue(settings, row) {
|
|
|
1843
1852
|
const fit = stored === undefined || stored === null ? undefined : coerceWrunRowValue(row, stored);
|
|
1844
1853
|
return fit ?? row.defaultValue;
|
|
1845
1854
|
}
|
|
1855
|
+
/** A param name inside a clause: no whitespace, no operator character (a sheet name never holds one). */
|
|
1856
|
+
const WHEN_PARAM = '[^\\s!=,]+';
|
|
1857
|
+
const WHEN_FALSY_RE = new RegExp(`^!\\s*(${WHEN_PARAM})$`);
|
|
1858
|
+
const WHEN_IN_RE = new RegExp(`^(${WHEN_PARAM})\\s+in\\s+(.+)$`);
|
|
1859
|
+
const WHEN_NE_RE = new RegExp(`^(${WHEN_PARAM})\\s*!=\\s*(.+)$`);
|
|
1860
|
+
const WHEN_EQ_RE = new RegExp(`^(${WHEN_PARAM})\\s*=\\s*(.+)$`);
|
|
1861
|
+
const WHEN_PARAM_RE = new RegExp(`^(${WHEN_PARAM})$`);
|
|
1862
|
+
/** A clause's value: a finite number, nothing else (a word, an empty slot). */
|
|
1863
|
+
function whenValue(text) {
|
|
1864
|
+
const trimmed = text.trim();
|
|
1865
|
+
if (trimmed === '')
|
|
1866
|
+
return undefined;
|
|
1867
|
+
const value = Number(trimmed);
|
|
1868
|
+
return Number.isFinite(value) ? value : undefined;
|
|
1869
|
+
}
|
|
1870
|
+
/** A `when` gate's clause (WrunWhenClause), undefined for anything that is no clause: no string, an empty one, an
|
|
1871
|
+
* operator without its param or value, a value that is no number, a list with an empty slot, two clauses. */
|
|
1872
|
+
export function parseWrunWhen(when) {
|
|
1873
|
+
if (typeof when !== 'string')
|
|
1874
|
+
return undefined;
|
|
1875
|
+
const text = when.trim();
|
|
1876
|
+
const falsy = WHEN_FALSY_RE.exec(text);
|
|
1877
|
+
if (falsy)
|
|
1878
|
+
return { param: falsy[1], op: 'falsy' };
|
|
1879
|
+
const list = WHEN_IN_RE.exec(text);
|
|
1880
|
+
if (list) {
|
|
1881
|
+
const values = list[2].split(',').map(whenValue);
|
|
1882
|
+
return values.every((value) => value !== undefined)
|
|
1883
|
+
? { param: list[1], op: 'in', values }
|
|
1884
|
+
: undefined;
|
|
1885
|
+
}
|
|
1886
|
+
for (const [re, op] of [
|
|
1887
|
+
[WHEN_NE_RE, 'ne'],
|
|
1888
|
+
[WHEN_EQ_RE, 'eq'],
|
|
1889
|
+
]) {
|
|
1890
|
+
const match = re.exec(text);
|
|
1891
|
+
if (!match)
|
|
1892
|
+
continue;
|
|
1893
|
+
const value = whenValue(match[2]);
|
|
1894
|
+
return value === undefined ? undefined : { param: match[1], op, values: [value] };
|
|
1895
|
+
}
|
|
1896
|
+
const bare = WHEN_PARAM_RE.exec(text);
|
|
1897
|
+
return bare ? { param: bare[1], op: 'truthy' } : undefined;
|
|
1898
|
+
}
|
|
1899
|
+
/** The value a gate reads: the gating row's (wrunRowValue, the panel's lenient read, so the gate and the row it
|
|
1900
|
+
* reads always agree), else the raw setting of a name no row declares; undefined when nothing holds one. */
|
|
1901
|
+
function whenGateValue(settings, param, gate) {
|
|
1902
|
+
const value = gate !== undefined ? wrunRowValue(settings, gate) : settings[param];
|
|
1903
|
+
return value === null ? undefined : value;
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* The number a `when` comparison reads off a gate's value: a toggle 1 / 0, a choice its option's index in the
|
|
1907
|
+
* gating row's options (a select, a line style), any other value the number it reads as (a number, a numeric
|
|
1908
|
+
* text, a multi's mask). Undefined for a value that reads as no number (a colour, a word).
|
|
1909
|
+
*/
|
|
1910
|
+
export function wrunWhenGateNumber(gate, value) {
|
|
1911
|
+
if (typeof value === 'boolean')
|
|
1912
|
+
return value ? 1 : 0;
|
|
1913
|
+
if (typeof value === 'string' && gate?.options !== undefined) {
|
|
1914
|
+
const at = gate.options.indexOf(value);
|
|
1915
|
+
if (at >= 0)
|
|
1916
|
+
return at;
|
|
1917
|
+
}
|
|
1918
|
+
return numericValue(value);
|
|
1919
|
+
}
|
|
1920
|
+
/**
|
|
1921
|
+
* Whether a row (or a layout section) gated by `when` is live under `settings`: its clause (parseWrunWhen) over the
|
|
1922
|
+
* gating row's value (`gateOf` finds the row a name declares). No gate is live. A gate the panel cannot read never
|
|
1923
|
+
* closes: no clause, a param nobody declares or holds, a comparison over a value that is no number. A dim the
|
|
1924
|
+
* panel cannot explain hides a live control, which is the class this grammar exists to end.
|
|
1925
|
+
*/
|
|
1926
|
+
export function wrunWhenActive(settings, when, gateOf) {
|
|
1927
|
+
if (when === undefined || when === null || when === '')
|
|
1928
|
+
return true;
|
|
1929
|
+
const clause = parseWrunWhen(when);
|
|
1930
|
+
if (clause === undefined)
|
|
1931
|
+
return true;
|
|
1932
|
+
const gate = gateOf(clause.param);
|
|
1933
|
+
const value = whenGateValue(settings, clause.param, gate);
|
|
1934
|
+
if (value === undefined)
|
|
1935
|
+
return true;
|
|
1936
|
+
const number = wrunWhenGateNumber(gate, value);
|
|
1937
|
+
if (clause.op === 'truthy' || clause.op === 'falsy') {
|
|
1938
|
+
// The on / off forms read the gate the way the compare forms and the om SDK do: a choice by its option's index
|
|
1939
|
+
// (its first option is the off value, whatever word or number that option holds), a toggle as 1 / 0, a number or
|
|
1940
|
+
// a mask as its number; a kind that reads as no number (a colour, a word) by its truthiness, as the bare form
|
|
1941
|
+
// always did.
|
|
1942
|
+
const on = number === undefined ? isTruthySetting(value) : number !== 0;
|
|
1943
|
+
return clause.op === 'truthy' ? on : !on;
|
|
1944
|
+
}
|
|
1945
|
+
if (number === undefined)
|
|
1946
|
+
return true;
|
|
1947
|
+
if (clause.op === 'eq')
|
|
1948
|
+
return clause.values[0] === number;
|
|
1949
|
+
if (clause.op === 'ne')
|
|
1950
|
+
return clause.values[0] !== number;
|
|
1951
|
+
return clause.values.includes(number);
|
|
1952
|
+
}
|
|
1846
1953
|
function normalizeRowScalar(value) {
|
|
1847
1954
|
if (typeof value === 'boolean')
|
|
1848
1955
|
return value ? 1 : 0;
|
|
@@ -1965,11 +2072,12 @@ function renderWrunParamTitleWords(param, value, text) {
|
|
|
1965
2072
|
if (isWrunStyleParam(param))
|
|
1966
2073
|
return undefined;
|
|
1967
2074
|
// A coded value (a choice, a multi, a time, a session clock) prints as its words, never its
|
|
1968
|
-
// code; an empty multi and an unset time (0) keep the literal token,
|
|
2075
|
+
// code; an empty multi and an unset time (0, no date in the decode) keep the literal token,
|
|
2076
|
+
// the falsy rule below.
|
|
1969
2077
|
const shape = wrunParamWordsShape(param);
|
|
1970
2078
|
const coded = wrunCodedWords(shape, value);
|
|
1971
2079
|
if (coded !== undefined)
|
|
1972
|
-
return coded === ''
|
|
2080
|
+
return coded === '' ? undefined : coded;
|
|
1973
2081
|
switch (shape.type) {
|
|
1974
2082
|
case 'color':
|
|
1975
2083
|
return wrunColorSettingString(value);
|
|
@@ -32,7 +32,7 @@ export interface WrunWordsShape {
|
|
|
32
32
|
export interface WrunSettingWords {
|
|
33
33
|
on?: string;
|
|
34
34
|
off?: string;
|
|
35
|
-
/** An empty multi. */
|
|
35
|
+
/** An empty multi, an unset time (no date: epochToLocalInput). */
|
|
36
36
|
none?: string;
|
|
37
37
|
/** The timeframe word list's "follow the chart" choice. */
|
|
38
38
|
chart?: string;
|
|
@@ -73,7 +73,11 @@ export declare function minutesToClock(minutes: number): string;
|
|
|
73
73
|
export declare function clockToMinutes(text: string): number | undefined;
|
|
74
74
|
/** Epoch seconds as the "YYYY-MM-DDTHH:MM" wall time a datetime-local field
|
|
75
75
|
* holds, in the zone `offsetMs` east of UTC (read with UTC getters, never
|
|
76
|
-
* the browser's zone).
|
|
76
|
+
* the browser's zone); '' (an empty field) for an unset time. A sheet
|
|
77
|
+
* declares a time that may be off with `default: 0` (no date picked: the
|
|
78
|
+
* script's own fallback, such as the first expiry), so 0, a negative and a
|
|
79
|
+
* non-finite value are no instant, never the epoch's date (31/12/1969 west
|
|
80
|
+
* of UTC). Every time text reads through here, the field and the words. */
|
|
77
81
|
export declare function epochToLocalInput(seconds: number, offsetMs?: number): string;
|
|
78
|
-
/** A time value as people read it: its date and clock in the zone `offsetMs` east of UTC. */
|
|
82
|
+
/** A time value as people read it: its date and clock in the zone `offsetMs` east of UTC, '' when unset. */
|
|
79
83
|
export declare function describeTime(value: unknown, offsetMs?: number): string;
|
|
@@ -28,8 +28,12 @@ export function wrunCodedWords(shape, value, words) {
|
|
|
28
28
|
return choiceWords(shape, value, words);
|
|
29
29
|
case 'multi':
|
|
30
30
|
return multiWords(shape, value, words);
|
|
31
|
-
case 'time':
|
|
32
|
-
|
|
31
|
+
case 'time': {
|
|
32
|
+
// An unset time has no date to print: nothing, or the viewer's "none" where the surface
|
|
33
|
+
// passes its words, the way an empty multi reads.
|
|
34
|
+
const text = describeTime(value, words?.zoneOffsetMs);
|
|
35
|
+
return text === '' ? (words?.none ?? '') : text;
|
|
36
|
+
}
|
|
33
37
|
default:
|
|
34
38
|
return undefined;
|
|
35
39
|
}
|
|
@@ -159,9 +163,13 @@ export function clockToMinutes(text) {
|
|
|
159
163
|
}
|
|
160
164
|
/** Epoch seconds as the "YYYY-MM-DDTHH:MM" wall time a datetime-local field
|
|
161
165
|
* holds, in the zone `offsetMs` east of UTC (read with UTC getters, never
|
|
162
|
-
* the browser's zone).
|
|
166
|
+
* the browser's zone); '' (an empty field) for an unset time. A sheet
|
|
167
|
+
* declares a time that may be off with `default: 0` (no date picked: the
|
|
168
|
+
* script's own fallback, such as the first expiry), so 0, a negative and a
|
|
169
|
+
* non-finite value are no instant, never the epoch's date (31/12/1969 west
|
|
170
|
+
* of UTC). Every time text reads through here, the field and the words. */
|
|
163
171
|
export function epochToLocalInput(seconds, offsetMs = 0) {
|
|
164
|
-
if (!Number.isFinite(seconds))
|
|
172
|
+
if (!Number.isFinite(seconds) || seconds <= 0)
|
|
165
173
|
return '';
|
|
166
174
|
const wall = new Date(seconds * 1000 + offsetMs);
|
|
167
175
|
if (Number.isNaN(wall.getTime()))
|
|
@@ -169,7 +177,7 @@ export function epochToLocalInput(seconds, offsetMs = 0) {
|
|
|
169
177
|
const pad = (n) => String(n).padStart(2, '0');
|
|
170
178
|
return `${wall.getUTCFullYear()}-${pad(wall.getUTCMonth() + 1)}-${pad(wall.getUTCDate())}T${pad(wall.getUTCHours())}:${pad(wall.getUTCMinutes())}`;
|
|
171
179
|
}
|
|
172
|
-
/** A time value as people read it: its date and clock in the zone `offsetMs` east of UTC. */
|
|
180
|
+
/** A time value as people read it: its date and clock in the zone `offsetMs` east of UTC, '' when unset. */
|
|
173
181
|
export function describeTime(value, offsetMs = 0) {
|
|
174
182
|
return epochToLocalInput(Number(value), offsetMs).replace('T', ' ');
|
|
175
183
|
}
|
|
@@ -236,12 +236,18 @@ export declare class SocketWrunRowSource implements WrunRowSource {
|
|
|
236
236
|
private merges;
|
|
237
237
|
/** The cells memo: the last cell rows answered and each celled entry's lane rows (`cellRows`). */
|
|
238
238
|
private cells;
|
|
239
|
+
/** The served tier of the OPRA rows the session holds (contract opra-server-lanes C4: the newest receipt that named a
|
|
240
|
+
* tier since the session opened), the one every merge is held to (`servedTierMoved`). */
|
|
241
|
+
private retainedTier;
|
|
242
|
+
/** A served-tier move no listener took yet (`dropSessionAtServedTier`): the next subscriber is told first. */
|
|
243
|
+
private servedTierMoveOwed;
|
|
239
244
|
constructor(deps?: WrunSocketRowSourceDeps);
|
|
240
245
|
/** The store's merged session (undefined before the first answer and after a teardown). */
|
|
241
246
|
get session(): WrunHostedSession | undefined;
|
|
242
247
|
/** The session's run-level keys as a batch carries them (copies): the newest strategy output and diagnostics a
|
|
243
|
-
* result or a live frame carried, whichever merged last, the served legs' warning rows after the diagnostics
|
|
244
|
-
|
|
248
|
+
* result or a live frame carried, whichever merged last, the served legs' warning rows after the diagnostics, the
|
|
249
|
+
* newest result's OPRA word and the receipt of the newest OPRA rows (a result's or a marked live frame's). */
|
|
250
|
+
get sessionRunLevel(): Pick<WrunRowBatch, 'strategy' | 'diagnostics' | 'opra' | 'opraServed'>;
|
|
245
251
|
/** The session's cell rows in the shapes the price canvases read (the store's conversion), with the
|
|
246
252
|
* chart's own candles. The cells memo keeps each entry's lane rows between reads: a read after a merge
|
|
247
253
|
* converts only the rows the merge replaced (`extendWrunCellLane`), and a read with nothing merged since,
|
|
@@ -287,6 +293,25 @@ export declare class SocketWrunRowSource implements WrunRowSource {
|
|
|
287
293
|
* one the store refused as `WrunSocketReplyUnreadable`.
|
|
288
294
|
*/
|
|
289
295
|
private mergeResult;
|
|
296
|
+
/** A merge's tier joins the session's: the tier the receipt of a marked answer named, when it named one. */
|
|
297
|
+
private retainTier;
|
|
298
|
+
/**
|
|
299
|
+
* Whether an answer moves the session's served tier: it carries the OPRA mark and names a tier, and the rows the
|
|
300
|
+
* session holds were served at the other one (contract opra-server-lanes C4: the gate re-resolved the owner's tier,
|
|
301
|
+
* a downgrade or an upgrade). An answer that names no tier moves nothing (its rows read no OPRA yet), nor does a
|
|
302
|
+
* session whose rows never named one.
|
|
303
|
+
*/
|
|
304
|
+
private servedTierMoved;
|
|
305
|
+
/**
|
|
306
|
+
* The served tier moved under the session: nothing it holds may stand beside rows served at the new tier (a
|
|
307
|
+
* real-time prefix under a delayed receipt, or the reverse). Its rows, coverage, owed window, cells and run-level
|
|
308
|
+
* keys go, the generation moves (an ask on its way settles superseded, a frame merged behind this one is dropped), and
|
|
309
|
+
* the overlay is told (`WrunRowBatch.servedTierMoved`): it takes what it drew off the chart, ends its live session
|
|
310
|
+
* and reruns, which creates a fresh session at the tier the cloud serves now. The source never extends a session
|
|
311
|
+
* across the move.
|
|
312
|
+
*/
|
|
313
|
+
private dropSessionAtServedTier;
|
|
314
|
+
private deliver;
|
|
290
315
|
/**
|
|
291
316
|
* Page a window until the planner's coverage says done: each round runs the pages still missing,
|
|
292
317
|
* newest first and planned again after each one, through the in-flight registry (or around it, for a
|