@orangecharts/wrun-chart-host 0.8.0 → 0.9.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 -1
- package/dist/constants/feature-flags.constants.d.ts +4 -0
- package/dist/constants/feature-flags.constants.js +27 -0
- package/dist/constants/marketCapabilities.constants.d.ts +14 -9
- package/dist/constants/marketCapabilities.constants.js +36 -13
- package/dist/constants/opra-compliance.constants.d.ts +14 -0
- package/dist/constants/opra-compliance.constants.js +14 -0
- package/dist/constants/option-venues.constants.d.ts +11 -6
- package/dist/constants/option-venues.constants.js +5 -2
- package/dist/host-env.d.ts +10 -4
- package/dist/host-ports.types.d.ts +39 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
- package/dist/interfaces/opra-realtime.interface.js +10 -10
- package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +53 -10
- package/dist/kscript-data/controls/live-trades-merge.util.js +81 -16
- package/dist/market-data/billing.interface.d.ts +138 -17
- package/dist/market-data/billing.interface.js +25 -8
- package/dist/market-data/venues/index.d.ts +3 -3
- package/dist/market-data/venues/opra.contract.copy.json +5 -3
- package/dist/market-data/venues/opra.d.ts +3 -3
- package/dist/market-data/venues/opra.js +5 -4
- package/dist/replay/replayLadder.js +3 -1
- package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
- package/dist/utility/chart/crypto-index.leaf.js +2 -2
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +5 -2
- package/dist/utility/chart/index-mode.util.js +23 -13
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
- package/dist/utility/chart/kscript-venue-policy.util.js +30 -24
- package/dist/utility/chart/marketKind.util.d.ts +12 -10
- package/dist/utility/chart/marketKind.util.js +17 -7
- package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
- package/dist/utility/chart/om-panel-push-style.util.js +17 -15
- package/dist/utility/chart/om-panel.util.js +6 -6
- package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
- package/dist/utility/chart/profile-block-size.util.js +7 -0
- package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
- package/dist/utility/chart/quote-perp.leaf.js +20 -0
- package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
- package/dist/utility/chart/wrun-run-result.util.js +4 -1
- package/dist/utility/common/transformations.util.d.ts +7 -0
- package/dist/utility/common/transformations.util.js +11 -0
- package/dist/utility/options/option-venue.util.d.ts +3 -3
- package/dist/utility/options/option-venue.util.js +3 -3
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +11 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +63 -9
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +8 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +5 -2
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +11 -5
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +31 -10
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +33 -1
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +95 -6
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +55 -18
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +146 -40
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
- package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
- package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
- package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
- package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
- package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
- package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
- package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
- package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
- package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
- package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
- package/dist/utility/wrun/wrun-frames.js +5 -5
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
- package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
- package/dist/utility/wrun/wrun-live-tick.util.js +91 -38
- package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
- package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +166 -48
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +216 -33
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +314 -56
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
- package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +3 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +55 -0
- package/dist/utility/wrun/wrun-option-views.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-option-views.util.js +151 -28
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
- package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
- package/dist/utility/wrun/wrun-overlay-run.util.js +416 -171
- package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
- package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
- package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-pack.util.js +20 -9
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +27 -15
- package/dist/utility/wrun/wrun-panel-style.util.js +42 -20
- package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
- package/dist/utility/wrun/wrun-param-map.util.js +8 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
- package/dist/utility/wrun/wrun-param-values.util.js +2 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
- package/dist/utility/wrun/wrun-refusal.util.js +10 -1
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
- package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
- package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
- package/dist/workers/utils/volume-profile.worker.util.js +5 -2
- package/dist/workers/wrun/wrun-abi-host.js +3 -2
- package/package.json +11 -11
|
@@ -9,12 +9,17 @@
|
|
|
9
9
|
* params ride the input as flat knobs (`WrunOptionViewSpec` `params`: the knob, then the wire name the gateway
|
|
10
10
|
* reads), each a finite number once the paint seam ran (`wrunSheetWithSettings` writes a `"@<param>"` handle's
|
|
11
11
|
* current value, the `ticks_per_bar` rule). The views' `expiries` param rides `view_expiries`: the class keeps its own
|
|
12
|
-
* `expiries` word. Every refusal is om's one knob name (`wrun_option_knob_invalid`), but for a
|
|
12
|
+
* `expiries` word. Every refusal is om's one knob name (`wrun_option_knob_invalid`), but for a view this host does
|
|
13
|
+
* not read yet (below).
|
|
13
14
|
* - Answers. A projection (`answer: 'tuples'`) is a subsequence of B in B's order with B's values, so a package whose
|
|
14
15
|
* code is unchanged reads it as it reads B: it reaches the package as the class's own block. A fold
|
|
15
|
-
* (`answer: 'fold'`: totals, boards, the curve) answers rows of another layout,
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* (`answer: 'fold'`: totals, boards, the curve) answers rows of another layout, so an input naming one reads a view
|
|
17
|
+
* block (`wrunOptionInputTupleWidth`: its projections' tuples as `[0, ...tuple]`, then each fold's rows as
|
|
18
|
+
* `[layout, ...cells]`, every row padded to the class's `WRUN_OPTION_VIEW_ROW_WIDTHS`). This host reads
|
|
19
|
+
* option_contract_state's folds (Top Contracts' totals); a view it does not read yet (`wrunOptionViewUnread`: an
|
|
20
|
+
* options_chain fold, whose twin reads class tuples alone, and a state view that follows the chart's close, which
|
|
21
|
+
* the state lane does not send) refuses by name before any read (`wrun_option_view_unread`), never an empty or
|
|
22
|
+
* misread block.
|
|
18
23
|
* - Hinted views (`hinted`: the window board, the smile and surface reads, and the folds that read the close where a
|
|
19
24
|
* contract carries no underlying: exposure, strike_table, gex_curve, oi_board) cover every close within
|
|
20
25
|
* `WRUN_OPTION_VIEW_MARGIN_PCT` of the hint the ask carries, the chart's close at ask time; a run whose close left
|
|
@@ -33,8 +38,12 @@
|
|
|
33
38
|
* read), `<prefix>SpotMarginPct` for a hinted set, and on `options_chain` the gateway's scope inputs
|
|
34
39
|
* (`chainNearestExpiries`, `chainMaxContracts`: the gateway sizes B on its page, so a view ask reads no expiry
|
|
35
40
|
* directory). The worker twins read them back (`wrunOptionViewsOf`, `wrunOptionViewAskFieldsOf`).
|
|
36
|
-
* - A gateway without the views answers `knobsVersion` 0
|
|
37
|
-
*
|
|
41
|
+
* - A gateway without the views answers `knobsVersion` 0. On a crypto chain (the plain reader serves none) the worker
|
|
42
|
+
* projects the views over the block today's path builds, in the very rows a served answer reads as
|
|
43
|
+
* (option-views-local.worker.util, the SDK's reference); a governed gateway without them is refused by name
|
|
44
|
+
* (`WRUN_OPTION_VIEWS_UNSERVED_CODE`). An input that declares no views reads its block B whole through its class's
|
|
45
|
+
* implicit view (`WRUN_OPTIONS_CHAIN_IMPLICIT_VIEW`, `WRUN_OPTION_STATE_IMPLICIT_VIEW`): B's rows from the gateway,
|
|
46
|
+
* or today's path for an answer that is not B's rows; a crypto chain keeps its plain reader.
|
|
38
47
|
*
|
|
39
48
|
* Worker-safe: the worker twins parse the same words. The one main-thread door (`wrunHeldOpraPlaneChain`) touches the
|
|
40
49
|
* host env only when called.
|
|
@@ -122,7 +131,7 @@ export const WRUN_OPTION_VIEWS = Object.freeze({
|
|
|
122
131
|
export const WRUN_OPTION_VIEW_MARGIN_PCT = 0.5;
|
|
123
132
|
/** The lane refusal code (wrun-lane-refusal.leaf) of a view ask the gateway answered without the views. */
|
|
124
133
|
export const WRUN_OPTION_VIEWS_UNSERVED_CODE = 'option-views-unserved';
|
|
125
|
-
/** The plan's refusal of a view
|
|
134
|
+
/** The plan's refusal of a view this host does not read yet (`wrunOptionViewUnread`). */
|
|
126
135
|
export const WRUN_OPTION_VIEW_UNREAD_CODE = 'wrun_option_view_unread';
|
|
127
136
|
/** The plan's refusal of one chain lane whose inputs read it through views and whole at once (one ask serves both
|
|
128
137
|
* never: B and a view of B are two answers). */
|
|
@@ -137,6 +146,29 @@ export function wrunOptionViewSpec(word) {
|
|
|
137
146
|
? WRUN_OPTION_VIEWS[word]
|
|
138
147
|
: undefined;
|
|
139
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* What this host reads of each class's views (web: the `k-options-chain` and `k-option-contract-state` workers and
|
|
151
|
+
* their lanes): `folds`, whether the twin reads a fold's rows (option_contract_state's twin reads the answer's fold
|
|
152
|
+
* entries as the view block, `optionsChainViewRows`; options_chain's reads class tuples alone); `hint`, whether the
|
|
153
|
+
* lane sends a hinted view the chart's close (`chainSpotHint`; the state lane sends none, and the gateway and the kit
|
|
154
|
+
* refuse a hinted view without it).
|
|
155
|
+
*/
|
|
156
|
+
const WRUN_OPTION_VIEW_HOST_READS = Object.freeze({
|
|
157
|
+
options_chain: Object.freeze({ folds: false, hint: true }),
|
|
158
|
+
option_contract_state: Object.freeze({ folds: true, hint: false }),
|
|
159
|
+
});
|
|
160
|
+
/** Why this host does not read a view yet, in a refusal's words, or undefined when it reads it (every projection,
|
|
161
|
+
* option_contract_state's folds but `oi_board`, which follows the chart's close). */
|
|
162
|
+
export function wrunOptionViewUnread(spec) {
|
|
163
|
+
const reads = WRUN_OPTION_VIEW_HOST_READS[spec.cls];
|
|
164
|
+
if (spec.answer === 'fold' && !reads.folds) {
|
|
165
|
+
return `its answer is a fold, whose rows no ${spec.cls} reader of this host takes yet`;
|
|
166
|
+
}
|
|
167
|
+
if (spec.hinted === true && !reads.hint) {
|
|
168
|
+
return `it follows the chart's close, which this host's ${spec.cls} lane does not send yet`;
|
|
169
|
+
}
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
140
172
|
/** The words of one class, spelled for a refusal. */
|
|
141
173
|
function wrunOptionViewWordsOf(cls) {
|
|
142
174
|
const words = Object.keys(WRUN_OPTION_VIEWS)
|
|
@@ -189,8 +221,8 @@ function declaredViewWords(source, ctx) {
|
|
|
189
221
|
/**
|
|
190
222
|
* An input's views, validated (main thread, after the paint seam): undefined when it declares none (today's path),
|
|
191
223
|
* else the views in canonical order (`canonicalViews`). Refuses by name a word that names no view of the input's
|
|
192
|
-
* class, a
|
|
193
|
-
*
|
|
224
|
+
* class, a view this host does not read yet (`wrunOptionViewUnread`), and a param that is no finite number (a
|
|
225
|
+
* `"@<param>"` the sheet declares no param of stays a string here).
|
|
194
226
|
*/
|
|
195
227
|
export function wrunOptionViewsOfSource(input, ctx, cls) {
|
|
196
228
|
// A sheet's input source, read by knob name (its knobs are open: the class's own and each view's params).
|
|
@@ -205,9 +237,10 @@ export function wrunOptionViewsOfSource(input, ctx, cls) {
|
|
|
205
237
|
if (spec === undefined || spec.cls !== cls) {
|
|
206
238
|
return refuseWrunOptionKnob(ctx, knob, word, wrunOptionViewWordsOf(cls));
|
|
207
239
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
240
|
+
const unread = wrunOptionViewUnread(spec);
|
|
241
|
+
if (unread !== undefined) {
|
|
242
|
+
return refuseWrunPollInput(ctx, `reads ${cls} with ${knob} "${String(word)}" (${WRUN_OPTION_VIEW_UNREAD_CODE}): ${unread}; declare another ` +
|
|
243
|
+
'view or read the block whole', wrunAuthorRuleSeed(WRUN_OPTION_VIEW_UNREAD_CODE));
|
|
211
244
|
}
|
|
212
245
|
const params = {};
|
|
213
246
|
for (const [knob, wire] of Object.entries(spec.params)) {
|
|
@@ -248,7 +281,8 @@ export function wrunOptionViewsHinted(views) {
|
|
|
248
281
|
/**
|
|
249
282
|
* A payload's `<prefix>Views` read back (the worker twins, the K controls): the views of `cls`, canonical, or
|
|
250
283
|
* undefined for a payload that names none; null for a text that is not one this module writes (a word of another
|
|
251
|
-
* class, a param that is no finite number, garbage): the ask is refused, never
|
|
284
|
+
* class, a view this host does not read, a param that is no finite number, garbage): the ask is refused, never
|
|
285
|
+
* widened to B whole.
|
|
252
286
|
*/
|
|
253
287
|
export function wrunOptionViewsOf(text, cls) {
|
|
254
288
|
if (text === undefined || text === null)
|
|
@@ -268,7 +302,7 @@ export function wrunOptionViewsOf(text, cls) {
|
|
|
268
302
|
for (const entry of parsed) {
|
|
269
303
|
const record = entry;
|
|
270
304
|
const spec = wrunOptionViewSpec(record?.view);
|
|
271
|
-
if (spec === undefined || spec.cls !== cls || spec
|
|
305
|
+
if (spec === undefined || spec.cls !== cls || wrunOptionViewUnread(spec) !== undefined)
|
|
272
306
|
return null;
|
|
273
307
|
const params = record?.params;
|
|
274
308
|
if (params === null || typeof params !== 'object' || Array.isArray(params))
|
|
@@ -317,16 +351,65 @@ function positiveNumber(value) {
|
|
|
317
351
|
function positiveInteger(value) {
|
|
318
352
|
return typeof value === 'number' && Number.isSafeInteger(value) && value > 0 ? value : undefined;
|
|
319
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* The implicit view (OPTLOAD W3 FE-STATE): an `option_contract_state` input that declares no view reads its block B
|
|
356
|
+
* whole, so its lane asks the gateway for exactly that, the `WHOLE` view of B (pb-common `OPTION_CHAIN_VIEW_WHOLE`,
|
|
357
|
+
* which the gateway answers on either class), in ONE chain summary read: no expiry directory, no page of every strike,
|
|
358
|
+
* no per-contract registry read. The answer is B's own class tuples in B's order, so the input reads it as it read B.
|
|
359
|
+
* The acquisition names it apart from any view text (`stateViews: "whole"`, never a JSON list: the authoring table
|
|
360
|
+
* keeps `whole` an options_chain word, as the kit does, and no author declares it on this class), so it keys an
|
|
361
|
+
* instance of its own (one key per chain, tier, expiries word, window and book), and the worker twin reads it back as
|
|
362
|
+
* the `whole` view, `implicit` (`wrunOptionViewAskFieldsOf`).
|
|
363
|
+
*/
|
|
364
|
+
export const WRUN_OPTION_STATE_IMPLICIT_VIEW = 'whole';
|
|
365
|
+
/** The payload field of the implicit view (`WRUN_OPTION_STATE_IMPLICIT_VIEW`), as the state lane writes it. */
|
|
366
|
+
export function wrunOptionStateImplicitViewFields() {
|
|
367
|
+
return { [`${WRUN_OPTION_VIEW_PREFIX.option_contract_state}Views`]: WRUN_OPTION_STATE_IMPLICIT_VIEW };
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* The implicit view of an `options_chain` input (OPTLOAD W3 FE-CHAIN), FE-STATE's rule on the chain class: a governed
|
|
371
|
+
* chain whose inputs declare no view reads its block B whole, so its lane asks the gateway's `WHOLE` view of B in ONE
|
|
372
|
+
* chain summary read, sized on the gateway's page by the inputs' expiries word and budget (`chainNearestExpiries`, the
|
|
373
|
+
* inputs' `nearest:N` when every input declares one; `chainMaxContracts`, the smallest `max_cells`; the gateway ports the
|
|
374
|
+
* lane scope's arithmetic, `wrunOptionsChainLaneScope`): no expiry directory before the ask and no per-contract registry
|
|
375
|
+
* read after it. The answer is B's 10-value tuples in B's order, so the inputs read it as they read B. The acquisition
|
|
376
|
+
* names it by the bare word (`chainViews: "whole"`), never a JSON list, so it never shares an author's spelling (an
|
|
377
|
+
* explicit `page_view: "whole"` rides as view text and is refused like any view when the gateway does not answer it),
|
|
378
|
+
* and the worker twin reads it back as the `whole` view, `implicit` (`wrunOptionViewAskFieldsOf`).
|
|
379
|
+
*/
|
|
380
|
+
export const WRUN_OPTIONS_CHAIN_IMPLICIT_VIEW = 'whole';
|
|
381
|
+
/** The payload fields of the options_chain implicit view (`WRUN_OPTIONS_CHAIN_IMPLICIT_VIEW`), as the chain lane writes
|
|
382
|
+
* them: the bare word, then the gateway's scope inputs. */
|
|
383
|
+
export function wrunOptionsChainImplicitViewFields(scope) {
|
|
384
|
+
return {
|
|
385
|
+
[`${WRUN_OPTION_VIEW_PREFIX.options_chain}Views`]: WRUN_OPTIONS_CHAIN_IMPLICIT_VIEW,
|
|
386
|
+
...(scope.nearestExpiries !== undefined ? { chainNearestExpiries: scope.nearestExpiries } : {}),
|
|
387
|
+
...(scope.maxContracts !== undefined ? { chainMaxContracts: scope.maxContracts } : {}),
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
/** Each class's implicit view word, as its lane writes it. */
|
|
391
|
+
const WRUN_OPTION_IMPLICIT_VIEWS = Object.freeze({
|
|
392
|
+
options_chain: WRUN_OPTIONS_CHAIN_IMPLICIT_VIEW,
|
|
393
|
+
option_contract_state: WRUN_OPTION_STATE_IMPLICIT_VIEW,
|
|
394
|
+
});
|
|
320
395
|
export function wrunOptionViewAskFieldsOf(cls, payload) {
|
|
321
396
|
const prefix = WRUN_OPTION_VIEW_PREFIX[cls];
|
|
397
|
+
const nearestExpiries = cls === 'options_chain' ? positiveInteger(payload.chainNearestExpiries) : undefined;
|
|
398
|
+
const maxContracts = cls === 'options_chain' ? positiveInteger(payload.chainMaxContracts) : undefined;
|
|
399
|
+
if (payload[`${prefix}Views`] === WRUN_OPTION_IMPLICIT_VIEWS[cls]) {
|
|
400
|
+
return {
|
|
401
|
+
views: [{ view: 'whole', params: {} }],
|
|
402
|
+
implicit: true,
|
|
403
|
+
...(nearestExpiries !== undefined ? { nearestExpiries } : {}),
|
|
404
|
+
...(maxContracts !== undefined ? { maxContracts } : {}),
|
|
405
|
+
};
|
|
406
|
+
}
|
|
322
407
|
const views = wrunOptionViewsOf(payload[`${prefix}Views`], cls);
|
|
323
408
|
if (views === undefined || views === null)
|
|
324
409
|
return views;
|
|
325
410
|
const hinted = wrunOptionViewsHinted(views);
|
|
326
411
|
const spotHint = hinted ? positiveNumber(payload[`${prefix}SpotHint`]) : undefined;
|
|
327
412
|
const spotMarginPct = hinted ? positiveNumber(payload[`${prefix}SpotMarginPct`]) : undefined;
|
|
328
|
-
const nearestExpiries = cls === 'options_chain' ? positiveInteger(payload.chainNearestExpiries) : undefined;
|
|
329
|
-
const maxContracts = cls === 'options_chain' ? positiveInteger(payload.chainMaxContracts) : undefined;
|
|
330
413
|
return {
|
|
331
414
|
views,
|
|
332
415
|
...(nearestExpiries !== undefined ? { nearestExpiries } : {}),
|
|
@@ -405,11 +488,19 @@ export const WRUN_OPTION_LANE_KNOBS = Object.freeze({
|
|
|
405
488
|
step_rows: Object.freeze({ kind: 'whole', min: 1, max: 1000, what: 'the strike steps each side kept' }),
|
|
406
489
|
carry: Object.freeze({ kind: 'flag', what: "the next bar's drawn strikes kept too", fallback: 0 }),
|
|
407
490
|
levels: Object.freeze({ kind: 'flag', what: 'one levels row per bar', fallback: 0 }),
|
|
491
|
+
curve: Object.freeze({
|
|
492
|
+
kind: 'flag',
|
|
493
|
+
what: "one curve row after each levels row: the gamma curve's net GEX at spot, its flip, spot and the rows' clock",
|
|
494
|
+
fallback: 0,
|
|
495
|
+
}),
|
|
408
496
|
}),
|
|
409
497
|
});
|
|
410
498
|
/** What `expiries` takes beside the strike kit fold (the SDK's `WRUN_OPTION_STRIKES_KIT_EXPIRIES_TAKES`, kit 0.91.1):
|
|
411
499
|
* the fold keeps its expiries with its own `nearest`, so any other word beside it is refused at declaration. */
|
|
412
500
|
export const WRUN_OPTION_STRIKES_KIT_EXPIRIES_TAKES = '"all" (or no expiries) beside fold "kit": the fold keeps its expiries with its own `nearest`';
|
|
501
|
+
/** What `curve` takes beside the strike kit fold (the SDK's `WRUN_OPTION_STRIKES_KIT_CURVE_TAKES`, kit 0.96.0): the
|
|
502
|
+
* curve row follows each bar's levels row, so `curve: true` without `levels: true` is refused at declaration. */
|
|
503
|
+
export const WRUN_OPTION_STRIKES_KIT_CURVE_TAKES = "true only beside levels: true (the curve row follows each bar's levels row), or false";
|
|
413
504
|
/** A per-bar class, or undefined for a class that declares no per-bar word. */
|
|
414
505
|
export function wrunOptionLaneClassOf(sourceClass) {
|
|
415
506
|
return sourceClass === 'option_surface' || sourceClass === 'option_strikes' ? sourceClass : undefined;
|
|
@@ -516,6 +607,10 @@ export function wrunOptionLaneAskOf(source) {
|
|
|
516
607
|
if (cls === 'option_strikes' && word === 'kit' && source.expiries !== undefined && source.expiries !== 'all') {
|
|
517
608
|
issues.push({ knob: 'expiries', value: source.expiries, takes: WRUN_OPTION_STRIKES_KIT_EXPIRIES_TAKES });
|
|
518
609
|
}
|
|
610
|
+
// The kit fold's curve row follows each bar's levels row: curve without levels refuses by name (kit 0.96.0).
|
|
611
|
+
if (cls === 'option_strikes' && word === 'kit' && source.curve === true && source.levels !== true) {
|
|
612
|
+
issues.push({ knob: 'curve', value: source.curve, takes: WRUN_OPTION_STRIKES_KIT_CURVE_TAKES });
|
|
613
|
+
}
|
|
519
614
|
if (issues.length > 0 || word === undefined)
|
|
520
615
|
return { issue: issues[0] };
|
|
521
616
|
const params = {};
|
|
@@ -547,11 +642,19 @@ export const WRUN_OPTION_VIEW_ROW_WIDTHS = Object.freeze({
|
|
|
547
642
|
option_contract_state: 16,
|
|
548
643
|
option_strikes: 14,
|
|
549
644
|
});
|
|
550
|
-
/** Column 0 of every strike kit fold row (the SDK's `WRUN_OPTION_STRIKES_KIT_LAYOUTS`)
|
|
551
|
-
|
|
645
|
+
/** Column 0 of every strike kit fold row (the SDK's `WRUN_OPTION_STRIKES_KIT_LAYOUTS`): a strike row, a bar's levels
|
|
646
|
+
* row and, with `curve` (kit 0.96.0), its curve row after the levels row. */
|
|
647
|
+
export const WRUN_OPTION_STRIKES_KIT_LAYOUTS = Object.freeze({ strike: 0, levels: 1, curve: 2 });
|
|
552
648
|
/** The column of a kit levels row that says the bar was refused (its newest minute held more rows than the input's
|
|
553
649
|
* `max_cells`): 1 refused, 0 served. */
|
|
554
650
|
export const WRUN_OPTION_STRIKES_KIT_REFUSED_COLUMN = 13;
|
|
651
|
+
/** Whether page view words name a fold of `cls` (the SDK's `wrunOptionViewWordsFold` on a page view class). */
|
|
652
|
+
function pageViewWordsFold(cls, words) {
|
|
653
|
+
return words.some((word) => {
|
|
654
|
+
const spec = wrunOptionViewSpec(word);
|
|
655
|
+
return spec?.cls === cls && spec.answer === 'fold';
|
|
656
|
+
});
|
|
657
|
+
}
|
|
555
658
|
/**
|
|
556
659
|
* The f64s per tuple one input's block carries (the SDK's `wrunOptionInputTupleWidth`, the one rule every host sizes
|
|
557
660
|
* by): a view block's row width when its words name a fold (a page view fold, the strike kit fold), else the class's
|
|
@@ -566,11 +669,7 @@ export function wrunOptionInputTupleWidth(source, classWidth) {
|
|
|
566
669
|
}
|
|
567
670
|
if (cls !== 'options_chain' && cls !== 'option_contract_state')
|
|
568
671
|
return classWidth;
|
|
569
|
-
|
|
570
|
-
const spec = wrunOptionViewSpec(word);
|
|
571
|
-
return spec?.cls === cls && spec.answer === 'fold';
|
|
572
|
-
});
|
|
573
|
-
return folds ? WRUN_OPTION_VIEW_ROW_WIDTHS[cls] : classWidth;
|
|
672
|
+
return pageViewWordsFold(cls, wrunOptionViewWordsDeclared(source)) ? WRUN_OPTION_VIEW_ROW_WIDTHS[cls] : classWidth;
|
|
574
673
|
}
|
|
575
674
|
/** pb-common `OptionSurfacePick` by word (the gateway decodes numbers, never names). */
|
|
576
675
|
export const WRUN_OPTION_SURFACE_PICK_CODES = Object.freeze({
|
|
@@ -708,12 +807,36 @@ export function wrunOptionKitBarHasRows(tuples) {
|
|
|
708
807
|
tuple[0] === WRUN_OPTION_STRIKES_KIT_LAYOUTS.levels &&
|
|
709
808
|
tuple[WRUN_OPTION_STRIKES_KIT_REFUSED_COLUMN] === 1);
|
|
710
809
|
}
|
|
711
|
-
/**
|
|
712
|
-
*
|
|
810
|
+
/**
|
|
811
|
+
* The f64s per row an instance's rows carry, by its facets (the SDK's `wrunAskTupleWidth`, the ask's side of
|
|
812
|
+
* `wrunOptionInputTupleWidth`: the views ride the instance's key, so every input it serves shares its width): the kit
|
|
813
|
+
* fold's rows on an instance asking it, a view block's rows on one whose views (`<prefix>Views`) name a fold of its
|
|
814
|
+
* class (Top Contracts' totals), else the class's own tuple (`classWidth`).
|
|
815
|
+
*/
|
|
713
816
|
export function wrunOptionLaneTupleWidth(sourceClass, acquisition, classWidth) {
|
|
714
|
-
|
|
715
|
-
? WRUN_OPTION_VIEW_ROW_WIDTHS.option_strikes
|
|
716
|
-
|
|
817
|
+
if (sourceClass === 'option_strikes') {
|
|
818
|
+
return acquisition.strikeKitFold === true ? WRUN_OPTION_VIEW_ROW_WIDTHS.option_strikes : classWidth;
|
|
819
|
+
}
|
|
820
|
+
if (sourceClass !== 'options_chain' && sourceClass !== 'option_contract_state')
|
|
821
|
+
return classWidth;
|
|
822
|
+
const text = acquisition[`${WRUN_OPTION_VIEW_PREFIX[sourceClass]}Views`];
|
|
823
|
+
return pageViewWordsFold(sourceClass, viewWordsOfText(text)) ? WRUN_OPTION_VIEW_ROW_WIDTHS[sourceClass] : classWidth;
|
|
824
|
+
}
|
|
825
|
+
/** The view words a `<prefix>Views` text names, unvalidated (the width reads the words alone, as the SDK's
|
|
826
|
+
* `wrunAskTupleWidth` does); none for a text that is no list of views. */
|
|
827
|
+
function viewWordsOfText(text) {
|
|
828
|
+
if (typeof text !== 'string')
|
|
829
|
+
return [];
|
|
830
|
+
let parsed;
|
|
831
|
+
try {
|
|
832
|
+
parsed = JSON.parse(text);
|
|
833
|
+
}
|
|
834
|
+
catch {
|
|
835
|
+
return [];
|
|
836
|
+
}
|
|
837
|
+
return Array.isArray(parsed)
|
|
838
|
+
? parsed.map((view) => (view !== null && typeof view === 'object' ? view.view : undefined))
|
|
839
|
+
: [];
|
|
717
840
|
}
|
|
718
841
|
/** The rows a strike kit fold bar is projected to hold for the first paint: the levels row, the window's strikes
|
|
719
842
|
* within `step_rows` + 1 finest steps each side of the centre, the finest pair and the two edges. */
|
|
@@ -38,7 +38,8 @@ export declare function wrunLaneGatePlanes(facts: WrunGateLaneFacts): Map<string
|
|
|
38
38
|
* A run's lane thunks with every lane on a plane another screen holds (`heldElsewhere`, read at dispatch) answering
|
|
39
39
|
* at once with the typed stop instead of its read. Thunks are the run's shape: the builtin lanes by name (a function
|
|
40
40
|
* or undefined), and the lists of `[lane id, thunk]` pairs (trades legs, poll lanes, row lanes). Everything else is
|
|
41
|
-
* returned as it is.
|
|
41
|
+
* returned as it is. A lane that is sent gets every argument the lane runner hands its thunk (its abandon signal, so a
|
|
42
|
+
* lane asked in pieces stops at its budget; a row lane's early rows).
|
|
42
43
|
*/
|
|
43
44
|
export declare function wrunGateLatchedThunks<T extends object>(thunks: T, planes: ReadonlyMap<string, WrunRefusalGatePlane>, heldElsewhere: (plane: WrunRefusalGatePlane) => boolean): T;
|
|
44
45
|
/**
|
|
@@ -85,7 +85,8 @@ export function wrunLaneGatePlanes(facts) {
|
|
|
85
85
|
* A run's lane thunks with every lane on a plane another screen holds (`heldElsewhere`, read at dispatch) answering
|
|
86
86
|
* at once with the typed stop instead of its read. Thunks are the run's shape: the builtin lanes by name (a function
|
|
87
87
|
* or undefined), and the lists of `[lane id, thunk]` pairs (trades legs, poll lanes, row lanes). Everything else is
|
|
88
|
-
* returned as it is.
|
|
88
|
+
* returned as it is. A lane that is sent gets every argument the lane runner hands its thunk (its abandon signal, so a
|
|
89
|
+
* lane asked in pieces stops at its budget; a row lane's early rows).
|
|
89
90
|
*/
|
|
90
91
|
export function wrunGateLatchedThunks(thunks, planes, heldElsewhere) {
|
|
91
92
|
if (planes.size === 0)
|
|
@@ -94,7 +95,7 @@ export function wrunGateLatchedThunks(thunks, planes, heldElsewhere) {
|
|
|
94
95
|
const plane = planes.get(lane);
|
|
95
96
|
if (plane === undefined)
|
|
96
97
|
return run;
|
|
97
|
-
return () => heldElsewhere(plane) ? Promise.reject(new WrunLaneStoppedError('session-elsewhere', plane, lane)) : run();
|
|
98
|
+
return (...args) => heldElsewhere(plane) ? Promise.reject(new WrunLaneStoppedError('session-elsewhere', plane, lane)) : run(...args);
|
|
98
99
|
};
|
|
99
100
|
const out = { ...thunks };
|
|
100
101
|
for (const [key, value] of Object.entries(out)) {
|
|
@@ -255,6 +255,9 @@ export interface WrunOverlayLiveContext {
|
|
|
255
255
|
* Absent when the package reads no row-lane class. */
|
|
256
256
|
rowLanes?: WrunRowLaneInstance[];
|
|
257
257
|
rowLaneRows?: Record<string, ReadonlyArray<ReadonlyArray<unknown>>>;
|
|
258
|
+
/** Row lanes drawing their first-paint slice alone, by the slice's first bar (ms), until the fill's run: no prefix
|
|
259
|
+
* page stands on them, no reconcile lands rows before that bar. */
|
|
260
|
+
rowLaneFilling?: Readonly<Record<string, number>>;
|
|
258
261
|
/** The pinned legs this package declares (absent or empty when it pins
|
|
259
262
|
* none) and their candle buffers, keyed by the leg's fetch key: a PERIOD
|
|
260
263
|
* leg holds the CLOSED candles the full run fetched at the leg's
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The boot graph's side of the wrun overlay lifecycle door
|
|
3
|
-
* (`wrun-lifecycle-runtime.util`, behind a dynamic import). Every trigger
|
|
4
|
-
* pre-candle graph calls them through here: the chart store's pause and resume,
|
|
5
|
-
* titan-charts, the history-range, switch and wake triggers in data-fetching, the
|
|
6
|
-
* lift, the legend Retry, the workspace poll and the live feed. The door, its recovery
|
|
7
|
-
* the replay lane, the live tick
|
|
8
|
-
* with the
|
|
2
|
+
* The boot graph's side of the wrun overlay lifecycle door, the live tick lane and the live intake's
|
|
3
|
+
* market rule and gap mark (`wrun-lifecycle-runtime.util`, behind a dynamic import). Every trigger
|
|
4
|
+
* that lives in the pre-candle graph calls them through here: the chart store's pause and resume,
|
|
5
|
+
* the pan wave in titan-charts, the history-range, switch and wake triggers in data-fetching, the
|
|
6
|
+
* pane budget lift, the legend Retry, the workspace poll and the live feed. The door, its recovery
|
|
7
|
+
* ladders, the replay lane, the live tick, the live intake (with the row builder and the source
|
|
8
|
+
* lanes it reads) and the run pass then evaluate with the first wrun loader, not with the chart
|
|
9
|
+
* (docs/features/kscript/wrun/wrun-browser-runtime.md, "Lifecycle door" and "Boot doors").
|
|
9
10
|
*
|
|
10
11
|
* Each entry keeps the door's contract:
|
|
11
12
|
* - The runtime in hand: the call goes straight to it in the same turn, so the answer and every
|
|
@@ -13,19 +14,28 @@
|
|
|
13
14
|
* their static import) before they register a driver, so this is the path for every driver id.
|
|
14
15
|
* - No runtime yet: "not mine" from the same Map reads the door makes (`hasWrunOverlayDriver`,
|
|
15
16
|
* `hasWrunOverlayLiveContext`), with the door's own answer (false, 'no-driver', 'not-wrun',
|
|
16
|
-
* undefined, a resolved promise
|
|
17
|
-
* stay on this path, and nothing wrun loads.
|
|
18
|
-
* - A driver before the runtime (a registrant that skipped the bind): the runtime
|
|
19
|
-
* call runs once, when it lands. The synchronous answer is the one the door gives
|
|
20
|
-
* Map state ('queued' for the heal, whose tail decides; 'gap-marked' or 'healing' for
|
|
21
|
-
* true for the pause; a promise for the reruns and the resume), and a load that fails
|
|
22
|
-
* like the door, which never rejects.
|
|
17
|
+
* undefined, a resolved promise; admitted and no mark for the intake's two) and no import. A
|
|
18
|
+
* flag-off session and every kScript overlay stay on this path, and nothing wrun loads.
|
|
19
|
+
* - A driver or a live session before the runtime (a registrant that skipped the bind): the runtime
|
|
20
|
+
* loads and the call runs once, when it lands. The synchronous answer is the one the door gives
|
|
21
|
+
* for the same Map state ('queued' for the heal, whose tail decides; 'gap-marked' or 'healing' for
|
|
22
|
+
* the wake; true for the pause; a promise for the reruns and the resume), and a load that fails
|
|
23
|
+
* resolves like the door, which never rejects. The market rule only loads it and answers false,
|
|
24
|
+
* never true: the tick arms a drain and heals a held session for a frame before its own market
|
|
25
|
+
* check, so a frame nothing judged is not admitted (the session's next reconcile repairs it). Ring
|
|
26
|
+
* `wrun-lifecycle-runtime-late` names the entry.
|
|
27
|
+
*
|
|
28
|
+
* The intake's two entries take fixed parameters: the market rule runs per live frame per overlay
|
|
29
|
+
* with a session. A live session exists only after the run pass, which imports the intake and comes
|
|
30
|
+
* with a loader (tests/utility/wrun/wrun-overlay-lifecycle.live-context.spec.ts).
|
|
23
31
|
*/
|
|
24
32
|
import type { WrunHealVerdict } from './wrun-lifecycle.contract.js';
|
|
25
33
|
export type WrunLifecycleRuntime = typeof import('./wrun-lifecycle-runtime.util.js');
|
|
26
34
|
/** An entry's parameters, exactly the runtime's: each entry forwards the arguments it received,
|
|
27
35
|
* so the call the door sees is the trigger's own. */
|
|
28
36
|
type EntryArgs<K extends keyof WrunLifecycleRuntime> = Parameters<WrunLifecycleRuntime[K]>;
|
|
37
|
+
type WrunLiveFrameSeries = EntryArgs<'wrunLiveFrameMarketAdmitted'>[1];
|
|
38
|
+
type WrunLiveGapReason = EntryArgs<'markWrunLiveGap'>[1];
|
|
29
39
|
/** Hand the runtime over in the same turn: a loader calls this with its static import of
|
|
30
40
|
* `wrun-lifecycle-runtime.util` before it registers a driver. */
|
|
31
41
|
export declare function bindWrunLifecycleRuntime(loaded: WrunLifecycleRuntime): void;
|
|
@@ -45,6 +55,13 @@ export declare function pauseWrunOverlay(...args: EntryArgs<'pauseWrunOverlay'>)
|
|
|
45
55
|
export declare function resumeWrunOverlay(...args: EntryArgs<'resumeWrunOverlay'>): Promise<void> | undefined;
|
|
46
56
|
/** `scheduleWrunOverlayLiveTick` (the live tick lane): nothing without the overlay's live session. */
|
|
47
57
|
export declare function scheduleWrunOverlayLiveTick(...args: EntryArgs<'scheduleWrunOverlayLiveTick'>): void;
|
|
58
|
+
/** `wrunLiveFrameMarketAdmitted` (the live intake's market rule, before the live feed hands a frame to the tick
|
|
59
|
+
* lane): true without the overlay's live session, as the intake answers. Late, false: the runtime loads, and the
|
|
60
|
+
* frames after it lands are judged by the intake. */
|
|
61
|
+
export declare function wrunLiveFrameMarketAdmitted(indicatorId: string, series: WrunLiveFrameSeries): boolean;
|
|
62
|
+
/** `markWrunLiveGap` (the live intake's reconcile mark, the workspace poll's poll-due): nothing without the overlay's
|
|
63
|
+
* live session, as the intake does. Late, the gap is marked when the runtime lands. */
|
|
64
|
+
export declare function markWrunLiveGap(indicatorId: string, reason: WrunLiveGapReason): void;
|
|
48
65
|
/** `feedWrunRideBookRows` (the live tick lane): false when nothing was queued. */
|
|
49
66
|
export declare function feedWrunRideBookRows(...args: EntryArgs<'feedWrunRideBookRows'>): boolean;
|
|
50
67
|
export {};
|
|
@@ -119,6 +119,28 @@ export function scheduleWrunOverlayLiveTick(...args) {
|
|
|
119
119
|
return;
|
|
120
120
|
void whenLoaded('live-tick', indicatorId, (loaded) => loaded.scheduleWrunOverlayLiveTick(...args));
|
|
121
121
|
}
|
|
122
|
+
/** `wrunLiveFrameMarketAdmitted` (the live intake's market rule, before the live feed hands a frame to the tick
|
|
123
|
+
* lane): true without the overlay's live session, as the intake answers. Late, false: the runtime loads, and the
|
|
124
|
+
* frames after it lands are judged by the intake. */
|
|
125
|
+
export function wrunLiveFrameMarketAdmitted(indicatorId, series) {
|
|
126
|
+
if (runtime)
|
|
127
|
+
return runtime.wrunLiveFrameMarketAdmitted(indicatorId, series);
|
|
128
|
+
if (!hasWrunOverlayLiveContext(indicatorId))
|
|
129
|
+
return true;
|
|
130
|
+
void whenLoaded('market-admitted', indicatorId, () => undefined);
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
/** `markWrunLiveGap` (the live intake's reconcile mark, the workspace poll's poll-due): nothing without the overlay's
|
|
134
|
+
* live session, as the intake does. Late, the gap is marked when the runtime lands. */
|
|
135
|
+
export function markWrunLiveGap(indicatorId, reason) {
|
|
136
|
+
if (runtime) {
|
|
137
|
+
runtime.markWrunLiveGap(indicatorId, reason);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (!hasWrunOverlayLiveContext(indicatorId))
|
|
141
|
+
return;
|
|
142
|
+
void whenLoaded('live-gap', indicatorId, (loaded) => loaded.markWrunLiveGap(indicatorId, reason));
|
|
143
|
+
}
|
|
122
144
|
/** `feedWrunRideBookRows` (the live tick lane): false when nothing was queued. */
|
|
123
145
|
export function feedWrunRideBookRows(...args) {
|
|
124
146
|
if (runtime)
|
|
@@ -88,6 +88,13 @@ export declare function healWrunOverlayIfIdle(chartIndex: number, indicatorId: s
|
|
|
88
88
|
* read is still out (run-schedule/wrun-late-reads.util) the ladder never asks
|
|
89
89
|
* it again: the rung runs the moment the reads answer (their rows adopted),
|
|
90
90
|
* and a rung that comes due first waits for them (their read joined).
|
|
91
|
+
* A lane that drew its first-paint slice alone (cause `filling`: the rest of
|
|
92
|
+
* its window is its late read) rides the same ladder: its rung runs when that
|
|
93
|
+
* read answers, adopts it, and spends no attempt when it adopts fills alone
|
|
94
|
+
* (`runWrunSourceRung`). An arm of fills alone comes from a run that landed
|
|
95
|
+
* every other lane, so it ends the episode it ran in (as such a run retires
|
|
96
|
+
* it) and starts a fresh one: an exhausted or terminal episode never strands a
|
|
97
|
+
* fill.
|
|
91
98
|
*/
|
|
92
99
|
export declare function armWrunSourceRecovery(chartIndex: number, indicatorId: string, degraded: ReadonlyArray<WrunDegradedLane>): void;
|
|
93
100
|
/** Drop one overlay's source ladder: every lane landed ('recovered'), a user
|
|
@@ -521,6 +521,13 @@ const settledRuns = new Map();
|
|
|
521
521
|
* read is still out (run-schedule/wrun-late-reads.util) the ladder never asks
|
|
522
522
|
* it again: the rung runs the moment the reads answer (their rows adopted),
|
|
523
523
|
* and a rung that comes due first waits for them (their read joined).
|
|
524
|
+
* A lane that drew its first-paint slice alone (cause `filling`: the rest of
|
|
525
|
+
* its window is its late read) rides the same ladder: its rung runs when that
|
|
526
|
+
* read answers, adopts it, and spends no attempt when it adopts fills alone
|
|
527
|
+
* (`runWrunSourceRung`). An arm of fills alone comes from a run that landed
|
|
528
|
+
* every other lane, so it ends the episode it ran in (as such a run retires
|
|
529
|
+
* it) and starts a fresh one: an exhausted or terminal episode never strands a
|
|
530
|
+
* fill.
|
|
524
531
|
*/
|
|
525
532
|
export function armWrunSourceRecovery(chartIndex, indicatorId, degraded) {
|
|
526
533
|
if (!hasWrunOverlayDriver(indicatorId))
|
|
@@ -543,9 +550,17 @@ export function armWrunSourceRecovery(chartIndex, indicatorId, degraded) {
|
|
|
543
550
|
waitingOnReads: false,
|
|
544
551
|
unwatch: undefined,
|
|
545
552
|
episode: wrunSourceRecoveryEpisodeOf(chartIndex, indicatorId),
|
|
553
|
+
fillRung: false,
|
|
546
554
|
};
|
|
547
555
|
sourceRecoveries.set(indicatorId, recovery);
|
|
548
556
|
}
|
|
557
|
+
const fillsAlone = retryable.every((lane) => lane.cause === 'filling');
|
|
558
|
+
if (fillsAlone && (recovery.step > 0 || recovery.terminal)) {
|
|
559
|
+
recovery.step = 0;
|
|
560
|
+
recovery.terminal = false;
|
|
561
|
+
recovery.episode = wrunSourceRecoveryEpisodeOf(chartIndex, indicatorId);
|
|
562
|
+
}
|
|
563
|
+
recovery.fillRung = fillsAlone;
|
|
549
564
|
recovery.chartIndex = chartIndex;
|
|
550
565
|
recovery.lanes = new Map(retryable.map((lane) => [lane.lane, lane]));
|
|
551
566
|
recovery.armedAtSettle = settledRuns.get(indicatorId) ?? 0;
|
|
@@ -713,12 +728,21 @@ async function runWrunSourceRung(indicatorId, recovery) {
|
|
|
713
728
|
scheduleWrunSourceRung(indicatorId, recovery, true);
|
|
714
729
|
return;
|
|
715
730
|
}
|
|
716
|
-
|
|
731
|
+
// A rung that adopts planned fills alone (its arm's lanes all drew their first-paint slice alone, and every one's read
|
|
732
|
+
// answered with rows) answers no failure: it spends none of the episode's attempts, so a first paint never shortens
|
|
733
|
+
// the ladder a real degrade gets. The arm's one rung: a rung after it (its run failed, or did not arm again) counts,
|
|
734
|
+
// so the ladder stays bounded.
|
|
735
|
+
const lanes = [...recovery.lanes.keys()];
|
|
736
|
+
const fillOnly = recovery.fillRung && wrunLateReadsAnswered(indicatorId, lanes).length === lanes.length;
|
|
737
|
+
recovery.fillRung = false;
|
|
738
|
+
if (!fillOnly)
|
|
739
|
+
recovery.step += 1;
|
|
717
740
|
ring('wrun-source-recovery-rung', {
|
|
718
741
|
chartIndex: recovery.chartIndex,
|
|
719
742
|
indicatorId,
|
|
720
743
|
attempt: recovery.step,
|
|
721
744
|
lanes: [...recovery.lanes.keys()],
|
|
745
|
+
...(fillOnly ? { fill: true } : {}),
|
|
722
746
|
});
|
|
723
747
|
// The rung answers an attempt of its episode's origin and reason (`episode`), so the record it ends on names the
|
|
724
748
|
// episode that started the ladder.
|
|
@@ -43,6 +43,12 @@ export interface WrunOverlayResultOptions {
|
|
|
43
43
|
* `visible_by` does not list it mounts nothing, nor the stats rows drawn
|
|
44
44
|
* from it (wrunRowVisibleHere). Absent reads 0, the unknown unit. */
|
|
45
45
|
sizeUnit?: number;
|
|
46
|
+
/** The chart market's dollar unit (wrunMarketDollarUnit when proven: the US
|
|
47
|
+
* dollars one price unit times one size unit is worth; NQ 20, 1 on crypto),
|
|
48
|
+
* read beside the size unit by every build (wrun-overlay-run.util
|
|
49
|
+
* `wrunResultMarketUnits`): the batched marks children's `units` caption and
|
|
50
|
+
* hover divide a record's dollar value by it. Absent: none is proven. */
|
|
51
|
+
valuePerUnit?: number;
|
|
46
52
|
/** WRUN-STYLE (g6): the run's celled source rows the price canvases
|
|
47
53
|
* (heatmaps, footprints, TPO letters, time-anchored profiles) draw from. */
|
|
48
54
|
cellRows?: WrunCellRows;
|
|
@@ -107,7 +113,7 @@ export declare const WRUN_RESULT_CAPTURE_LIMIT = 8;
|
|
|
107
113
|
* of trades behind it, more than a rig's process holds (2026-10-17: the TIP corpus run died at 4 GB on the eighth
|
|
108
114
|
* package). A key added to the options must be added here, or the type below fails to compile.
|
|
109
115
|
*/
|
|
110
|
-
export declare const WRUN_OVERLAY_RESULT_OPTION_KEYS: readonly ["metadata", "outputRows", "title", "params", "texts", "position", "axis", "colors", "fills", "candles", "chartNames", "runTimeline", "priceDigits", "sizeUnit", "cellRows", "canvasTailRows", "batchedTailFromTs", "intervalMs", "exchange", "priceTick", "overlayId", "tpoBlockSize", "legendNote"];
|
|
116
|
+
export declare const WRUN_OVERLAY_RESULT_OPTION_KEYS: readonly ["metadata", "outputRows", "title", "params", "texts", "position", "axis", "colors", "fills", "candles", "chartNames", "runTimeline", "priceDigits", "sizeUnit", "valuePerUnit", "cellRows", "canvasTailRows", "batchedTailFromTs", "intervalMs", "exchange", "priceTick", "overlayId", "tpoBlockSize", "legendNote"];
|
|
111
117
|
/**
|
|
112
118
|
* Record one build on a corpus lane's page (`globalThis.__omRig === true` and the store `__wrunResultCapture` the lane
|
|
113
119
|
* created before the app loaded) under `__wrunResultCapture[<overlay id, else the title>]`, newest last, the last
|
|
@@ -64,6 +64,7 @@ export function buildWrunOverlayRunResult(options) {
|
|
|
64
64
|
...(options.cellRows !== undefined ? { cellRows: options.cellRows } : {}),
|
|
65
65
|
...(options.canvasTailRows !== undefined ? { canvasTailRows: options.canvasTailRows } : {}),
|
|
66
66
|
...(options.batchedTailFromTs !== undefined ? { batchedTailFromTs: options.batchedTailFromTs } : {}),
|
|
67
|
+
...(options.valuePerUnit !== undefined ? { valuePerUnit: options.valuePerUnit } : {}),
|
|
67
68
|
...(options.intervalMs !== undefined ? { intervalMs: options.intervalMs } : {}),
|
|
68
69
|
...(options.exchange !== undefined ? { exchange: options.exchange } : {}),
|
|
69
70
|
...(options.priceTick !== undefined ? { priceTick: options.priceTick } : {}),
|
|
@@ -166,6 +167,7 @@ export const WRUN_OVERLAY_RESULT_OPTION_KEYS = [
|
|
|
166
167
|
'runTimeline',
|
|
167
168
|
'priceDigits',
|
|
168
169
|
'sizeUnit',
|
|
170
|
+
'valuePerUnit',
|
|
169
171
|
'cellRows',
|
|
170
172
|
'canvasTailRows',
|
|
171
173
|
'batchedTailFromTs',
|