@orangecharts/wrun-chart-host 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/constants/feature-flags.constants.d.ts +6 -1
- package/dist/constants/feature-flags.constants.js +67 -24
- package/dist/constants/opra-compliance.constants.d.ts +3 -2
- package/dist/constants/opra-compliance.constants.js +3 -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 +29 -5
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +69 -15
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
- package/dist/interfaces/replay.interface.d.ts +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +41 -4
- package/dist/kscript-data/controls/live-trades-merge.util.js +52 -7
- package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
- package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
- package/dist/market-data/billing.interface.d.ts +95 -31
- package/dist/market-data/billing.interface.js +36 -5
- package/dist/market-data/venue.d.ts +88 -6
- 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 +162 -5
- package/dist/market-data/venues/index.js +48 -6
- 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 +45 -6
- package/dist/settings-templates/tool-rules.d.ts +27 -17
- package/dist/settings-templates/tool-rules.js +27 -11
- package/dist/settings-templates/tool-tables.generated.js +91 -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/index-mode-admission.util.js +15 -2
- 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 +7 -2
- package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
- package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -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 +54 -35
- package/dist/utility/chart/kscript-venue-policy.util.js +78 -42
- 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/opra-read-access.leaf.d.ts +5 -3
- package/dist/utility/chart/opra-read-access.leaf.js +5 -3
- package/dist/utility/chart/rth-session.util.d.ts +3 -2
- package/dist/utility/chart/rth-session.util.js +2 -1
- 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/wrun-run-result.util.d.ts +12 -0
- package/dist/utility/chart/wrun-run-result.util.js +141 -6
- 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 +2 -0
- package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
- package/dist/utility/wrun/derived-roots.util.js +471 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
- 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/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 +39 -10
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -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 +174 -13
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +685 -27
- 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 +53 -12
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +101 -53
- 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-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-latest-snapshot.d.ts +11 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +13 -7
- package/dist/utility/wrun/wrun-live-intake.util.js +82 -29
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +158 -14
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +49 -10
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +65 -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-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 +47 -13
- package/dist/utility/wrun/wrun-option-views.util.js +98 -26
- 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 +17 -0
- 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-run.util.d.ts +100 -31
- package/dist/utility/wrun/wrun-overlay-run.util.js +733 -114
- 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 +63 -13
- 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.js +12 -11
- 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-refused-latest.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
- package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
- 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 +113 -8
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +5 -1
- package/dist/utility/wrun/wrun-source-rows.util.js +16 -3
- 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 +26 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
- package/dist/utils/replay/replay-buffer-math.js +227 -20
- package/package.json +11 -11
|
@@ -25,10 +25,15 @@
|
|
|
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, or any venue but the CME Group's), the package's flat 10 and 100 stand (the rule's `package`
|
|
36
|
+
* verdict, reason `per-fill`), so a record a per-order session moved returns to them. Untouched rows only, as every rule.
|
|
32
37
|
*
|
|
33
38
|
* A run reads only the family its sheet declares (`wrunMarketScaledRulesOfSheet`). A market whose closed candles cover
|
|
34
39
|
* under an hour moves nothing: the next run asks again.
|
|
@@ -72,7 +77,24 @@ export type WrunMarketScaledRule =
|
|
|
72
77
|
readonly kind: 'contracts-option';
|
|
73
78
|
readonly option: number;
|
|
74
79
|
readonly carriesFrom?: never;
|
|
80
|
+
}
|
|
81
|
+
/** A contracts floor by the CME product root (the contracts rule, `wrunMarketContractsVerdict`): the root's row of
|
|
82
|
+
* `table`, `other` for a root it lacks, where the live plane serves per-order prints; the package's default where
|
|
83
|
+
* prints are judged per fill. Never a value carried from an older version (the contracts carry has its own rules). */
|
|
84
|
+
| {
|
|
85
|
+
readonly kind: 'cme-root-contracts';
|
|
86
|
+
readonly table: Readonly<Record<string, number>>;
|
|
87
|
+
readonly other: number;
|
|
88
|
+
readonly carriesFrom?: never;
|
|
75
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Big Trades' Min size in contracts on a CME Group market whose prints are judged per aggressor order, by product root:
|
|
92
|
+
* 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
|
|
93
|
+
* 652 orders an hour and ES 5,827). A root the table lacks reads `WRUN_CME_ROOT_MIN_CONTRACTS_OTHER`.
|
|
94
|
+
*/
|
|
95
|
+
export declare const WRUN_CME_ROOT_MIN_CONTRACTS: Readonly<Record<string, number>>;
|
|
96
|
+
/** The contracts floor of a CME root the table does not list: the package's 10. */
|
|
97
|
+
export declare const WRUN_CME_ROOT_MIN_CONTRACTS_OTHER = 10;
|
|
76
98
|
/**
|
|
77
99
|
* The params whose default follows the market, by package name, then param name (the sheet's own names). A built-in
|
|
78
100
|
* twin whose sheet binds a param to a trade floor lists it here or in the guard's exemptions with a reason
|
|
@@ -85,14 +107,16 @@ export declare function wrunMarketScaledParamsOf(packageName: string | undefined
|
|
|
85
107
|
* 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
108
|
export declare function wrunMarketScaledRulesOfSheet(rules: Readonly<Record<string, WrunMarketScaledRule>> | undefined, paramNames: Iterable<string>): Readonly<Record<string, WrunMarketScaledRule>> | undefined;
|
|
87
109
|
/** 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
|
-
*
|
|
110
|
+
* multiples of them, read off the candles), the OPTION rules (`contracts-option`, read off the market's units) and the
|
|
111
|
+
* CONTRACTS rules (`cme-root-contracts` and the multiples of them, read off the product root and the live plane). The
|
|
112
|
+
* run head reads each family with its own verdict and memo; a family the rules leave empty is absent. */
|
|
90
113
|
export interface WrunMarketScaledFamilies {
|
|
91
114
|
volume?: Readonly<Record<string, WrunMarketScaledRule>>;
|
|
92
115
|
options?: Readonly<Record<string, WrunMarketScaledRule>>;
|
|
116
|
+
contracts?: Readonly<Record<string, WrunMarketScaledRule>>;
|
|
93
117
|
}
|
|
94
|
-
/** The scaled rules split into their families (`WrunMarketScaledFamilies`): every option rule to `options`, every
|
|
95
|
-
* rule to `volume`. */
|
|
118
|
+
/** The scaled rules split into their families (`WrunMarketScaledFamilies`): every option rule to `options`, every
|
|
119
|
+
* contracts rule and multiple of one to `contracts`, every other rule to `volume`. */
|
|
96
120
|
export declare function wrunMarketScaledFamilies(rules: Readonly<Record<string, WrunMarketScaledRule>>): WrunMarketScaledFamilies;
|
|
97
121
|
/** A market's daily volume in its candles' unit (the coin rule's volume), `wrunDailyCandleSum` of each candle's
|
|
98
122
|
* volume. */
|
|
@@ -147,10 +171,11 @@ export type WrunMarketSizeVerdict =
|
|
|
147
171
|
* contract market), placed by the directory in another unit (`size-unit`: shares), candles in another unit than the
|
|
148
172
|
* tape (`candle-unit`: contracts on an inverse or an OKX swap, a formula chart's candles, which are no market's). The
|
|
149
173
|
* 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`).
|
|
174
|
+
* (`quote`: KRW, a coin), a formula chart (`candle-unit`). The contracts rule: prints judged per fill (`per-fill`:
|
|
175
|
+
* the per-order switch off, or a venue it never holds for). */
|
|
151
176
|
| {
|
|
152
177
|
kind: 'package';
|
|
153
|
-
reason: 'contracts' | 'size-unit' | 'candle-unit' | 'point-value' | 'quote';
|
|
178
|
+
reason: 'contracts' | 'size-unit' | 'candle-unit' | 'point-value' | 'quote' | 'per-fill';
|
|
154
179
|
}
|
|
155
180
|
/** Nothing moves yet (the record keeps what it holds, and the next run asks again), on facts that can still change:
|
|
156
181
|
* a size unit not known yet (`size-unit`: the directory has not placed the market, or its lookup failed), a dollar
|
|
@@ -174,6 +199,20 @@ export declare function wrunMarketSizeVerdict(allRules: Readonly<Record<string,
|
|
|
174
199
|
* good and a record never keeps another market's option.
|
|
175
200
|
*/
|
|
176
201
|
export declare function wrunMarketOptionVerdict(rules: Readonly<Record<string, WrunMarketScaledRule>>, facts: WrunMarketSizeFacts): WrunMarketSizeVerdict;
|
|
202
|
+
/** The facts the contracts rule reads, both the head's (wrun-market-size-defaults.util): whether the per-order switch
|
|
203
|
+
* holds for the chart market (`wrunTapePerOrder`: a CME Group venue and the host's `tapePerOrder`), and its CME product
|
|
204
|
+
* root (live-trades-merge.util `tradesCmeProductRoot`, the root the large floor reads). */
|
|
205
|
+
export interface WrunMarketContractsFacts {
|
|
206
|
+
perOrder: boolean;
|
|
207
|
+
root: string | undefined;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The verdict of a market's facts on a package's CONTRACTS rules (the head passes `wrunMarketScaledFamilies(...).
|
|
211
|
+
* contracts`). It reads no candles: where prints are judged per order, each root contracts rule's row for the root
|
|
212
|
+
* (its `other` for a root the table lacks) and each multiple of one (`market`); where they are judged per fill, the
|
|
213
|
+
* package's own defaults (`package`, `per-fill`), so a record never keeps a per-order default once the plane is off.
|
|
214
|
+
*/
|
|
215
|
+
export declare function wrunMarketContractsVerdict(rules: Readonly<Record<string, WrunMarketScaledRule>>, facts: WrunMarketContractsFacts): WrunMarketSizeVerdict;
|
|
177
216
|
/** What one unit of a market's STORED trade amount is worth in US dollars (wrun-chart-market-facts.util
|
|
178
217
|
* `wrunMarketStoredUnitDollars`, read by the head: the large-print writer's own price of one, off the market's newest
|
|
179
218
|
* TRADE_LARGE print), or why that cannot be proven (`transient` while a read can still answer it). */
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { WRUN_MARKET_SIZE_UNITS } from './wrun-market-facts.util.js';
|
|
2
|
+
/**
|
|
3
|
+
* Big Trades' Min size in contracts on a CME Group market whose prints are judged per aggressor order, by product root:
|
|
4
|
+
* 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
|
|
5
|
+
* 652 orders an hour and ES 5,827). A root the table lacks reads `WRUN_CME_ROOT_MIN_CONTRACTS_OTHER`.
|
|
6
|
+
*/
|
|
7
|
+
export const WRUN_CME_ROOT_MIN_CONTRACTS = Object.freeze({
|
|
8
|
+
NQ: 50,
|
|
9
|
+
ES: 200,
|
|
10
|
+
MNQ: 200,
|
|
11
|
+
MES: 200,
|
|
12
|
+
RTY: 50,
|
|
13
|
+
YM: 20,
|
|
14
|
+
CL: 50,
|
|
15
|
+
GC: 50,
|
|
16
|
+
'6E': 50,
|
|
17
|
+
ZN: 500,
|
|
18
|
+
});
|
|
19
|
+
/** The contracts floor of a CME root the table does not list: the package's 10. */
|
|
20
|
+
export const WRUN_CME_ROOT_MIN_CONTRACTS_OTHER = 10;
|
|
2
21
|
/**
|
|
3
22
|
* The params whose default follows the market, by package name, then param name (the sheet's own names). A built-in
|
|
4
23
|
* twin whose sheet binds a param to a trade floor lists it here or in the guard's exemptions with a reason
|
|
@@ -17,8 +36,15 @@ export const WRUN_MARKET_SCALED_PARAMS = Object.freeze({
|
|
|
17
36
|
// 0.7.0: Size shown as reads Contracts or coins (1) on a chart that counts contracts, the package's Dollars (0)
|
|
18
37
|
// elsewhere.
|
|
19
38
|
size_shown_as: Object.freeze({ kind: 'contracts-option', option: 1 }),
|
|
20
|
-
// 0.8.0
|
|
21
|
-
//
|
|
39
|
+
// 0.8.0, the contracts rule: Min size by the CME product root where prints are judged per order, the package's
|
|
40
|
+
// flat 10 where they are judged per fill.
|
|
41
|
+
min_contracts: Object.freeze({
|
|
42
|
+
kind: 'cme-root-contracts',
|
|
43
|
+
table: WRUN_CME_ROOT_MIN_CONTRACTS,
|
|
44
|
+
other: WRUN_CME_ROOT_MIN_CONTRACTS_OTHER,
|
|
45
|
+
}),
|
|
46
|
+
// 0.8.0: the whale threshold in contracts, ten times Min size's (the package's 100 per fill).
|
|
47
|
+
whale_contracts: Object.freeze({ kind: 'times', param: 'min_contracts', factor: 10 }),
|
|
22
48
|
}),
|
|
23
49
|
});
|
|
24
50
|
/** The scaled params of a package, or undefined for a package that scales none. */
|
|
@@ -39,20 +65,30 @@ export function wrunMarketScaledRulesOfSheet(rules, paramNames) {
|
|
|
39
65
|
kept[name] = rule;
|
|
40
66
|
return Object.keys(kept).length > 0 ? kept : undefined;
|
|
41
67
|
}
|
|
42
|
-
/**
|
|
43
|
-
|
|
68
|
+
/** Whether a rule belongs to the contracts family: a root contracts rule, or a multiple of one of `rules`. */
|
|
69
|
+
function isWrunContractsRule(rule, rules) {
|
|
70
|
+
if (rule.kind === 'cme-root-contracts')
|
|
71
|
+
return true;
|
|
72
|
+
return rule.kind === 'times' && rules[rule.param]?.kind === 'cme-root-contracts';
|
|
73
|
+
}
|
|
74
|
+
/** The scaled rules split into their families (`WrunMarketScaledFamilies`): every option rule to `options`, every
|
|
75
|
+
* contracts rule and multiple of one to `contracts`, every other rule to `volume`. */
|
|
44
76
|
export function wrunMarketScaledFamilies(rules) {
|
|
45
77
|
const volume = {};
|
|
46
78
|
const options = {};
|
|
79
|
+
const contracts = {};
|
|
47
80
|
for (const [name, rule] of Object.entries(rules)) {
|
|
48
81
|
if (rule.kind === 'contracts-option')
|
|
49
82
|
options[name] = rule;
|
|
83
|
+
else if (isWrunContractsRule(rule, rules))
|
|
84
|
+
contracts[name] = rule;
|
|
50
85
|
else
|
|
51
86
|
volume[name] = rule;
|
|
52
87
|
}
|
|
53
88
|
return {
|
|
54
89
|
...(Object.keys(volume).length > 0 ? { volume } : {}),
|
|
55
90
|
...(Object.keys(options).length > 0 ? { options } : {}),
|
|
91
|
+
...(Object.keys(contracts).length > 0 ? { contracts } : {}),
|
|
56
92
|
};
|
|
57
93
|
}
|
|
58
94
|
const HOUR_MS = 3_600_000;
|
|
@@ -145,7 +181,8 @@ export function wrunMarketScaledDefaults(rules, dailyVolume, dailyDollarVolume)
|
|
|
145
181
|
defaults[name] = value;
|
|
146
182
|
}
|
|
147
183
|
for (const [name, rule] of Object.entries(rules)) {
|
|
148
|
-
|
|
184
|
+
// A multiple of a contracts rule is the contracts family's (`wrunMarketContractsVerdict`), never a volume default.
|
|
185
|
+
if (rule.kind !== 'times' || isWrunContractsRule(rule, rules))
|
|
149
186
|
continue;
|
|
150
187
|
const base = defaults[rule.param];
|
|
151
188
|
if (base === undefined)
|
|
@@ -233,6 +270,29 @@ export function wrunMarketOptionVerdict(rules, facts) {
|
|
|
233
270
|
}
|
|
234
271
|
return { kind: 'market', defaults };
|
|
235
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* The verdict of a market's facts on a package's CONTRACTS rules (the head passes `wrunMarketScaledFamilies(...).
|
|
275
|
+
* contracts`). It reads no candles: where prints are judged per order, each root contracts rule's row for the root
|
|
276
|
+
* (its `other` for a root the table lacks) and each multiple of one (`market`); where they are judged per fill, the
|
|
277
|
+
* package's own defaults (`package`, `per-fill`), so a record never keeps a per-order default once the plane is off.
|
|
278
|
+
*/
|
|
279
|
+
export function wrunMarketContractsVerdict(rules, facts) {
|
|
280
|
+
if (!facts.perOrder)
|
|
281
|
+
return { kind: 'package', reason: 'per-fill' };
|
|
282
|
+
const defaults = {};
|
|
283
|
+
for (const [name, rule] of Object.entries(rules)) {
|
|
284
|
+
if (rule.kind !== 'cme-root-contracts')
|
|
285
|
+
continue;
|
|
286
|
+
const root = facts.root;
|
|
287
|
+
defaults[name] = root !== undefined && Object.hasOwn(rule.table, root) ? rule.table[root] : rule.other;
|
|
288
|
+
}
|
|
289
|
+
for (const [name, rule] of Object.entries(rules)) {
|
|
290
|
+
if (rule.kind !== 'times' || defaults[rule.param] === undefined)
|
|
291
|
+
continue;
|
|
292
|
+
defaults[name] = Number((defaults[rule.param] * rule.factor).toPrecision(12));
|
|
293
|
+
}
|
|
294
|
+
return { kind: 'market', defaults };
|
|
295
|
+
}
|
|
236
296
|
/** The rules of one family: its volume rules and the multiples of them. */
|
|
237
297
|
function wrunRulesOfFamily(rules, family) {
|
|
238
298
|
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,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;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FE-FOLD-CAP (OPTLOAD wave 3, an amendment to the download budget's unit R2; UW-PARITY/reports/OPTLOAD-W3/
|
|
3
|
+
* strike-family-design.md "Unit FE-FOLD-CAP"): what an `option_strike_flow` read is forecast to download where the
|
|
4
|
+
* worker folds it from the chain's contract rows in the browser, which no declaration says (the kit charges the grouped
|
|
5
|
+
* read it declares: Premium by Expiry on ES1! 1h, 2.30 MB declared, 12.90 MB measured). The run's download plan prices
|
|
6
|
+
* the read at the fold before any fetch (wrun-download-plan.util, the lane's `download.forecastBytes`), so a fold puts
|
|
7
|
+
* the run in budgeted mode and its asks name the rows their share buys (`foldBudgetRows`).
|
|
8
|
+
*
|
|
9
|
+
* Loaded by the lane on a run with the download budget's flag on, never at boot (the strike flow util rides the boot
|
|
10
|
+
* path through its K control; this module does not).
|
|
11
|
+
*/
|
|
12
|
+
import { KSCRIPT_SOURCE_CELL_BYTES } from '../chart/kscript-source-answer-budget.leaf.js';
|
|
13
|
+
import { optionTodayStartMsByClock, optionTradeDayByClock } from '../options/option-trade-date.util.js';
|
|
14
|
+
import { wrunLaneChainPlaneOf, } from './sources/wrun-row-lane.types.js';
|
|
15
|
+
import { WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD, WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH, } from './wrun-option-contract-flow.util.js';
|
|
16
|
+
import { WRUN_OPTION_STRIKE_FLOW_SCOPE, WRUN_OPTION_STRIKE_FLOW_TIERS, wrunOptionFlowClockOf, wrunOptionFlowGroupedRead, wrunOptionStrikeFlowAcquisitionOf, wrunOptionStrikeFlowFoldPlan, wrunOptionStrikeFlowKnobsOf, wrunOptionStrikeFlowSessionTierOf, } from './wrun-option-strike-flow.util.js';
|
|
17
|
+
import { wrunHostBarSpanOf } from './wrun-tier-grid.util.js';
|
|
18
|
+
const MINUTE_MS = 60_000;
|
|
19
|
+
/** The OPRA plane's delayed route, as the forecast reads it: the gate serves a read up to its now minus this
|
|
20
|
+
* (governed-route.util `servedDelaySecondsForAccess`, 15 minutes on OPRA), so a grouped read is cut at its grid's last
|
|
21
|
+
* boundary behind it and the rest is folded (k-option-strike-flow.worker.ts, the delayed tail). */
|
|
22
|
+
export const WRUN_OPTION_FLOW_DELAYED_FORECAST_MS = 15 * MINUTE_MS;
|
|
23
|
+
/**
|
|
24
|
+
* The contract rows the worker is forecast to fold in the browser for one strike flow read over a window's host bars,
|
|
25
|
+
* before any fetch, by the worker's own choice (k-option-strike-flow.worker `streamHistoricalData`): every bar on a
|
|
26
|
+
* crypto chain (the grouped scopes sum every book of a coin), every bar of a grouping the gateway cannot draw on the
|
|
27
|
+
* chain's venue (`wrunOptionFlowGroupedRead` `host`, the worker's call: a Globex lattice bar off the UTC floor, a
|
|
28
|
+
* 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
|
|
29
|
+
* whole newest session, a bar grouping's bars ending past it). Projected by the fold plan's own rule (`projectedRows`,
|
|
30
|
+
* under the source answer budget one fold read keeps today). 0 when the data plane groups the whole window. Under
|
|
31
|
+
* `history` "today" only today's bars count (the acquisition's `todayFromMs`, else the newest bar's trade date on the
|
|
32
|
+
* chain's clock).
|
|
33
|
+
*/
|
|
34
|
+
export function wrunOptionStrikeFlowFoldForecastRows(args) {
|
|
35
|
+
const { barMs, barGrid, nowMs } = args;
|
|
36
|
+
const acquisition = wrunOptionStrikeFlowAcquisitionOf(args.acquisition);
|
|
37
|
+
if (args.barOpens.length === 0 || !(barMs > 0) || acquisition.exchange === '')
|
|
38
|
+
return 0;
|
|
39
|
+
const clock = wrunOptionFlowClockOf(acquisition);
|
|
40
|
+
const newest = args.barOpens[args.barOpens.length - 1];
|
|
41
|
+
const todayFromMs = acquisition.history !== 'today'
|
|
42
|
+
? undefined
|
|
43
|
+
: (acquisition.todayFromMs ?? optionTodayStartMsByClock(clock, { openMs: newest, endMs: newest + barMs }));
|
|
44
|
+
const dayOf = (open) => optionTradeDayByClock(clock, open + Math.floor(barMs / 2));
|
|
45
|
+
const spanOf = (open) => wrunHostBarSpanOf(open, barMs, barGrid ?? null);
|
|
46
|
+
const bars = args.barOpens.filter((open) => todayFromMs === undefined || spanOf(open).toMs > todayFromMs);
|
|
47
|
+
if (bars.length === 0)
|
|
48
|
+
return 0;
|
|
49
|
+
// The tier the lane asks a bar at (its coarsest that fits), the window on its grid; then the worker's own choice
|
|
50
|
+
// (k-option-strike-flow.worker): the anchors the chain's venue and the group's scope take, at that tier or the
|
|
51
|
+
// coarsest finer one the anchor takes (a CME regular-hours hour groups on CME_RTH from 5 minutes).
|
|
52
|
+
const tiers = WRUN_OPTION_STRIKE_FLOW_TIERS[acquisition.group];
|
|
53
|
+
const tier = [...tiers].reverse().find((candidate) => barMs % candidate.ms === 0) ?? tiers[0];
|
|
54
|
+
const fromMs = spanOf(bars[0]).fromMs;
|
|
55
|
+
const toMs = spanOf(bars[bars.length - 1]).toMs;
|
|
56
|
+
const session = acquisition.span === 'session';
|
|
57
|
+
const { grouping } = wrunOptionFlowGroupedRead({
|
|
58
|
+
barMs,
|
|
59
|
+
barGrid,
|
|
60
|
+
fromMs: fromMs - (fromMs % tier.ms),
|
|
61
|
+
toMs: toMs % tier.ms === 0 ? toMs : toMs - (toMs % tier.ms) + tier.ms,
|
|
62
|
+
session,
|
|
63
|
+
clock,
|
|
64
|
+
exchange: acquisition.exchange,
|
|
65
|
+
read: WRUN_OPTION_STRIKE_FLOW_SCOPE[acquisition.group].read,
|
|
66
|
+
askTier: tier,
|
|
67
|
+
tiers,
|
|
68
|
+
sessionTier: wrunOptionStrikeFlowSessionTierOf(acquisition.group),
|
|
69
|
+
nowMs,
|
|
70
|
+
});
|
|
71
|
+
let folded;
|
|
72
|
+
if (wrunLaneChainPlaneOf(acquisition.exchange) === 'plain' || grouping.kind === 'host') {
|
|
73
|
+
folded = bars;
|
|
74
|
+
}
|
|
75
|
+
else if (args.acquisition.servedTier !== 'delayed') {
|
|
76
|
+
folded = [];
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const boundMs = nowMs - WRUN_OPTION_FLOW_DELAYED_FORECAST_MS;
|
|
80
|
+
// A session straddling the bound is folded whole; a bar grouping folds the bars ending past it.
|
|
81
|
+
const newestDay = dayOf(newest);
|
|
82
|
+
folded = session
|
|
83
|
+
? spanOf(newest).toMs > boundMs
|
|
84
|
+
? bars.filter((open) => dayOf(open) === newestDay)
|
|
85
|
+
: []
|
|
86
|
+
: bars.filter((open) => spanOf(open).toMs > boundMs);
|
|
87
|
+
}
|
|
88
|
+
if (folded.length === 0)
|
|
89
|
+
return 0;
|
|
90
|
+
return wrunOptionStrikeFlowFoldPlan({
|
|
91
|
+
barOpens: folded,
|
|
92
|
+
newerBarOpens: [],
|
|
93
|
+
barMs,
|
|
94
|
+
barGrid,
|
|
95
|
+
nowMs,
|
|
96
|
+
acquisition: args.acquisition,
|
|
97
|
+
}).projectedRows;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The lane's `download.forecastBytes` (row-lanes/option_strike_flow.ts): a read of one input (its declaration, its
|
|
101
|
+
* setting-bound knobs read) on the chart's chain, priced at the forecast fold's contract rows of 21 values; undefined
|
|
102
|
+
* when the data plane groups the window, so the kit's projection of the declared read holds. A knob its rules refuse
|
|
103
|
+
* throws by name (the run's plan prices nothing for it; the lane's plan refuses the input).
|
|
104
|
+
*/
|
|
105
|
+
export function wrunOptionStrikeFlowForecastBytes(source, ctx, chart) {
|
|
106
|
+
const rows = wrunOptionStrikeFlowFoldForecastRows({
|
|
107
|
+
acquisition: {
|
|
108
|
+
...wrunOptionStrikeFlowKnobsOf(source, ctx),
|
|
109
|
+
coin: chart.coin,
|
|
110
|
+
[WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD]: chart.chainExchange,
|
|
111
|
+
...(chart.servedTier !== undefined ? { servedTier: chart.servedTier } : {}),
|
|
112
|
+
},
|
|
113
|
+
barOpens: chart.barOpens,
|
|
114
|
+
barMs: chart.intervalMs,
|
|
115
|
+
barGrid: chart.barGrid ?? undefined,
|
|
116
|
+
nowMs: chart.nowMs,
|
|
117
|
+
});
|
|
118
|
+
return rows > 0 ? rows * WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH * KSCRIPT_SOURCE_CELL_BYTES : undefined;
|
|
119
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { WrunBackendTier } from './wrun-tier-grid.util.js';
|
|
2
2
|
/** The class, its lane key and its K type word (om `WRUN_OPTION_FETCH_TYPES.option_strike_flow`). */
|
|
3
3
|
export declare const WRUN_OPTION_STRIKE_FLOW_CLASS = "option_strike_flow";
|
|
4
|
+
/** The ask field a budgeted run names a browser fold's contract-row cap in (FE-FOLD-CAP, OPTLOAD W3 under R2's flag;
|
|
5
|
+
* wrun-row-lanes.util `download.fold`, the worker's `wrunOptionStrikeFlowFoldPlan` `budgetRows`). */
|
|
6
|
+
export declare const WRUN_OPTION_STRIKE_FLOW_FOLD_BUDGET_FIELD = "foldBudgetRows";
|
|
4
7
|
/** f64s per tuple, the `present` mask included (om `WRUN_OPTION_TUPLE_WIDTHS.option_strike_flow`). */
|
|
5
8
|
export declare const WRUN_OPTION_STRIKE_FLOW_WIDTH = 15;
|
|
6
9
|
/** The tuple's columns (om `WRUN_OPTION_CELL_COLUMNS.option_strike_flow`). */
|
|
@@ -69,19 +72,33 @@ export declare function wrunOptionStrikeFlowHorizon(extras: Readonly<Record<stri
|
|
|
69
72
|
servedFromMs: number;
|
|
70
73
|
completeFromMs: number;
|
|
71
74
|
} | undefined;
|
|
72
|
-
/** The tuples one SPY bar of a group holds (one 30-minute session of 13 bars measured 2026-10-19): STRIKE 357
|
|
73
|
-
* the 0DTE split), EXPIRY 75, the per-(expiry, strike) rows 2,326; 33 traded expiries
|
|
75
|
+
/** The tuples one SPY bar of a group holds (one 30-minute session of 13 bars measured 2026-10-19, `barMs`): STRIKE 357
|
|
76
|
+
* (471 with the 0DTE split), EXPIRY 75, the per-(expiry, strike) rows 2,326; 33 traded expiries; every chain. */
|
|
74
77
|
export declare const WRUN_OPTION_STRIKE_FLOW_BAR_TUPLES: Readonly<{
|
|
75
78
|
strike: 357;
|
|
76
79
|
strikeSplit: 471;
|
|
77
80
|
expiry: 75;
|
|
78
81
|
expiryStrike: 2326;
|
|
79
82
|
expiries: 33;
|
|
83
|
+
barMs: number;
|
|
80
84
|
}>;
|
|
81
|
-
/** The
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
+
/** The share of a measured bar's tuples a bar `barMs` wide holds, 1 from 30 minutes up: a bar's distinct contracts grow
|
|
86
|
+
* slower than its width, as the contract rows one SPY bucket holds at the 1m, 5m and 1h tiers say
|
|
87
|
+
* (`WRUN_OPTION_CONTRACT_FLOW_SESSION_ROWS`: 647, 1,395 and 4,148), read on the log-log line between neighbouring
|
|
88
|
+
* tiers: a 5-minute bar 0.46, a 1-minute bar 0.21, where a straight sixth and thirtieth under-projected them. */
|
|
89
|
+
export declare function wrunOptionStrikeFlowBarShare(barMs: number): number;
|
|
90
|
+
/** The tuples a bar `barMs` wide of one acquisition is projected to hold, from its knobs over SPY's measured bars at
|
|
91
|
+
* its share of them (`wrunOptionStrikeFlowBarShare`). One width for all kept a 5-minute Strike Footprint to its newest
|
|
92
|
+
* 30 bars. The row budget's proxy, which the host raises to what the lane's reads measured. */
|
|
93
|
+
export declare function wrunOptionStrikeFlowTuplesPerBar(acquisition: Readonly<Record<string, unknown>>, barMs?: number): number;
|
|
94
|
+
/** The facets' `maxCells`: the package's most `max_cells` of the class (tuples, `WrunRowLanePlanFacts.laneMaxCells`)
|
|
95
|
+
* where it is under the knobs' projection. A bar past it refuses the run, so no bar is projected past it. */
|
|
96
|
+
export declare function wrunOptionStrikeFlowMaxCellsField(acquisition: Readonly<Record<string, unknown>>, laneMaxCells: unknown): {
|
|
97
|
+
maxCells?: number;
|
|
98
|
+
};
|
|
99
|
+
/** The rows one host bar is projected to read (the lane's row budget; wrun-row-lanes.util `wrunRowLaneProjectedBarRows`
|
|
100
|
+
* raises it to what its reads measured): its projected tuples at its width, at most the acquisition's `maxCells`, none
|
|
101
|
+
* for a bar before today's first instant as the acquisition names it under `history` "today" (it reads nothing;
|
|
85
102
|
* wrun-option-contract-flow.util `wrunOptionFlowBarBeforeToday`, never dated off `nowMs`). */
|
|
86
103
|
export declare function wrunOptionStrikeFlowBarRows(bar: {
|
|
87
104
|
openMs: number;
|