@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
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
* The one rule every fact keeps: a host that does not know a fact writes 0.
|
|
19
19
|
* For the kind, the point value and the quote that 0 reads "unknown"; for the
|
|
20
20
|
* zone it is index 0, UTC, the clock every 24/7 market keeps; for the session
|
|
21
|
-
* open it is midnight, the trade day of every market off the CME family
|
|
21
|
+
* open it is midnight, the trade day of every market off the CME family and
|
|
22
|
+
* forex.
|
|
22
23
|
*/
|
|
23
24
|
import type { WrunMarketFactFill, WrunMarketKind, WrunMarketQuoteIsUsd, WrunSourceBlendField, WrunSourceFieldWord } from '@orangecharts/indicator-kit';
|
|
24
25
|
export type { WrunSourceBlendField, WrunSourceFieldWord } from '@orangecharts/indicator-kit';
|
|
@@ -31,9 +32,18 @@ export type WrunMarketFactWord = WrunMarketFactFill | 'session_open';
|
|
|
31
32
|
export declare const WRUN_MARKET_FACT_FILLS: readonly WrunMarketFactWord[];
|
|
32
33
|
/** `market.session_open()` on the CME family: its trade day opens at minute
|
|
33
34
|
* 1020 (17:00) on the Chicago clock, the evening before the date it is stamped
|
|
34
|
-
* with (the lattice of wrun-run-interval-session.util).
|
|
35
|
-
*
|
|
35
|
+
* with (the lattice of wrun-run-interval-session.util). Forex opens at the
|
|
36
|
+
* same minute on the New York clock (WRUN_MARKET_SESSION_OPEN_FOREX); every
|
|
37
|
+
* other market reads 0, midnight. The kit's WRUN_MARKET_SESSION_OPEN_CME from
|
|
38
|
+
* 0.65.0. */
|
|
36
39
|
export declare const WRUN_MARKET_SESSION_OPEN_CME = 1020;
|
|
40
|
+
/** `market.session_open()` on forex (FX_OTC, POLYGON_FX): the forex day runs
|
|
41
|
+
* 17:00 to 17:00 New York (21:00Z in summer, 22:00Z in winter), so its trade
|
|
42
|
+
* day opens at minute 1020 on the New York clock, the evening before the date
|
|
43
|
+
* it is stamped with, and Sunday 17:00 New York opens Monday's trade date.
|
|
44
|
+
* The same evening-open rule as the CME family; the kit's
|
|
45
|
+
* WRUN_MARKET_SESSION_OPEN_FOREX once the chart pins a kit that exports it. */
|
|
46
|
+
export declare const WRUN_MARKET_SESSION_OPEN_FOREX = 1020;
|
|
37
47
|
/** `market.kind()` codes: the code is the index (append-only). 0 is a market
|
|
38
48
|
* the host does not know, or none of these kinds (a prediction market, an
|
|
39
49
|
* energy or grain contract). A futures contract reports what it trades. */
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
* The one rule every fact keeps: a host that does not know a fact writes 0.
|
|
19
19
|
* For the kind, the point value and the quote that 0 reads "unknown"; for the
|
|
20
20
|
* zone it is index 0, UTC, the clock every 24/7 market keeps; for the session
|
|
21
|
-
* open it is midnight, the trade day of every market off the CME family
|
|
21
|
+
* open it is midnight, the trade day of every market off the CME family and
|
|
22
|
+
* forex.
|
|
22
23
|
*/
|
|
23
24
|
/** The host_fill words of the five market facts, in declaration order
|
|
24
25
|
* (append-only): `market.<word>()` declares the hidden param `market_<word>`. */
|
|
@@ -31,9 +32,18 @@ export const WRUN_MARKET_FACT_FILLS = Object.freeze([
|
|
|
31
32
|
]);
|
|
32
33
|
/** `market.session_open()` on the CME family: its trade day opens at minute
|
|
33
34
|
* 1020 (17:00) on the Chicago clock, the evening before the date it is stamped
|
|
34
|
-
* with (the lattice of wrun-run-interval-session.util).
|
|
35
|
-
*
|
|
35
|
+
* with (the lattice of wrun-run-interval-session.util). Forex opens at the
|
|
36
|
+
* same minute on the New York clock (WRUN_MARKET_SESSION_OPEN_FOREX); every
|
|
37
|
+
* other market reads 0, midnight. The kit's WRUN_MARKET_SESSION_OPEN_CME from
|
|
38
|
+
* 0.65.0. */
|
|
36
39
|
export const WRUN_MARKET_SESSION_OPEN_CME = 1020;
|
|
40
|
+
/** `market.session_open()` on forex (FX_OTC, POLYGON_FX): the forex day runs
|
|
41
|
+
* 17:00 to 17:00 New York (21:00Z in summer, 22:00Z in winter), so its trade
|
|
42
|
+
* day opens at minute 1020 on the New York clock, the evening before the date
|
|
43
|
+
* it is stamped with, and Sunday 17:00 New York opens Monday's trade date.
|
|
44
|
+
* The same evening-open rule as the CME family; the kit's
|
|
45
|
+
* WRUN_MARKET_SESSION_OPEN_FOREX once the chart pins a kit that exports it. */
|
|
46
|
+
export const WRUN_MARKET_SESSION_OPEN_FOREX = 1020;
|
|
37
47
|
/** `market.kind()` codes: the code is the index (append-only). 0 is a market
|
|
38
48
|
* the host does not know, or none of these kinds (a prediction market, an
|
|
39
49
|
* energy or grain contract). A futures contract reports what it trades. */
|
|
@@ -25,10 +25,19 @@
|
|
|
25
25
|
* coin default reads the package's defaults: sized in contracts, placed by the directory in another unit (shares), or
|
|
26
26
|
* candles in another unit than the tape (candle-volume-unit.leaf). This is the raw-unit class the dollar rule ends.
|
|
27
27
|
*
|
|
28
|
-
* Big Trades 0.8.0's
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
28
|
+
* The CONTRACTS rule (BT-ORDER-FLOOR, Big Trades 0.8.0's Min size and Whale size on a market that counts contracts,
|
|
29
|
+
* `min_contracts` and `whale_contracts`, the floor of its `tape_contracts` input): where the per-order switch holds for
|
|
30
|
+
* a CME Group market (its tape judged per aggressor order; the head reads `wrunTapePerOrder`), Min size defaults by the
|
|
31
|
+
* product root (`WRUN_CME_ROOT_MIN_CONTRACTS`, the root `tradesCmeProductRoot` reads: `NQ1!`, `NQZ6` and `NQ-USD` are
|
|
32
|
+
* NQ), 10 for a root the table lacks, and Whale size to ten times that. Why: an order is one trade, so a flat 10 draws a
|
|
33
|
+
* different density on every root; at 10, NQ showed 652 orders an hour and ES 5,827 on Friday 2026-10-23's open hour,
|
|
34
|
+
* and each table row is the smallest 1, 2 or 5 floor with at most 30 orders an hour there. Where prints are still judged
|
|
35
|
+
* per fill (the switch off, any venue but the CME Group's, or a root the large-print table does not hold, whose tape
|
|
36
|
+
* rides the raw TRADE fills: live-trades-merge.util `tradesLargeServesCmeRoot`), the package's flat 10 and 100 stand
|
|
37
|
+
* (the rule's `package` verdict, reason `per-fill`), so a record a per-order session moved returns to them: a floor
|
|
38
|
+
* measured on orders never judges single fills (COMEX:MGC1! on 2026-10-29, a root the table does not hold: the largest
|
|
39
|
+
* fill in two hours was 21 contracts, so GC's 50 would have drawn nothing, while 10 kept 79 fills, about 40 an hour).
|
|
40
|
+
* Untouched rows only, as every rule.
|
|
32
41
|
*
|
|
33
42
|
* A run reads only the family its sheet declares (`wrunMarketScaledRulesOfSheet`). A market whose closed candles cover
|
|
34
43
|
* under an hour moves nothing: the next run asks again.
|
|
@@ -41,7 +50,8 @@
|
|
|
41
50
|
* (`wrunMarketScaledFamilies`): each family has its own verdict and memo, so a volume rule waiting on its candles never
|
|
42
51
|
* holds the option back.
|
|
43
52
|
*
|
|
44
|
-
* Pure: the specs and the phone app read the same rules.
|
|
53
|
+
* Pure: the specs and the phone app read the same rules. It reads the import-free size unit table and the tape rules'
|
|
54
|
+
* one served-root rule (live-trades-merge.util, a store-free leaf the history worker shares).
|
|
45
55
|
*/
|
|
46
56
|
import type { WrunScriptInputDeclaration } from './wrun-script-inputs.util.js';
|
|
47
57
|
/** How a market-scaled param's default follows the market. */
|
|
@@ -72,7 +82,26 @@ export type WrunMarketScaledRule =
|
|
|
72
82
|
readonly kind: 'contracts-option';
|
|
73
83
|
readonly option: number;
|
|
74
84
|
readonly carriesFrom?: never;
|
|
85
|
+
}
|
|
86
|
+
/** A contracts floor by the CME product root (the contracts rule, `wrunMarketContractsVerdict`): the root's row of
|
|
87
|
+
* `table`, `other` for a root it lacks, where the root's tape is the large-print table's per-order rows; the
|
|
88
|
+
* package's default where prints are judged per fill (the switch off, or a root the table does not hold). Never a
|
|
89
|
+
* value carried from an older version (the contracts carry has its own rules). */
|
|
90
|
+
| {
|
|
91
|
+
readonly kind: 'cme-root-contracts';
|
|
92
|
+
readonly table: Readonly<Record<string, number>>;
|
|
93
|
+
readonly other: number;
|
|
94
|
+
readonly carriesFrom?: never;
|
|
75
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* Big Trades' Min size in contracts on a CME Group market whose prints are judged per aggressor order, by product root:
|
|
98
|
+
* the smallest 1, 2 or 5 floor with at most 30 orders an hour on Friday 2026-10-23's open hour (at a flat 10, NQ showed
|
|
99
|
+
* 652 orders an hour and ES 5,827). A root the table lacks reads `WRUN_CME_ROOT_MIN_CONTRACTS_OTHER` where the
|
|
100
|
+
* large-print table holds it; a root the large-print table does not hold is judged per fill (`wrunMarketContractsVerdict`).
|
|
101
|
+
*/
|
|
102
|
+
export declare const WRUN_CME_ROOT_MIN_CONTRACTS: Readonly<Record<string, number>>;
|
|
103
|
+
/** The contracts floor of a CME root the table does not list: the package's 10. */
|
|
104
|
+
export declare const WRUN_CME_ROOT_MIN_CONTRACTS_OTHER = 10;
|
|
76
105
|
/**
|
|
77
106
|
* The params whose default follows the market, by package name, then param name (the sheet's own names). A built-in
|
|
78
107
|
* twin whose sheet binds a param to a trade floor lists it here or in the guard's exemptions with a reason
|
|
@@ -85,14 +114,16 @@ export declare function wrunMarketScaledParamsOf(packageName: string | undefined
|
|
|
85
114
|
* 0.6.0 the dollar rule, 0.7.0 and 0.8.0 the option rule beside it), or undefined when it declares none. */
|
|
86
115
|
export declare function wrunMarketScaledRulesOfSheet(rules: Readonly<Record<string, WrunMarketScaledRule>> | undefined, paramNames: Iterable<string>): Readonly<Record<string, WrunMarketScaledRule>> | undefined;
|
|
87
116
|
/** A package's scaled rules split by family: the VOLUME rules (`daily-volume`, `daily-dollar-volume` and the
|
|
88
|
-
* multiples of them, read off the candles)
|
|
89
|
-
*
|
|
117
|
+
* multiples of them, read off the candles), the OPTION rules (`contracts-option`, read off the market's units) and the
|
|
118
|
+
* CONTRACTS rules (`cme-root-contracts` and the multiples of them, read off the product root and the live plane). The
|
|
119
|
+
* run head reads each family with its own verdict and memo; a family the rules leave empty is absent. */
|
|
90
120
|
export interface WrunMarketScaledFamilies {
|
|
91
121
|
volume?: Readonly<Record<string, WrunMarketScaledRule>>;
|
|
92
122
|
options?: Readonly<Record<string, WrunMarketScaledRule>>;
|
|
123
|
+
contracts?: Readonly<Record<string, WrunMarketScaledRule>>;
|
|
93
124
|
}
|
|
94
|
-
/** The scaled rules split into their families (`WrunMarketScaledFamilies`): every option rule to `options`, every
|
|
95
|
-
* rule to `volume`. */
|
|
125
|
+
/** The scaled rules split into their families (`WrunMarketScaledFamilies`): every option rule to `options`, every
|
|
126
|
+
* contracts rule and multiple of one to `contracts`, every other rule to `volume`. */
|
|
96
127
|
export declare function wrunMarketScaledFamilies(rules: Readonly<Record<string, WrunMarketScaledRule>>): WrunMarketScaledFamilies;
|
|
97
128
|
/** A market's daily volume in its candles' unit (the coin rule's volume), `wrunDailyCandleSum` of each candle's
|
|
98
129
|
* volume. */
|
|
@@ -147,10 +178,11 @@ export type WrunMarketSizeVerdict =
|
|
|
147
178
|
* contract market), placed by the directory in another unit (`size-unit`: shares), candles in another unit than the
|
|
148
179
|
* tape (`candle-unit`: contracts on an inverse or an OKX swap, a formula chart's candles, which are no market's). The
|
|
149
180
|
* dollar rule: no point value (`point-value`: ICE, PLATTS, a CME root off the table), a quote that is no dollar
|
|
150
|
-
* (`quote`: KRW, a coin), a formula chart (`candle-unit`).
|
|
181
|
+
* (`quote`: KRW, a coin), a formula chart (`candle-unit`). The contracts rule: prints judged per fill (`per-fill`:
|
|
182
|
+
* the per-order switch off, a venue it never holds for, or a CME root the large-print table does not hold). */
|
|
151
183
|
| {
|
|
152
184
|
kind: 'package';
|
|
153
|
-
reason: 'contracts' | 'size-unit' | 'candle-unit' | 'point-value' | 'quote';
|
|
185
|
+
reason: 'contracts' | 'size-unit' | 'candle-unit' | 'point-value' | 'quote' | 'per-fill';
|
|
154
186
|
}
|
|
155
187
|
/** Nothing moves yet (the record keeps what it holds, and the next run asks again), on facts that can still change:
|
|
156
188
|
* a size unit not known yet (`size-unit`: the directory has not placed the market, or its lookup failed), a dollar
|
|
@@ -174,6 +206,23 @@ export declare function wrunMarketSizeVerdict(allRules: Readonly<Record<string,
|
|
|
174
206
|
* good and a record never keeps another market's option.
|
|
175
207
|
*/
|
|
176
208
|
export declare function wrunMarketOptionVerdict(rules: Readonly<Record<string, WrunMarketScaledRule>>, facts: WrunMarketSizeFacts): WrunMarketSizeVerdict;
|
|
209
|
+
/** The facts the contracts rule reads, both the head's (wrun-market-size-defaults.util): whether the per-order switch
|
|
210
|
+
* holds for the chart market (`wrunTapePerOrder`: a CME Group venue and the host's `tapePerOrder`), and its CME product
|
|
211
|
+
* root (live-trades-merge.util `tradesCmeProductRoot`, the root the large floor reads). */
|
|
212
|
+
export interface WrunMarketContractsFacts {
|
|
213
|
+
perOrder: boolean;
|
|
214
|
+
root: string | undefined;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The verdict of a market's facts on a package's CONTRACTS rules (the head passes `wrunMarketScaledFamilies(...).
|
|
218
|
+
* contracts`). It reads no candles: where prints are judged per order (the switch holds and the large-print table
|
|
219
|
+
* holds the root, `tradesLargeServesCmeRoot`: its tape reads the collector's one row per order), each root contracts
|
|
220
|
+
* rule's row for the root (its `other` for a root the table lacks) and each multiple of one (`market`); where they are
|
|
221
|
+
* judged per fill (the switch off, or a root the large-print table does not hold, whose tape rides the raw fills), the
|
|
222
|
+
* package's own defaults (`package`, `per-fill`), so a record never keeps a per-order default once its tape is no
|
|
223
|
+
* longer judged per order.
|
|
224
|
+
*/
|
|
225
|
+
export declare function wrunMarketContractsVerdict(rules: Readonly<Record<string, WrunMarketScaledRule>>, facts: WrunMarketContractsFacts): WrunMarketSizeVerdict;
|
|
177
226
|
/** What one unit of a market's STORED trade amount is worth in US dollars (wrun-chart-market-facts.util
|
|
178
227
|
* `wrunMarketStoredUnitDollars`, read by the head: the large-print writer's own price of one, off the market's newest
|
|
179
228
|
* TRADE_LARGE print), or why that cannot be proven (`transient` while a read can still answer it). */
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { WRUN_MARKET_SIZE_UNITS } from './wrun-market-facts.util.js';
|
|
2
|
+
import { tradesLargeServesCmeRoot } from '../../kscript-data/controls/live-trades-merge.util.js';
|
|
3
|
+
/**
|
|
4
|
+
* Big Trades' Min size in contracts on a CME Group market whose prints are judged per aggressor order, by product root:
|
|
5
|
+
* the smallest 1, 2 or 5 floor with at most 30 orders an hour on Friday 2026-10-23's open hour (at a flat 10, NQ showed
|
|
6
|
+
* 652 orders an hour and ES 5,827). A root the table lacks reads `WRUN_CME_ROOT_MIN_CONTRACTS_OTHER` where the
|
|
7
|
+
* large-print table holds it; a root the large-print table does not hold is judged per fill (`wrunMarketContractsVerdict`).
|
|
8
|
+
*/
|
|
9
|
+
export const WRUN_CME_ROOT_MIN_CONTRACTS = Object.freeze({
|
|
10
|
+
NQ: 50,
|
|
11
|
+
ES: 200,
|
|
12
|
+
MNQ: 200,
|
|
13
|
+
MES: 200,
|
|
14
|
+
RTY: 50,
|
|
15
|
+
YM: 20,
|
|
16
|
+
CL: 50,
|
|
17
|
+
GC: 50,
|
|
18
|
+
'6E': 50,
|
|
19
|
+
ZN: 500,
|
|
20
|
+
});
|
|
21
|
+
/** The contracts floor of a CME root the table does not list: the package's 10. */
|
|
22
|
+
export const WRUN_CME_ROOT_MIN_CONTRACTS_OTHER = 10;
|
|
2
23
|
/**
|
|
3
24
|
* The params whose default follows the market, by package name, then param name (the sheet's own names). A built-in
|
|
4
25
|
* twin whose sheet binds a param to a trade floor lists it here or in the guard's exemptions with a reason
|
|
@@ -17,8 +38,15 @@ export const WRUN_MARKET_SCALED_PARAMS = Object.freeze({
|
|
|
17
38
|
// 0.7.0: Size shown as reads Contracts or coins (1) on a chart that counts contracts, the package's Dollars (0)
|
|
18
39
|
// elsewhere.
|
|
19
40
|
size_shown_as: Object.freeze({ kind: 'contracts-option', option: 1 }),
|
|
20
|
-
// 0.8.0
|
|
21
|
-
//
|
|
41
|
+
// 0.8.0, the contracts rule: Min size by the CME product root where prints are judged per order, the package's
|
|
42
|
+
// flat 10 where they are judged per fill.
|
|
43
|
+
min_contracts: Object.freeze({
|
|
44
|
+
kind: 'cme-root-contracts',
|
|
45
|
+
table: WRUN_CME_ROOT_MIN_CONTRACTS,
|
|
46
|
+
other: WRUN_CME_ROOT_MIN_CONTRACTS_OTHER,
|
|
47
|
+
}),
|
|
48
|
+
// 0.8.0: the whale threshold in contracts, ten times Min size's (the package's 100 per fill).
|
|
49
|
+
whale_contracts: Object.freeze({ kind: 'times', param: 'min_contracts', factor: 10 }),
|
|
22
50
|
}),
|
|
23
51
|
});
|
|
24
52
|
/** The scaled params of a package, or undefined for a package that scales none. */
|
|
@@ -39,20 +67,30 @@ export function wrunMarketScaledRulesOfSheet(rules, paramNames) {
|
|
|
39
67
|
kept[name] = rule;
|
|
40
68
|
return Object.keys(kept).length > 0 ? kept : undefined;
|
|
41
69
|
}
|
|
42
|
-
/**
|
|
43
|
-
|
|
70
|
+
/** Whether a rule belongs to the contracts family: a root contracts rule, or a multiple of one of `rules`. */
|
|
71
|
+
function isWrunContractsRule(rule, rules) {
|
|
72
|
+
if (rule.kind === 'cme-root-contracts')
|
|
73
|
+
return true;
|
|
74
|
+
return rule.kind === 'times' && rules[rule.param]?.kind === 'cme-root-contracts';
|
|
75
|
+
}
|
|
76
|
+
/** The scaled rules split into their families (`WrunMarketScaledFamilies`): every option rule to `options`, every
|
|
77
|
+
* contracts rule and multiple of one to `contracts`, every other rule to `volume`. */
|
|
44
78
|
export function wrunMarketScaledFamilies(rules) {
|
|
45
79
|
const volume = {};
|
|
46
80
|
const options = {};
|
|
81
|
+
const contracts = {};
|
|
47
82
|
for (const [name, rule] of Object.entries(rules)) {
|
|
48
83
|
if (rule.kind === 'contracts-option')
|
|
49
84
|
options[name] = rule;
|
|
85
|
+
else if (isWrunContractsRule(rule, rules))
|
|
86
|
+
contracts[name] = rule;
|
|
50
87
|
else
|
|
51
88
|
volume[name] = rule;
|
|
52
89
|
}
|
|
53
90
|
return {
|
|
54
91
|
...(Object.keys(volume).length > 0 ? { volume } : {}),
|
|
55
92
|
...(Object.keys(options).length > 0 ? { options } : {}),
|
|
93
|
+
...(Object.keys(contracts).length > 0 ? { contracts } : {}),
|
|
56
94
|
};
|
|
57
95
|
}
|
|
58
96
|
const HOUR_MS = 3_600_000;
|
|
@@ -145,7 +183,8 @@ export function wrunMarketScaledDefaults(rules, dailyVolume, dailyDollarVolume)
|
|
|
145
183
|
defaults[name] = value;
|
|
146
184
|
}
|
|
147
185
|
for (const [name, rule] of Object.entries(rules)) {
|
|
148
|
-
|
|
186
|
+
// A multiple of a contracts rule is the contracts family's (`wrunMarketContractsVerdict`), never a volume default.
|
|
187
|
+
if (rule.kind !== 'times' || isWrunContractsRule(rule, rules))
|
|
149
188
|
continue;
|
|
150
189
|
const base = defaults[rule.param];
|
|
151
190
|
if (base === undefined)
|
|
@@ -233,6 +272,32 @@ export function wrunMarketOptionVerdict(rules, facts) {
|
|
|
233
272
|
}
|
|
234
273
|
return { kind: 'market', defaults };
|
|
235
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* The verdict of a market's facts on a package's CONTRACTS rules (the head passes `wrunMarketScaledFamilies(...).
|
|
277
|
+
* contracts`). It reads no candles: where prints are judged per order (the switch holds and the large-print table
|
|
278
|
+
* holds the root, `tradesLargeServesCmeRoot`: its tape reads the collector's one row per order), each root contracts
|
|
279
|
+
* rule's row for the root (its `other` for a root the table lacks) and each multiple of one (`market`); where they are
|
|
280
|
+
* judged per fill (the switch off, or a root the large-print table does not hold, whose tape rides the raw fills), the
|
|
281
|
+
* package's own defaults (`package`, `per-fill`), so a record never keeps a per-order default once its tape is no
|
|
282
|
+
* longer judged per order.
|
|
283
|
+
*/
|
|
284
|
+
export function wrunMarketContractsVerdict(rules, facts) {
|
|
285
|
+
if (!facts.perOrder || !tradesLargeServesCmeRoot(facts.root))
|
|
286
|
+
return { kind: 'package', reason: 'per-fill' };
|
|
287
|
+
const defaults = {};
|
|
288
|
+
for (const [name, rule] of Object.entries(rules)) {
|
|
289
|
+
if (rule.kind !== 'cme-root-contracts')
|
|
290
|
+
continue;
|
|
291
|
+
const root = facts.root;
|
|
292
|
+
defaults[name] = root !== undefined && Object.hasOwn(rule.table, root) ? rule.table[root] : rule.other;
|
|
293
|
+
}
|
|
294
|
+
for (const [name, rule] of Object.entries(rules)) {
|
|
295
|
+
if (rule.kind !== 'times' || defaults[rule.param] === undefined)
|
|
296
|
+
continue;
|
|
297
|
+
defaults[name] = Number((defaults[rule.param] * rule.factor).toPrecision(12));
|
|
298
|
+
}
|
|
299
|
+
return { kind: 'market', defaults };
|
|
300
|
+
}
|
|
236
301
|
/** The rules of one family: its volume rules and the multiples of them. */
|
|
237
302
|
function wrunRulesOfFamily(rules, family) {
|
|
238
303
|
const kept = {};
|
|
@@ -46,8 +46,14 @@
|
|
|
46
46
|
* carried one included) counts `ceil(value / dollars per contract)` at the stored-unit price; the contracts row is
|
|
47
47
|
* marked, the old name cleared, the dollar row back to untouched (the market's dollar default then moves it). It runs
|
|
48
48
|
* before the dollar carry and takes its own raw names, so the dollar carry never prices them; ring
|
|
49
|
-
* `wrun-market-size-contract-carry`.
|
|
50
|
-
*
|
|
49
|
+
* `wrun-market-size-contract-carry`.
|
|
50
|
+
* - The contracts family (BT-ORDER-FLOOR, Big Trades 0.8.0's Min size and Whale size in contracts, `cme-root-contracts`
|
|
51
|
+
* and its multiple): split off like the option family, resolved after the warm block with its own verdict
|
|
52
|
+
* (`wrunMarketContractsVerdict`, no candles read), memo key (`<market>#contracts`) and ring line
|
|
53
|
+
* (`wrun-market-size-contracts-defaults`). Where the per-order switch holds for the chart market (`wrunTapePerOrder`:
|
|
54
|
+
* its tape judged per aggressor order) an untouched Min size moves to its product root's floor (NQ 50, ES 200, any other
|
|
55
|
+
* root 10) and Whale size to ten times that; where prints are judged per fill, both stay at (or return to) the
|
|
56
|
+
* package's flat 10 and 100. The contracts carry runs first, so a carried count is a changed value the move keeps.
|
|
51
57
|
*
|
|
52
58
|
* Advisory: it never fails the run.
|
|
53
59
|
*/
|
|
@@ -56,10 +62,12 @@ import { candleVolumeIsBaseCoins } from '../chart/candle-volume-unit.leaf.js';
|
|
|
56
62
|
import { normalizeTransformations, selfTransformationToken } from '../common/transformations.util.js';
|
|
57
63
|
import { wrunChartIntervalMsOf } from './wrun-chart-context.util.js';
|
|
58
64
|
import { warmWrunMarketDollarFacts, warmWrunMarketStoredUnit, wrunChartSizeUnit, wrunMarketDollarUnit, wrunMarketStoredUnitDollars, } from './wrun-chart-market-facts.util.js';
|
|
59
|
-
import {
|
|
65
|
+
import { tradesCmeProductRoot } from '../../kscript-data/controls/live-trades-merge.util.js';
|
|
66
|
+
import { isWrunMarketScaledRow, wrunCarriedDollarValue, wrunCarryKeepsRawValue, wrunMarketContractsVerdict, wrunMarketDefaultWithinRow, wrunMarketOptionVerdict, wrunMarketScaledFamilies, wrunMarketScaledParamsOf, wrunMarketScaledRulesOfSheet, wrunMarketSizeVerdict, } from './wrun-market-size-defaults.leaf.js';
|
|
60
67
|
import { WRUN_CONTRACT_CARRY_PENDING, wrunContractCarryPatch, wrunContractCarrySettles, wrunPendingContractCarries, } from './wrun-market-size-contract-carry.leaf.js';
|
|
61
68
|
import { wrunChartMarketIdentity } from './wrun-overlay-drivers.util.js';
|
|
62
69
|
import { wrunRegistryRefOf } from './wrun-overlay-identity.util.js';
|
|
70
|
+
import { wrunTapePerOrder } from './wrun-tape-per-order.util.js';
|
|
63
71
|
import { wrunRowValue, wrunRowValuesEqual, wrunValuesEqual, } from './wrun-script-inputs.util.js';
|
|
64
72
|
import { wrunChartCandleRows } from './wrun-source-rows.util.js';
|
|
65
73
|
function isRecord(value) {
|
|
@@ -260,11 +268,14 @@ export async function reconcileWrunMarketSizeDefaults(args) {
|
|
|
260
268
|
const marketKey = formula === undefined ? `${exchange}|${symbol}` : `${exchange}|${symbol}|${formula}`;
|
|
261
269
|
const volumeKey = family === undefined ? undefined : `${marketKey}#${family}`;
|
|
262
270
|
const optionKey = families.options === undefined ? undefined : `${marketKey}#options`;
|
|
271
|
+
const contractsKey = families.contracts === undefined ? undefined : `${marketKey}#contracts`;
|
|
263
272
|
let resolved = wrunMarketSizeDefaultsByMount.get(meta);
|
|
264
273
|
let volumeDefaults = volumeKey === undefined ? undefined : resolved?.get(volumeKey);
|
|
265
274
|
let optionDefaults = optionKey === undefined ? undefined : resolved?.get(optionKey);
|
|
275
|
+
let contractsDefaults = contractsKey === undefined ? undefined : resolved?.get(contractsKey);
|
|
266
276
|
const volumeOwed = volumeKey !== undefined && volumeDefaults === undefined;
|
|
267
277
|
const optionsOwed = optionKey !== undefined && optionDefaults === undefined;
|
|
278
|
+
const contractsOwed = contractsKey !== undefined && contractsDefaults === undefined;
|
|
268
279
|
// The contracts carry (BT-CME, wrun-market-size-contract-carry.leaf): on a market that counts contracts (its size
|
|
269
280
|
// unit never waits on a read) a saved count or a changed dollar value moves into the contracts params of a sheet
|
|
270
281
|
// declaring them, by name. The raw counts it takes are its own: the dollar carry never prices one of them.
|
|
@@ -328,15 +339,30 @@ export async function reconcileWrunMarketSizeDefaults(args) {
|
|
|
328
339
|
if (optionsOwed && optionKey !== undefined && headFacts?.optionVerdict !== undefined) {
|
|
329
340
|
optionDefaults = resolve(optionKey, headFacts.optionVerdict, families.options, 'wrun-market-size-option-defaults', 'options');
|
|
330
341
|
}
|
|
342
|
+
// The contracts family reads no candles and waits on no read: the chart market's root and whether the per-order
|
|
343
|
+
// switch holds for it, read now that the chart is proven still on the keyed market (a switch during the warm block
|
|
344
|
+
// returns below, before anything is kept).
|
|
345
|
+
if (contractsOwed && contractsKey !== undefined && families.contracts !== undefined && keyed()) {
|
|
346
|
+
const now = market.read() ?? undefined;
|
|
347
|
+
const verdict = wrunMarketContractsVerdict(families.contracts, {
|
|
348
|
+
perOrder: wrunTapePerOrder(now?.exchange),
|
|
349
|
+
root: tradesCmeProductRoot({
|
|
350
|
+
exchange: now?.exchange,
|
|
351
|
+
normalizedSymbol: now?.normalizedSymbol,
|
|
352
|
+
symbol: now?.symbol,
|
|
353
|
+
}),
|
|
354
|
+
});
|
|
355
|
+
contractsDefaults = resolve(contractsKey, verdict, families.contracts, 'wrun-market-size-contracts-defaults', 'contracts');
|
|
356
|
+
}
|
|
331
357
|
if (!keyed())
|
|
332
358
|
return;
|
|
333
359
|
// The carries first (each value a marked changed one, `carriedValue`, so the move below keeps it): the contracts
|
|
334
360
|
// carry, then the dollar carry over what it left; then the market's defaults, both families' in one patch.
|
|
335
361
|
const storedUnit = headFacts?.storedUnit;
|
|
336
362
|
const sizeUnit = headFacts?.sizeUnit;
|
|
337
|
-
const defaults = volumeDefaults === undefined && optionDefaults === undefined
|
|
363
|
+
const defaults = volumeDefaults === undefined && optionDefaults === undefined && contractsDefaults === undefined
|
|
338
364
|
? undefined
|
|
339
|
-
: { ...(volumeDefaults ?? {}), ...(optionDefaults ?? {}) };
|
|
365
|
+
: { ...(volumeDefaults ?? {}), ...(optionDefaults ?? {}), ...(contractsDefaults ?? {}) };
|
|
340
366
|
// What one contract is worth: the large-print writer's own price of one stored unit (a CME contract).
|
|
341
367
|
const perContract = storedUnit?.kind === 'dollars' ? storedUnit.perUnit : undefined;
|
|
342
368
|
const contractCarry = wrunContractCarryPatch(meta.settings, contractPending, perContract);
|
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
* `governed: 'opra'`): written once here, read by both planners, the run pass and the live tick.
|
|
5
5
|
*
|
|
6
6
|
* - WHO may read: `mayReadOpra` (opra-read-access.leaf: an official package always, a draft or community
|
|
7
|
-
* package only while the `opra-user-scripts` flag opened the plane to it
|
|
8
|
-
*
|
|
9
|
-
* options chain's own record,
|
|
7
|
+
* package only while the `opra-user-scripts` flag opened the plane to it, the OPRA licence covering
|
|
8
|
+
* user-authored scripting, Kyle 2026-10-27). Any other run is refused by name before any fetch,
|
|
9
|
+
* `opra-official-only:<class>`, seeded as the wall on US options data (the options chain's own record,
|
|
10
|
+
* `cme-wall` / `opra`).
|
|
10
11
|
* - The ASK: an OPRA lane's payload names the plane it reads (`wrunPlane: 'opra'`, which Door C judges as
|
|
11
12
|
* an OPRA ask whatever the payload's exchange) and the tier the read is routed to (`servedTier`,
|
|
12
13
|
* governed-route.util `governedMarketDataTier`, re-read on every ask), so no source cache serves one
|
|
13
|
-
* tier's rows to the other and the legend names the tier the rows rode.
|
|
14
|
+
* tier's rows to the other and the legend names the tier the rows rode. The tier is the viewer's (the
|
|
15
|
+
* gate's tier frame for the session), whoever wrote the package.
|
|
14
16
|
* - PROVENANCE: a run that asks such a lane stamps the overlay's OPRA provenance before its first fetch
|
|
15
17
|
* and sheds it once a result read off another source replaced the rows (wrun-overlay-run.util).
|
|
16
18
|
*
|
|
@@ -22,6 +24,17 @@ import { type WrunRefusalSeed } from './wrun-refusal.util.js';
|
|
|
22
24
|
export declare const WRUN_OPRA_OFFICIAL_ONLY_CODE = "opra-official-only";
|
|
23
25
|
/** The routed tier an OPRA lane's ask names. */
|
|
24
26
|
export type WrunOpraServedTier = 'realtime' | 'delayed';
|
|
27
|
+
/**
|
|
28
|
+
* The receipt of the OPRA rows a hosted (Cloud) frame was computed from (contract opra-server-lanes C4: the frame's
|
|
29
|
+
* `output.wrunOpraTier` and `output.wrunOpraDelaySeconds` beside its `wrunOpra` mark): the tier the gate served the
|
|
30
|
+
* run's owner and that tier's delay. A frame with the mark and no tier names none: its tier is unknown, and the
|
|
31
|
+
* legend then names no tier at all (the account's tier is never put in its place).
|
|
32
|
+
*/
|
|
33
|
+
export interface WrunOpraServedReceipt {
|
|
34
|
+
tier: WrunOpraServedTier;
|
|
35
|
+
/** Seconds behind real time (0 for real-time); absent when the frame named no figure. */
|
|
36
|
+
delaySeconds?: number;
|
|
37
|
+
}
|
|
25
38
|
/** The named refusal of an OPRA lane a run may not read: `opra-official-only:<class>`. */
|
|
26
39
|
export declare function wrunOpraOfficialOnlyCode(sourceClass: string): string;
|
|
27
40
|
/** The record seed of that refusal: the wall on US options data (the options chain's own). */
|
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
* `governed: 'opra'`): written once here, read by both planners, the run pass and the live tick.
|
|
5
5
|
*
|
|
6
6
|
* - WHO may read: `mayReadOpra` (opra-read-access.leaf: an official package always, a draft or community
|
|
7
|
-
* package only while the `opra-user-scripts` flag opened the plane to it
|
|
8
|
-
*
|
|
9
|
-
* options chain's own record,
|
|
7
|
+
* package only while the `opra-user-scripts` flag opened the plane to it, the OPRA licence covering
|
|
8
|
+
* user-authored scripting, Kyle 2026-10-27). Any other run is refused by name before any fetch,
|
|
9
|
+
* `opra-official-only:<class>`, seeded as the wall on US options data (the options chain's own record,
|
|
10
|
+
* `cme-wall` / `opra`).
|
|
10
11
|
* - The ASK: an OPRA lane's payload names the plane it reads (`wrunPlane: 'opra'`, which Door C judges as
|
|
11
12
|
* an OPRA ask whatever the payload's exchange) and the tier the read is routed to (`servedTier`,
|
|
12
13
|
* governed-route.util `governedMarketDataTier`, re-read on every ask), so no source cache serves one
|
|
13
|
-
* tier's rows to the other and the legend names the tier the rows rode.
|
|
14
|
+
* tier's rows to the other and the legend names the tier the rows rode. The tier is the viewer's (the
|
|
15
|
+
* gate's tier frame for the session), whoever wrote the package.
|
|
14
16
|
* - PROVENANCE: a run that asks such a lane stamps the overlay's OPRA provenance before its first fetch
|
|
15
17
|
* and sheds it once a result read off another source replaced the rows (wrun-overlay-run.util).
|
|
16
18
|
*
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** A book fold's row layouts (pb-common `OptionChainRowLayout` 10 and 12 to 19; 11, the greek projection's, is not
|
|
2
|
+
* served), column 0 of their rows on a view block (the kit's `WRUN_OPTION_BOOK_LAYOUTS`). */
|
|
3
|
+
export declare const WRUN_OPTION_BOOK_LAYOUTS: Readonly<{
|
|
4
|
+
readonly numbers: 10;
|
|
5
|
+
readonly book_stamp: 12;
|
|
6
|
+
readonly vol_term: 13;
|
|
7
|
+
readonly smile_series: 14;
|
|
8
|
+
readonly smile_point: 15;
|
|
9
|
+
readonly surface_cell: 16;
|
|
10
|
+
readonly profile_strike: 17;
|
|
11
|
+
readonly profile_levels: 18;
|
|
12
|
+
readonly profile_point: 19;
|
|
13
|
+
}>;
|
|
14
|
+
export type WrunOptionBookLayout = keyof typeof WRUN_OPTION_BOOK_LAYOUTS;
|
|
15
|
+
/** The cells of one row of each book layout as the data plane answers it, the layout column not counted (the kit's
|
|
16
|
+
* `WRUN_OPTION_BOOK_LAYOUT_WIDTHS`, the data plane's `bookLayoutWidths`): rows of another width are refused. */
|
|
17
|
+
export declare const WRUN_OPTION_BOOK_LAYOUT_WIDTHS: Readonly<{
|
|
18
|
+
readonly numbers: 11;
|
|
19
|
+
readonly book_stamp: 10;
|
|
20
|
+
readonly vol_term: 15;
|
|
21
|
+
readonly smile_series: 3;
|
|
22
|
+
readonly smile_point: 4;
|
|
23
|
+
readonly surface_cell: 3;
|
|
24
|
+
readonly profile_strike: 9;
|
|
25
|
+
readonly profile_levels: 12;
|
|
26
|
+
readonly profile_point: 2;
|
|
27
|
+
}>;
|
|
28
|
+
/** The book stamp version this host reads (the kit's `WRUN_OPTION_BOOK_STAMP_CODES.version`), and its field. */
|
|
29
|
+
export declare const WRUN_OPTION_BOOK_STAMP_VERSION = 1;
|
|
30
|
+
/** One entry of a data plane answer to a view ask (`OptionChainViewRows`, the kit's `WrunOptionViewAnswerRows`): its
|
|
31
|
+
* layout, where its rows start in the answer's packed cells, how many there are and how wide each is (a zero the wire
|
|
32
|
+
* leaves out reads 0), and the place in the ask of the view they answer. */
|
|
33
|
+
export interface WrunOptionViewAnswerRows {
|
|
34
|
+
readonly view?: number;
|
|
35
|
+
readonly layout: number;
|
|
36
|
+
readonly offset?: number;
|
|
37
|
+
readonly count?: number;
|
|
38
|
+
readonly width: number;
|
|
39
|
+
}
|
|
40
|
+
/** Whether an answer entry's layout is a book fold's (10 and 12 to 19, the book stamp included). */
|
|
41
|
+
export declare function wrunOptionIsBookLayout(layout: number): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The view block rows of a data plane answer's book fold entries (the kit's `wrunOptionBookViewRows`, the host's half
|
|
44
|
+
* of the book fold contract): each entry's rows as `[layout, ...cells]`, padded with 0 to `width` (the input's row
|
|
45
|
+
* width, `wrunOptionInputTupleWidth`), each layout's rows in the answer's order, every value the answer's own (NaN
|
|
46
|
+
* kept). A reader takes no order across layouts, so a host whose ask also names views of the block lays their rows
|
|
47
|
+
* beside these. Refused by name, never read in part: an entry of a layout no book fold answers, rows of another width
|
|
48
|
+
* than their layout's (`WRUN_OPTION_BOOK_LAYOUT_WIDTHS`), rows past the cells, a layout wider than the input's rows, no
|
|
49
|
+
* book stamp or more than one, and a stamp of another version than `WRUN_OPTION_BOOK_STAMP_VERSION`. An empty book
|
|
50
|
+
* answers its stamp alone (S0 NaN): the stamp row is the block, and the pane clears.
|
|
51
|
+
*/
|
|
52
|
+
export declare function wrunOptionBookViewRows(cells: ArrayLike<number>, entries: readonly WrunOptionViewAnswerRows[], width: number): {
|
|
53
|
+
rows: number[][];
|
|
54
|
+
} | {
|
|
55
|
+
refused: string;
|
|
56
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// The host's half of a book fold answer (D-DEDUPE phase 1b): the data plane's book fold rows, laid out on an
|
|
2
|
+
// options_chain input's view block. Only the worker that reads an answer loads this module; the book folds' words,
|
|
3
|
+
// knobs and row widths, which a declaration needs, are wrun-option-views.util.ts's. Every table here is the kit's,
|
|
4
|
+
// pinned by tests/utility/wrun/wrun-option-views.book.kit-pin.spec.ts.
|
|
5
|
+
/** A book fold's row layouts (pb-common `OptionChainRowLayout` 10 and 12 to 19; 11, the greek projection's, is not
|
|
6
|
+
* served), column 0 of their rows on a view block (the kit's `WRUN_OPTION_BOOK_LAYOUTS`). */
|
|
7
|
+
export const WRUN_OPTION_BOOK_LAYOUTS = Object.freeze({
|
|
8
|
+
numbers: 10,
|
|
9
|
+
book_stamp: 12,
|
|
10
|
+
vol_term: 13,
|
|
11
|
+
smile_series: 14,
|
|
12
|
+
smile_point: 15,
|
|
13
|
+
surface_cell: 16,
|
|
14
|
+
profile_strike: 17,
|
|
15
|
+
profile_levels: 18,
|
|
16
|
+
profile_point: 19,
|
|
17
|
+
});
|
|
18
|
+
/** The cells of one row of each book layout as the data plane answers it, the layout column not counted (the kit's
|
|
19
|
+
* `WRUN_OPTION_BOOK_LAYOUT_WIDTHS`, the data plane's `bookLayoutWidths`): rows of another width are refused. */
|
|
20
|
+
export const WRUN_OPTION_BOOK_LAYOUT_WIDTHS = Object.freeze({
|
|
21
|
+
numbers: 11,
|
|
22
|
+
book_stamp: 10,
|
|
23
|
+
vol_term: 15,
|
|
24
|
+
smile_series: 3,
|
|
25
|
+
smile_point: 4,
|
|
26
|
+
surface_cell: 3,
|
|
27
|
+
profile_strike: 9,
|
|
28
|
+
profile_levels: 12,
|
|
29
|
+
profile_point: 2,
|
|
30
|
+
});
|
|
31
|
+
/** The book stamp version this host reads (the kit's `WRUN_OPTION_BOOK_STAMP_CODES.version`), and its field. */
|
|
32
|
+
export const WRUN_OPTION_BOOK_STAMP_VERSION = 1;
|
|
33
|
+
const BOOK_STAMP_VERSION_FIELD = 9;
|
|
34
|
+
/** Each book layout's row cells by its number. */
|
|
35
|
+
const BOOK_LAYOUT_WIDTHS_BY_NUMBER = new Map(Object.keys(WRUN_OPTION_BOOK_LAYOUTS).map((layout) => [
|
|
36
|
+
WRUN_OPTION_BOOK_LAYOUTS[layout],
|
|
37
|
+
WRUN_OPTION_BOOK_LAYOUT_WIDTHS[layout],
|
|
38
|
+
]));
|
|
39
|
+
/** Whether an answer entry's layout is a book fold's (10 and 12 to 19, the book stamp included). */
|
|
40
|
+
export function wrunOptionIsBookLayout(layout) {
|
|
41
|
+
return BOOK_LAYOUT_WIDTHS_BY_NUMBER.has(layout);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The view block rows of a data plane answer's book fold entries (the kit's `wrunOptionBookViewRows`, the host's half
|
|
45
|
+
* of the book fold contract): each entry's rows as `[layout, ...cells]`, padded with 0 to `width` (the input's row
|
|
46
|
+
* width, `wrunOptionInputTupleWidth`), each layout's rows in the answer's order, every value the answer's own (NaN
|
|
47
|
+
* kept). A reader takes no order across layouts, so a host whose ask also names views of the block lays their rows
|
|
48
|
+
* beside these. Refused by name, never read in part: an entry of a layout no book fold answers, rows of another width
|
|
49
|
+
* than their layout's (`WRUN_OPTION_BOOK_LAYOUT_WIDTHS`), rows past the cells, a layout wider than the input's rows, no
|
|
50
|
+
* book stamp or more than one, and a stamp of another version than `WRUN_OPTION_BOOK_STAMP_VERSION`. An empty book
|
|
51
|
+
* answers its stamp alone (S0 NaN): the stamp row is the block, and the pane clears.
|
|
52
|
+
*/
|
|
53
|
+
export function wrunOptionBookViewRows(cells, entries, width) {
|
|
54
|
+
const rows = [];
|
|
55
|
+
let stamps = 0;
|
|
56
|
+
for (const entry of entries) {
|
|
57
|
+
const layoutWidth = BOOK_LAYOUT_WIDTHS_BY_NUMBER.get(entry.layout);
|
|
58
|
+
if (layoutWidth === undefined) {
|
|
59
|
+
return { refused: `the answer holds rows of layout ${entry.layout}, which no book fold answers` };
|
|
60
|
+
}
|
|
61
|
+
if (entry.width !== layoutWidth) {
|
|
62
|
+
return {
|
|
63
|
+
refused: `the answer's layout ${entry.layout} rows are ${entry.width} wide, the layout's ${layoutWidth}`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (1 + layoutWidth > width) {
|
|
67
|
+
return {
|
|
68
|
+
refused: `the answer's layout ${entry.layout} rows need ${1 + layoutWidth} values a row, and the input reads ${width}`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const offset = entry.offset ?? 0;
|
|
72
|
+
const count = entry.count ?? 0;
|
|
73
|
+
if (!(offset >= 0 && count >= 0 && offset + count * layoutWidth <= cells.length)) {
|
|
74
|
+
return { refused: `the answer's layout ${entry.layout} rows reach past its ${cells.length} cells` };
|
|
75
|
+
}
|
|
76
|
+
if (entry.layout === WRUN_OPTION_BOOK_LAYOUTS.book_stamp) {
|
|
77
|
+
stamps += count;
|
|
78
|
+
const version = count === 1 ? Number(cells[offset + BOOK_STAMP_VERSION_FIELD]) : WRUN_OPTION_BOOK_STAMP_VERSION;
|
|
79
|
+
if (version !== WRUN_OPTION_BOOK_STAMP_VERSION) {
|
|
80
|
+
return { refused: `the book stamp is version ${version}, which this kit does not read` };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (let row = 0; row < count; row += 1) {
|
|
84
|
+
const out = new Array(width).fill(0);
|
|
85
|
+
out[0] = entry.layout;
|
|
86
|
+
for (let column = 0; column < layoutWidth; column += 1) {
|
|
87
|
+
out[1 + column] = Number(cells[offset + row * layoutWidth + column]);
|
|
88
|
+
}
|
|
89
|
+
rows.push(out);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (stamps !== 1) {
|
|
93
|
+
return { refused: stamps === 0 ? 'the answer holds no book stamp' : `the answer holds ${stamps} book stamps` };
|
|
94
|
+
}
|
|
95
|
+
return { rows };
|
|
96
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LiveBucketVenue } from '../chart/live-bucket.util.js';
|
|
2
|
+
import { type WrunRowLaneContext, type WrunRowLaneDownloadChart, type WrunRowLaneSource } from './sources/wrun-row-lane.types.js';
|
|
3
|
+
/** The OPRA plane's delayed route, as the forecast reads it: the gate serves a read up to its now minus this
|
|
4
|
+
* (governed-route.util `servedDelaySecondsForAccess`, 15 minutes on OPRA), so a grouped read is cut at its grid's last
|
|
5
|
+
* boundary behind it and the rest is folded (k-option-strike-flow.worker.ts, the delayed tail). */
|
|
6
|
+
export declare const WRUN_OPTION_FLOW_DELAYED_FORECAST_MS: number;
|
|
7
|
+
/**
|
|
8
|
+
* The contract rows the worker is forecast to fold in the browser for one strike flow read over a window's host bars,
|
|
9
|
+
* before any fetch, by the worker's own choice (k-option-strike-flow.worker `streamHistoricalData`): every bar on a
|
|
10
|
+
* crypto chain (the grouped scopes sum every book of a coin), every bar of a grouping the gateway cannot draw on the
|
|
11
|
+
* chain's venue (`wrunOptionFlowGroupedRead` `host`, the worker's call: a Globex lattice bar off the UTC floor, a
|
|
12
|
+
* session span on a clock with no gateway session, a week), and on a delayed route (`servedTier` "delayed") the groups that end past the delayed bound (a session span's
|
|
13
|
+
* whole newest session, a bar grouping's bars ending past it). Projected by the fold plan's own rule (`projectedRows`,
|
|
14
|
+
* under the source answer budget one fold read keeps today). 0 when the data plane groups the whole window. Under
|
|
15
|
+
* `history` "today" only today's bars count (the acquisition's `todayFromMs`, else the newest bar's trade date on the
|
|
16
|
+
* chain's clock).
|
|
17
|
+
*/
|
|
18
|
+
export declare function wrunOptionStrikeFlowFoldForecastRows(args: {
|
|
19
|
+
acquisition: Readonly<Record<string, unknown>>;
|
|
20
|
+
barOpens: readonly number[];
|
|
21
|
+
barMs: number;
|
|
22
|
+
barGrid: LiveBucketVenue | undefined;
|
|
23
|
+
nowMs: number;
|
|
24
|
+
}): number;
|
|
25
|
+
/**
|
|
26
|
+
* The lane's `download.forecastBytes` (row-lanes/option_strike_flow.ts): a read of one input (its declaration, its
|
|
27
|
+
* setting-bound knobs read) on the chart's chain, priced at the forecast fold's contract rows of 21 values; undefined
|
|
28
|
+
* when the data plane groups the window, so the kit's projection of the declared read holds. A knob its rules refuse
|
|
29
|
+
* throws by name (the run's plan prices nothing for it; the lane's plan refuses the input).
|
|
30
|
+
*/
|
|
31
|
+
export declare function wrunOptionStrikeFlowForecastBytes(source: WrunRowLaneSource, ctx: WrunRowLaneContext, chart: WrunRowLaneDownloadChart): number | undefined;
|