@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
|
@@ -37,6 +37,15 @@
|
|
|
37
37
|
* offset on its host bar.
|
|
38
38
|
* - Projection, per input: `expiries: "nearest:N"` keeps the bar's N nearest expiries; `overflow: "largest"` cuts a
|
|
39
39
|
* bar over the input's own `max_cells` to its largest premiums (om's packer rule, bit 14 on the first kept print).
|
|
40
|
+
* Beside `newest` N the cut is the union (the SDK's frozen contract): a window-level pass (`cellsWindow`) finds the
|
|
41
|
+
* window's N newest over every bar the instance holds, by time then print key, and each bar keeps its `max_cells`
|
|
42
|
+
* largest and its prints among them (`wrunLargestOrNewestOptionPrints`), at most `max_cells` + N, the packer's
|
|
43
|
+
* capacity for the input. The union answer, today's whole download and either one with live prints folded in project
|
|
44
|
+
* the same cells, bit 14 included, and every run projects again, so a live print moves the cut. `newest_tail_ms`
|
|
45
|
+
* beside "largest" is refused by name (`wrun_option_prints_tail_largest`): the capacity must stay bounded. The union
|
|
46
|
+
* needs a module whose buffer holds it (the input's `capacity`, the sheet's own: a build at kit scaffold 97 writes
|
|
47
|
+
* `max_cells + newest` there, wrun-cell-capacity.leaf `wrunSheetCellBlockTuples`); a sheet naming no capacity (any
|
|
48
|
+
* module built before) reads `max_cells`, so its bars keep their largest alone, as before the union.
|
|
40
49
|
* - Live by coin, on the planes whose OPTION_PRINT producer streams (`chainPlanes`: OPRA and CME): the coin channel of
|
|
41
50
|
* the instance's chain (`K_OPTION_PRINT` subscribes the chain's exchange and underlying, on a governed exchange at a
|
|
42
51
|
* real-time routed tier only: wrun-coin-lane-live.util) feeds every print of the underlying; the fold keeps the
|
|
@@ -55,7 +64,7 @@
|
|
|
55
64
|
import { decideWrunLaneChain, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChainLeadMoved, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
|
|
56
65
|
import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED } from '../wrun-poll-lane.types.js';
|
|
57
66
|
import { refuseWrunOptionKnob, wrunNearestExpiryTuples, wrunOptionExpiriesKnob, wrunOptionExpiriesOf, wrunOptionExpiriesWord, } from '../../wrun-option-knobs.util.js';
|
|
58
|
-
import { compareWrunOptionPrintsInTimeOrder, forEachWrunOptionPrintTuple, isWrunOptionPrintMarker, isWrunOptionPrintTuple, WRUN_OPTION_MAX_DTE_DAYS, WRUN_OPTION_PRINT_COLUMN, WRUN_OPTION_PRINT_SIDES, WRUN_OPTION_PRINTS_BOOK_FIELD, WRUN_OPTION_PRINTS_CONTINUOUS_FIELD, WRUN_OPTION_PRINTS_EXCHANGE_FIELD, WRUN_OPTION_PRINTS_HISTORY, WRUN_OPTION_PRINTS_MONEYNESS, WRUN_OPTION_PRINTS_NEWEST_MAX, WRUN_OPTION_PRINTS_NEWEST_TAIL_MAX_MS, WRUN_OPTION_PRINTS_OVERFLOW, WRUN_OPTION_PRINTS_TYPES, WRUN_OPTION_PRINTS_WIDTH, wrunLargestPremiumPrints, wrunNewestOptionPrintRows, wrunOptionPrintKept, wrunOptionPrintOf, wrunOptionPrintsAcquisitionOf, wrunOptionPrintsHorizon, wrunOptionPrintsInTimeOrder, wrunOptionPrintTimeMs, } from '../../wrun-option-prints.util.js';
|
|
67
|
+
import { compareWrunOptionPrintsInTimeOrder, forEachWrunOptionPrintTuple, isWrunOptionPrintMarker, isWrunOptionPrintTuple, WRUN_OPTION_MAX_DTE_DAYS, WRUN_OPTION_PRINT_COLUMN, WRUN_OPTION_PRINT_SIDES, WRUN_OPTION_PRINTS_BOOK_FIELD, WRUN_OPTION_PRINTS_CONTINUOUS_FIELD, WRUN_OPTION_PRINTS_EXCHANGE_FIELD, WRUN_OPTION_PRINTS_HISTORY, WRUN_OPTION_PRINTS_MONEYNESS, WRUN_OPTION_PRINTS_NEWEST_MAX, WRUN_OPTION_PRINTS_NEWEST_TAIL_MAX_MS, WRUN_OPTION_PRINTS_OVERFLOW, WRUN_OPTION_PRINTS_TYPES, WRUN_OPTION_PRINTS_WIDTH, wrunLargestOrNewestOptionPrints, wrunLargestPremiumPrints, wrunNewestOptionPrintBound, wrunNewestOptionPrintRows, wrunOptionPrintKept, wrunOptionPrintOf, wrunOptionPrintsAcquisitionOf, wrunOptionPrintsHorizon, wrunOptionPrintsInTimeOrder, wrunOptionPrintTimeMs, } from '../../wrun-option-prints.util.js';
|
|
59
68
|
import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../../wrun-present-bits.util.js';
|
|
60
69
|
import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
|
|
61
70
|
import { wrunHostBarOf } from '../../wrun-tier-grid.util.js';
|
|
@@ -63,6 +72,8 @@ import { wrunHostBarOf } from '../../wrun-tier-grid.util.js';
|
|
|
63
72
|
const LANE_KEY = 'option_prints';
|
|
64
73
|
/** om's refusal name of a missing floor. */
|
|
65
74
|
export const WRUN_OPTION_PRINTS_MIN_PREMIUM_REQUIRED_CODE = 'wrun_option_prints_min_premium_required';
|
|
75
|
+
/** om's refusal name of a tail beside `overflow: "largest"` (the union's capacity is `max_cells` + `newest`). */
|
|
76
|
+
export const WRUN_OPTION_PRINTS_TAIL_LARGEST_CODE = 'wrun_option_prints_tail_largest';
|
|
66
77
|
/** What `identity` resolved for a chart (the one chain resolver's chart), read back by `facets`. Keyed by the chart
|
|
67
78
|
* market; the newest entries kept. */
|
|
68
79
|
const PRINTS_CHARTS_KEPT = 16;
|
|
@@ -119,7 +130,8 @@ function wordKnob(source, ctx, knob, words) {
|
|
|
119
130
|
}
|
|
120
131
|
/**
|
|
121
132
|
* One input's cuts and filters as acquisition fields (om `optionCellFacets`' print knobs, each absent at its default so
|
|
122
|
-
* a sheet declaring none keeps its acquisition): `newest`, `newestTailMs` (beside `newest` only
|
|
133
|
+
* a sheet declaring none keeps its acquisition): `newest`, `newestTailMs` (beside `newest` only, never beside
|
|
134
|
+
* `overflow: "largest"`: `wrun_option_prints_tail_largest`), `types`, `sides`
|
|
123
135
|
* (om's facet spelling: the words in om's order joined by commas; none or all four is every side), `moneyness`,
|
|
124
136
|
* `maxDte`, and under `overflow: "largest"` the per-bar cut `largestPerBar` (`laneMaxCells` + 1). Each refused by name
|
|
125
137
|
* outside its words (`wrun_option_knob_invalid`).
|
|
@@ -130,6 +142,11 @@ function optionPrintsCutFacets(source, ctx, overflow, laneMaxCells) {
|
|
|
130
142
|
if (tail !== undefined && newest === undefined) {
|
|
131
143
|
refuseWrunOptionKnob(ctx, 'newest_tail_ms', tail, 'a tail beside newest only (declare newest, 1 and up)');
|
|
132
144
|
}
|
|
145
|
+
if (tail !== undefined && overflow === 'largest') {
|
|
146
|
+
refuseWrunPollInput(ctx, `declares newest_tail_ms beside overflow "largest" (${WRUN_OPTION_PRINTS_TAIL_LARGEST_CODE}): each bar holds its ` +
|
|
147
|
+
'max_cells largest and its prints among the newest, at most max_cells plus newest, a bound a tail would lift; ' +
|
|
148
|
+
'declare the tail or the largest prints, not both', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
149
|
+
}
|
|
133
150
|
const types = wordKnob(source, ctx, 'types', WRUN_OPTION_PRINTS_TYPES);
|
|
134
151
|
const moneyness = wordKnob(source, ctx, 'moneyness', WRUN_OPTION_PRINTS_MONEYNESS);
|
|
135
152
|
const maxDte = countKnob(source, ctx, 'max_dte', WRUN_OPTION_MAX_DTE_DAYS, 'the days to expiry kept at most');
|
|
@@ -300,18 +317,54 @@ function reconcileOptionPrints(held, answer) {
|
|
|
300
317
|
return [row[0], ...mergeBarPrints(answered, kept)];
|
|
301
318
|
});
|
|
302
319
|
}
|
|
303
|
-
/** One input's
|
|
304
|
-
function
|
|
305
|
-
const source = input.source;
|
|
320
|
+
/** One input's prints of a bar before any cut: its N nearest expiries, in time order. */
|
|
321
|
+
function inputOptionPrints(tuples, source) {
|
|
306
322
|
const ordered = wrunOptionPrintsInTimeOrder(tuples);
|
|
307
323
|
const expiries = wrunOptionExpiriesOf(source.expiries);
|
|
308
|
-
|
|
324
|
+
return expiries?.kind === 'nearest'
|
|
309
325
|
? wrunNearestExpiryTuples(ordered, expiries.count, WRUN_OPTION_PRINT_COLUMN.expiry)
|
|
310
326
|
: ordered;
|
|
311
|
-
|
|
312
|
-
|
|
327
|
+
}
|
|
328
|
+
/** The window's newest N an input's bars are unioned with: its `newest` (1 and up) under `overflow: "largest"` with a
|
|
329
|
+
* bound of its own (`max_cells`), in a module whose buffer holds the union (`capacity` at least `max_cells` + N: the
|
|
330
|
+
* sheet's own, wrun-cell-capacity.leaf `wrunSheetCellBlockTuples`); undefined for any other input (its bars cut to
|
|
331
|
+
* their largest, or not at all), and for a sheet naming no such capacity (a module built before kit scaffold 97, or
|
|
332
|
+
* before 96 with a `max_cells` buffer), which keeps the cut before the union: each bar's `max_cells` largest. */
|
|
333
|
+
function unionNewestOf(input) {
|
|
334
|
+
const source = input.source;
|
|
335
|
+
const newest = source.newest;
|
|
336
|
+
return source.overflow === 'largest' &&
|
|
337
|
+
input.maxCells !== undefined &&
|
|
338
|
+
typeof newest === 'number' &&
|
|
339
|
+
Number.isInteger(newest) &&
|
|
340
|
+
newest >= 1 &&
|
|
341
|
+
input.capacity !== undefined &&
|
|
342
|
+
input.capacity >= input.maxCells + newest
|
|
343
|
+
? newest
|
|
344
|
+
: undefined;
|
|
345
|
+
}
|
|
346
|
+
/** The window-level pass an input reads (`cellsWindow`), for an input reading the union alone: the bound of the
|
|
347
|
+
* window's newest cut over every bar the instance holds, each bar read as the input reads it (its nearest expiries),
|
|
348
|
+
* undefined for a window holding fewer than its `newest` prints (every print is newest). */
|
|
349
|
+
function optionPrintsWindow(input) {
|
|
350
|
+
const newest = unionNewestOf(input);
|
|
351
|
+
if (newest === undefined)
|
|
352
|
+
return undefined;
|
|
353
|
+
const source = input.source;
|
|
354
|
+
return (bars) => wrunNewestOptionPrintBound(bars.map((bar) => ({ openMs: bar.openMs, tuples: inputOptionPrints(bar.tuples, source) })), newest);
|
|
355
|
+
}
|
|
356
|
+
/** One input's projection of a bar: its N nearest expiries, then its own bound under `overflow: "largest"`: its
|
|
357
|
+
* largest alone, or beside `newest` its largest unioned with its prints inside the window's newest cut (`bar`, the
|
|
358
|
+
* window-level pass's bound; a caller that ran no pass reads the largest alone). */
|
|
359
|
+
function projectOptionPrints(tuples, input, bar) {
|
|
360
|
+
const source = input.source;
|
|
361
|
+
const kept = inputOptionPrints(tuples, source);
|
|
362
|
+
if (source.overflow !== 'largest' || input.maxCells === undefined)
|
|
363
|
+
return kept;
|
|
364
|
+
if (bar !== undefined && unionNewestOf(input) !== undefined) {
|
|
365
|
+
return wrunLargestOrNewestOptionPrints(kept, bar.openMs, input.maxCells, bar.window);
|
|
313
366
|
}
|
|
314
|
-
return kept;
|
|
367
|
+
return wrunLargestPremiumPrints(kept, input.maxCells);
|
|
315
368
|
}
|
|
316
369
|
export const rowLane = {
|
|
317
370
|
sourceClass: 'option_prints',
|
|
@@ -331,6 +384,7 @@ export const rowLane = {
|
|
|
331
384
|
horizon: wrunOptionPrintsHorizon,
|
|
332
385
|
emptyAnswer: 'quiet',
|
|
333
386
|
cells: projectOptionPrints,
|
|
387
|
+
cellsWindow: optionPrintsWindow,
|
|
334
388
|
liveByCoin: {
|
|
335
389
|
scriptSource: 'option_print',
|
|
336
390
|
// The planes whose OPTION_PRINT producer streams live (a crypto chain's prints are derived each minute: history).
|
|
@@ -103,6 +103,14 @@ export declare const WRUN_OPTION_VIEWS_UNSERVED_REFUSAL = "wrun_option_views_uns
|
|
|
103
103
|
* after its knobs pass, never read wrong.
|
|
104
104
|
*/
|
|
105
105
|
export declare const WRUN_OPTION_STRIKES_KIT_SERVED = true;
|
|
106
|
+
/**
|
|
107
|
+
* Whether this host answers the strike kit fold's curve row (kit 0.96.0: `curve: true` beside `levels: true`, a row of
|
|
108
|
+
* the gamma curve's readings after each bar's levels row). Not yet: the gateway's `strikeKitCurve` read and the worker's
|
|
109
|
+
* fold of it are the Spot Exposures design's units (OPTLOAD W3, U2 and U4), and a fold without the row would read every
|
|
110
|
+
* curve reading NaN. So an input declaring `curve: true` is refused by name after its knobs pass, never drawn without
|
|
111
|
+
* its curve; U4 sets this true with the fold that answers the row.
|
|
112
|
+
*/
|
|
113
|
+
export declare const WRUN_OPTION_STRIKES_KIT_CURVE_SERVED = false;
|
|
106
114
|
/**
|
|
107
115
|
* The acquisition fields of an input's strike kit fold (OPTLOAD G5): the fold, its params and the input's `max_cells`,
|
|
108
116
|
* so the gateway (or the worker's fold while the gateway refuses it) answers a refused levels row for a bar whose newest
|
|
@@ -135,6 +135,14 @@ export const WRUN_OPTION_VIEWS_UNSERVED_REFUSAL = 'wrun_option_views_unserved';
|
|
|
135
135
|
* after its knobs pass, never read wrong.
|
|
136
136
|
*/
|
|
137
137
|
export const WRUN_OPTION_STRIKES_KIT_SERVED = true;
|
|
138
|
+
/**
|
|
139
|
+
* Whether this host answers the strike kit fold's curve row (kit 0.96.0: `curve: true` beside `levels: true`, a row of
|
|
140
|
+
* the gamma curve's readings after each bar's levels row). Not yet: the gateway's `strikeKitCurve` read and the worker's
|
|
141
|
+
* fold of it are the Spot Exposures design's units (OPTLOAD W3, U2 and U4), and a fold without the row would read every
|
|
142
|
+
* curve reading NaN. So an input declaring `curve: true` is refused by name after its knobs pass, never drawn without
|
|
143
|
+
* its curve; U4 sets this true with the fold that answers the row.
|
|
144
|
+
*/
|
|
145
|
+
export const WRUN_OPTION_STRIKES_KIT_CURVE_SERVED = false;
|
|
138
146
|
/**
|
|
139
147
|
* The acquisition fields of an input's strike kit fold (OPTLOAD G5): the fold, its params and the input's `max_cells`,
|
|
140
148
|
* so the gateway (or the worker's fold while the gateway refuses it) answers a refused levels row for a bar whose newest
|
|
@@ -217,6 +225,10 @@ export const rowLane = {
|
|
|
217
225
|
return refuseWrunPollInput(ctx, `reads option_strikes with fold "kit" (${WRUN_OPTION_VIEWS_UNSERVED_REFUSAL}): this app does not carry the ` +
|
|
218
226
|
"kit fold's rows into a run yet; read the strike rows whole (drop fold and its params)", wrunAuthorRuleSeed(WRUN_OPTION_VIEWS_UNSERVED_REFUSAL));
|
|
219
227
|
}
|
|
228
|
+
if (kit?.params.curve === 1 && !WRUN_OPTION_STRIKES_KIT_CURVE_SERVED) {
|
|
229
|
+
return refuseWrunPollInput(ctx, `reads option_strikes with fold "kit" and curve (${WRUN_OPTION_VIEWS_UNSERVED_REFUSAL}): this app does not ` +
|
|
230
|
+
"answer the kit fold's curve row yet; drop curve and read the gamma curve from the strike rows", wrunAuthorRuleSeed(WRUN_OPTION_VIEWS_UNSERVED_REFUSAL));
|
|
231
|
+
}
|
|
220
232
|
const chain = await decideWrunLaneChain(chart, { venue: source.venue, book: source.book }, ctx);
|
|
221
233
|
return {
|
|
222
234
|
// The chain's identity as the options chain keys it (one chain per package: `acquisitions: 'one'`).
|
|
@@ -33,8 +33,11 @@
|
|
|
33
33
|
* the SDK's reference), so the template reads the one or two tuples it reads today. The pick's fields ride the
|
|
34
34
|
* acquisition (`surfacePick` and its params, with the run's bar span), so the worker asks OPTION_SURFACE grouped to
|
|
35
35
|
* the chart's bars with the pick applied there (`optionRead`: the gateway lands each bar on its newest sealed 5m
|
|
36
|
-
* bucket, as this lane lands it)
|
|
37
|
-
*
|
|
36
|
+
* bucket, as this lane lands it), or, where the chart's bars are no grouping the gateway draws (an RTH CME chart's
|
|
37
|
+
* 13:30Z hours, a daily bar), in the widest UTC groups that nest inside them (OPTLOAD W3 SURF-NEST: a few rows a bar,
|
|
38
|
+
* each its group's newest sealed bucket picked; this lane lands each bar on its newest row), and reads today's
|
|
39
|
+
* buckets while the gateway refuses the read; the pick applied on the page to a bar the gateway picked picks the
|
|
40
|
+
* same tuples. An input without `pick` asks and lands as before.
|
|
38
41
|
* - O1 (OPTLOAD G5): on the OPRA plane the chain is the plane's own by coin (`wrunHeldOpraPlaneChain`), no chain
|
|
39
42
|
* directory read.
|
|
40
43
|
*
|
|
@@ -33,8 +33,11 @@
|
|
|
33
33
|
* the SDK's reference), so the template reads the one or two tuples it reads today. The pick's fields ride the
|
|
34
34
|
* acquisition (`surfacePick` and its params, with the run's bar span), so the worker asks OPTION_SURFACE grouped to
|
|
35
35
|
* the chart's bars with the pick applied there (`optionRead`: the gateway lands each bar on its newest sealed 5m
|
|
36
|
-
* bucket, as this lane lands it)
|
|
37
|
-
*
|
|
36
|
+
* bucket, as this lane lands it), or, where the chart's bars are no grouping the gateway draws (an RTH CME chart's
|
|
37
|
+
* 13:30Z hours, a daily bar), in the widest UTC groups that nest inside them (OPTLOAD W3 SURF-NEST: a few rows a bar,
|
|
38
|
+
* each its group's newest sealed bucket picked; this lane lands each bar on its newest row), and reads today's
|
|
39
|
+
* buckets while the gateway refuses the read; the pick applied on the page to a bar the gateway picked picks the
|
|
40
|
+
* same tuples. An input without `pick` asks and lands as before.
|
|
38
41
|
* - O1 (OPTLOAD G5): on the OPRA plane the chain is the plane's own by coin (`wrunHeldOpraPlaneChain`), no chain
|
|
39
42
|
* directory read.
|
|
40
43
|
*
|
|
@@ -92,12 +92,13 @@ export interface WrunPollLaneRunFacts extends OpraReadFacts {
|
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* The kind of value a setting-bound option knob takes (om kit `WrunOptionParamKnobKind`): `number` a number, int or
|
|
95
|
-
* price setting's number; `word` the
|
|
96
|
-
*
|
|
95
|
+
* price setting's number; `word` the word of a select's picked option (its `style_values` entry when the select
|
|
96
|
+
* declares them, else its label), one of the knob's words; `list` the labels of a multi's picked options, each one of
|
|
97
|
+
* the knob's words, in the words' order.
|
|
97
98
|
*/
|
|
98
99
|
export type WrunOptionSettingKnobKind = 'number' | 'word' | 'list';
|
|
99
100
|
/**
|
|
100
|
-
* The option knobs a setting may stand for, by source class, with the kind each takes (om kit 0.
|
|
101
|
+
* The option knobs a setting may stand for, by source class, with the kind each takes (om kit 0.96.0
|
|
101
102
|
* `WRUN_OPTION_PARAM_KNOBS`, row for row): ONE table for both planners, read before a poll lane's `plan` and a row lane's
|
|
102
103
|
* `facets` (`resolveWrunOptionSettingKnobs`), so no lane reads a setting itself. The sheet records the setting's NAME in
|
|
103
104
|
* the knob (an author's `min_premium: "@floor"` compiles to `"floor"`), and every host reads that setting's current
|
|
@@ -106,11 +107,16 @@ export type WrunOptionSettingKnobKind = 'number' | 'word' | 'list';
|
|
|
106
107
|
* the kit's.
|
|
107
108
|
*/
|
|
108
109
|
export declare const WRUN_OPTION_SETTING_KNOBS: Readonly<Record<string, Readonly<Record<string, WrunOptionSettingKnobKind>>>>;
|
|
110
|
+
/** The words a word or list knob takes from a setting (om `wrunOptionKnobWords`): the print classes' `types`,
|
|
111
|
+
* `moneyness` and `sides` (wrun-option-prints.util), and option_strike_flow's `expiries` (the words a setting picks);
|
|
112
|
+
* none for any other knob. */
|
|
113
|
+
export declare function wrunOptionSettingKnobWords(knob: string): readonly string[];
|
|
109
114
|
/**
|
|
110
115
|
* One input's source with every option knob that names a setting read as the setting's current value (om
|
|
111
116
|
* `resolveOptionParamKnobs`, the SDK host's rule, over the class's row of `WRUN_OPTION_SETTING_KNOBS`): a number knob
|
|
112
|
-
* takes a number, int or price setting's number; a word knob (`types`, `moneyness
|
|
113
|
-
*
|
|
117
|
+
* takes a number, int or price setting's number; a word knob (`types`, `moneyness`, option_strike_flow's `expiries`)
|
|
118
|
+
* the word of a select's picked option, its `style_values` entry when the select declares them, else its label, one of
|
|
119
|
+
* its words; a list knob (`sides`) the labels of a multi's picked options, in the words' order. The name
|
|
114
120
|
* must be a compute setting of the sheet (a style knob is none) with a value this run read, of the knob's kind and
|
|
115
121
|
* picking its words, else the input is refused by name (`wrun_option_knob_invalid`). A literal (a number, a list, a word
|
|
116
122
|
* of the knob's own) is left as it is (its lane judges it), and so is every input when the run read no setting values; a
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { wrunParamChoices } from '../wrun-color-settings.util.js';
|
|
2
2
|
import { refuseWrunOptionKnob } from '../wrun-option-knobs.util.js';
|
|
3
3
|
import { wrunOptionPrintKnobWords } from '../wrun-option-prints.util.js';
|
|
4
|
+
import { WRUN_OPTION_STRIKE_FLOW_CLASS, WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS, wrunOptionStrikeFlowExpiriesOf, } from '../wrun-option-strike-flow-lane.util.js';
|
|
4
5
|
import { wrunMultiLabels } from '../wrun-param-values.util.js';
|
|
5
6
|
import { wrunOptionsStopSeed, wrunRefusalSeedOf } from '../wrun-refusal.util.js';
|
|
6
7
|
import { wrunPollLaneByKey, wrunPollLaneGlobalClasses, wrunPollLanes, wrunPollLanesOfClass } from './registry.js';
|
|
@@ -90,7 +91,7 @@ function wrunPollLaneServedOnIndexMode(lane) {
|
|
|
90
91
|
return lane.global === true || lane.nativeRows === true;
|
|
91
92
|
}
|
|
92
93
|
/**
|
|
93
|
-
* The option knobs a setting may stand for, by source class, with the kind each takes (om kit 0.
|
|
94
|
+
* The option knobs a setting may stand for, by source class, with the kind each takes (om kit 0.96.0
|
|
94
95
|
* `WRUN_OPTION_PARAM_KNOBS`, row for row): ONE table for both planners, read before a poll lane's `plan` and a row lane's
|
|
95
96
|
* `facets` (`resolveWrunOptionSettingKnobs`), so no lane reads a setting itself. The sheet records the setting's NAME in
|
|
96
97
|
* the knob (an author's `min_premium: "@floor"` compiles to `"floor"`), and every host reads that setting's current
|
|
@@ -101,7 +102,7 @@ function wrunPollLaneServedOnIndexMode(lane) {
|
|
|
101
102
|
export const WRUN_OPTION_SETTING_KNOBS = Object.freeze({
|
|
102
103
|
options_flow: Object.freeze({ min_premium: 'number', max_dte: 'number' }),
|
|
103
104
|
option_contract_flow: Object.freeze({ min_premium: 'number' }),
|
|
104
|
-
option_strike_flow: Object.freeze({ strike_rows: 'number' }),
|
|
105
|
+
option_strike_flow: Object.freeze({ strike_rows: 'number', expiries: 'word' }),
|
|
105
106
|
option_prints: Object.freeze({
|
|
106
107
|
min_premium: 'number',
|
|
107
108
|
types: 'word',
|
|
@@ -113,6 +114,21 @@ export const WRUN_OPTION_SETTING_KNOBS = Object.freeze({
|
|
|
113
114
|
});
|
|
114
115
|
/** The setting types a number knob reads (om `resolveOptionParamKnobs`: a number, int or price setting). */
|
|
115
116
|
const WRUN_NUMBER_SETTING_TYPES = new Set(['number', 'int', 'price']);
|
|
117
|
+
/** The words a word or list knob takes from a setting (om `wrunOptionKnobWords`): the print classes' `types`,
|
|
118
|
+
* `moneyness` and `sides` (wrun-option-prints.util), and option_strike_flow's `expiries` (the words a setting picks);
|
|
119
|
+
* none for any other knob. */
|
|
120
|
+
export function wrunOptionSettingKnobWords(knob) {
|
|
121
|
+
return knob === 'expiries' ? WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS : wrunOptionPrintKnobWords(knob);
|
|
122
|
+
}
|
|
123
|
+
/** Whether a word knob's value is the knob's own literal, never a setting's name (om `wrunOptionKnobLiteral`): a word
|
|
124
|
+
* the knob takes, and on option_strike_flow's `expiries` any word the class reads ("nearest:N" too, the literal
|
|
125
|
+
* Strike Breakdown declares). A literal is a literal even beside a setting of that name. */
|
|
126
|
+
function wrunOptionKnobLiteral(sourceClass, knob, value) {
|
|
127
|
+
if (knob === 'expiries' && sourceClass === WRUN_OPTION_STRIKE_FLOW_CLASS) {
|
|
128
|
+
return wrunOptionStrikeFlowExpiriesOf(value) !== undefined;
|
|
129
|
+
}
|
|
130
|
+
return wrunOptionSettingKnobWords(knob).includes(value);
|
|
131
|
+
}
|
|
116
132
|
/** What a knob of each kind takes beside a setting's name, as its refusal spells it. */
|
|
117
133
|
function wrunSettingKnobLiteralWords(kind, words) {
|
|
118
134
|
if (kind === 'number')
|
|
@@ -122,7 +138,7 @@ function wrunSettingKnobLiteralWords(kind, words) {
|
|
|
122
138
|
/** The setting a knob of each kind reads its value from, as its refusal spells it. */
|
|
123
139
|
const WRUN_SETTING_KNOB_SETTINGS = Object.freeze({
|
|
124
140
|
number: 'a number, int or price setting',
|
|
125
|
-
word: 'a select setting whose picked option is
|
|
141
|
+
word: 'a select setting whose picked option is one of them (its style_values word, else its label)',
|
|
126
142
|
list: 'a multi setting whose picked options are labelled with them',
|
|
127
143
|
});
|
|
128
144
|
/** The literal a setting stands for on a knob of `kind` at the run's `value`, or why it stands for none. */
|
|
@@ -133,9 +149,13 @@ function wrunSettingKnobLiteral(kind, words, param, value) {
|
|
|
133
149
|
if (kind === 'word') {
|
|
134
150
|
if (type !== 'select')
|
|
135
151
|
return { why: `is a ${type} setting` };
|
|
136
|
-
// THE select read's choices (a select's options, labelled by `option_labels`), the picked one by its value
|
|
137
|
-
|
|
138
|
-
|
|
152
|
+
// THE select read's choices (a select's options, labelled by `option_labels`), the picked one by its value; its
|
|
153
|
+
// word the `style_values` entry at the pick's place when the select declares them (kit 0.96.0: the dialog keeps
|
|
154
|
+
// its own labels), else its label (om `selectWord`).
|
|
155
|
+
const choices = wrunParamChoices(param);
|
|
156
|
+
const at = choices?.findIndex((choice) => choice.value === value) ?? -1;
|
|
157
|
+
const word = at < 0 ? undefined : Array.isArray(param.style_values) ? param.style_values[at] : choices?.[at]?.label;
|
|
158
|
+
return typeof word === 'string' && words.includes(word) ? { literal: word } : { why: `picks '${word ?? value}'` };
|
|
139
159
|
}
|
|
140
160
|
if (type !== 'multi')
|
|
141
161
|
return { why: `is a ${type} setting` };
|
|
@@ -150,8 +170,9 @@ function wrunSettingKnobLiteral(kind, words, param, value) {
|
|
|
150
170
|
/**
|
|
151
171
|
* One input's source with every option knob that names a setting read as the setting's current value (om
|
|
152
172
|
* `resolveOptionParamKnobs`, the SDK host's rule, over the class's row of `WRUN_OPTION_SETTING_KNOBS`): a number knob
|
|
153
|
-
* takes a number, int or price setting's number; a word knob (`types`, `moneyness
|
|
154
|
-
*
|
|
173
|
+
* takes a number, int or price setting's number; a word knob (`types`, `moneyness`, option_strike_flow's `expiries`)
|
|
174
|
+
* the word of a select's picked option, its `style_values` entry when the select declares them, else its label, one of
|
|
175
|
+
* its words; a list knob (`sides`) the labels of a multi's picked options, in the words' order. The name
|
|
155
176
|
* must be a compute setting of the sheet (a style knob is none) with a value this run read, of the knob's kind and
|
|
156
177
|
* picking its words, else the input is refused by name (`wrun_option_knob_invalid`). A literal (a number, a list, a word
|
|
157
178
|
* of the knob's own) is left as it is (its lane judges it), and so is every input when the run read no setting values; a
|
|
@@ -168,9 +189,9 @@ export function resolveWrunOptionSettingKnobs(ctx, source, params, values) {
|
|
|
168
189
|
const name = source[knob];
|
|
169
190
|
if (typeof name !== 'string')
|
|
170
191
|
continue;
|
|
171
|
-
const words =
|
|
192
|
+
const words = wrunOptionSettingKnobWords(knob);
|
|
172
193
|
// A word knob's own word is a literal, never a setting's name.
|
|
173
|
-
if (kind === 'word' &&
|
|
194
|
+
if (kind === 'word' && wrunOptionKnobLiteral(ctx.sourceClass, knob, name))
|
|
174
195
|
continue;
|
|
175
196
|
const literalWords = wrunSettingKnobLiteralWords(kind, words);
|
|
176
197
|
const param = params.find((candidate) => candidate.name === name);
|
|
@@ -6,5 +6,37 @@ import { type WrunHostGridAsk } from '../wrun-tier-grid.util.js';
|
|
|
6
6
|
export declare const WRUN_ROW_LANE_FIRST_PAINT_BARS = 30;
|
|
7
7
|
/** The most bytes a row lane's first ask is projected to answer (OPTLOAD first paint: 0.25 MB, at 8 bytes a cell). */
|
|
8
8
|
export declare const WRUN_ROW_LANE_FIRST_PAINT_BYTES: number;
|
|
9
|
-
/**
|
|
9
|
+
/** The fewest bars a first slice holds to draw before the older bars land: a closed bar beside the newest. A lane
|
|
10
|
+
* whose budget leaves the newest bar alone (Strike Footprint's expiry_strike rows, Interval Flow's contracts at 1h)
|
|
11
|
+
* draws nothing early: one bar, forming most of a session, is no first picture to check, and Strike Footprint learns
|
|
12
|
+
* its strike step over the whole run, so that bar could read another value once the older bars land. */
|
|
13
|
+
export declare const WRUN_ROW_LANE_FIRST_SLICE_MIN_BARS = 2;
|
|
14
|
+
/** A host-grid ask plan split for first paint: the slice's asks (`first`), the older parts newest first (`older`, empty
|
|
15
|
+
* when the slice holds the plan whole), where the slice starts (its first bar's open; set only when it split) and
|
|
16
|
+
* whether its cut falls on a trade date's first bar (`sessions` asked and met; set only then). */
|
|
17
|
+
export interface WrunRowLaneFirstPaintSplit {
|
|
18
|
+
first: WrunHostGridAsk[];
|
|
19
|
+
older: WrunHostGridAsk[];
|
|
20
|
+
sliceFromMs?: number;
|
|
21
|
+
sessionAligned?: true;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A host-grid ask plan split for first paint (see the module doc). `sessions` (the chart's trade date of a bar, on
|
|
25
|
+
* every run that reads one) moves the cut forward to the first slice bar of another trade date than the bar before the cut, so the slice
|
|
26
|
+
* holds whole sessions (`sessionAligned`); when every slice bar shares that trade date (a session longer than the
|
|
27
|
+
* slice: a 5m chart inside its day) the split is the plain one, unaligned, and nothing draws before the whole answer.
|
|
28
|
+
*/
|
|
29
|
+
export declare function wrunRowLaneFirstPaintSplit(asks: readonly WrunHostGridAsk[], window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs' | 'nowMs'>, budget: WrunRowLaneRowBudget | undefined, acquisition?: Readonly<Record<string, unknown>>, sessionGrid?: LiveBucketVenue | null, sessions?: (barOpenMs: number) => number): WrunRowLaneFirstPaintSplit;
|
|
30
|
+
/** A host-grid ask plan ordered for first paint (see the module doc): the slice's asks, then the older ones. */
|
|
10
31
|
export declare function wrunRowLaneFirstPaintAsks(asks: readonly WrunHostGridAsk[], window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs' | 'nowMs'>, budget: WrunRowLaneRowBudget | undefined, acquisition?: Readonly<Record<string, unknown>>, sessionGrid?: LiveBucketVenue | null): WrunHostGridAsk[];
|
|
32
|
+
/**
|
|
33
|
+
* The bars a first slice's early answer holds back as partial (bit 14), ascending, or undefined when the slice has no
|
|
34
|
+
* early answer (wrun-row-lanes.util `fetchWrunRowLaneRows`, `onFirstSlice`): every bar the older asks cover that the
|
|
35
|
+
* lane's projection reads rows for (`budget.barRows` under the acquisition the asks were budgeted under). A bar it
|
|
36
|
+
* projects at none (a day before today under `history` "today") reads nothing in the whole answer either, so it stays
|
|
37
|
+
* quiet. Undefined unless the split's cut falls on a trade date's first bar (`sessionAligned`: the slice holds whole
|
|
38
|
+
* sessions, so a slice bar reads in the first picture what it reads in the whole answer for any package whose state
|
|
39
|
+
* starts again on each trade date), when the slice holds fewer than `WRUN_ROW_LANE_FIRST_SLICE_MIN_BARS` bars, or
|
|
40
|
+
* when no older bar is projected to hold rows (nothing to wait for).
|
|
41
|
+
*/
|
|
42
|
+
export declare function wrunRowLaneFirstSliceHeldBars(split: Pick<WrunRowLaneFirstPaintSplit, 'older' | 'sliceFromMs' | 'sessionAligned'>, window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs' | 'nowMs'>, budget: WrunRowLaneRowBudget, acquisition?: Readonly<Record<string, unknown>>, sessionGrid?: LiveBucketVenue | null): number[] | undefined;
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
* parts follow, newest first. The asks cover the same bars at the same tiers, so the landed rows are the same. A lane
|
|
7
7
|
* with no row budget, and a plan the slice holds whole, keep their plan. wrun-row-lanes.util `fetchWrunRowLaneRows`
|
|
8
8
|
* loads this module for a row-budget lane only, so it stays off the boot path (tests/utility/wrun/wrun-door.closure).
|
|
9
|
+
*
|
|
10
|
+
* Where the chart reads trade dates (`sessions`, its `time.trade_date`) the cut falls on a trade date's first bar on
|
|
11
|
+
* every run, so the slice holds whole sessions and a first paint asks the windows every later run asks. A full run's
|
|
12
|
+
* first paint draws that slice before the older asks land (`fetchWrunRowLaneRows` `onFirstSlice`): a package whose
|
|
13
|
+
* state starts again on each trade date reads every slice bar as the whole answer does, and the older bars read
|
|
14
|
+
* partial until the whole answer fills them in (`wrunRowLaneFirstSliceHeldBars`).
|
|
9
15
|
*/
|
|
10
16
|
import { KSCRIPT_SOURCE_CELL_BYTES } from '../../chart/kscript-source-answer-budget.leaf.js';
|
|
11
17
|
import { wrunHostBarSpanOf } from '../wrun-tier-grid.util.js';
|
|
@@ -13,10 +19,20 @@ import { wrunHostBarSpanOf } from '../wrun-tier-grid.util.js';
|
|
|
13
19
|
export const WRUN_ROW_LANE_FIRST_PAINT_BARS = 30;
|
|
14
20
|
/** The most bytes a row lane's first ask is projected to answer (OPTLOAD first paint: 0.25 MB, at 8 bytes a cell). */
|
|
15
21
|
export const WRUN_ROW_LANE_FIRST_PAINT_BYTES = 256 * 1024;
|
|
16
|
-
/**
|
|
17
|
-
|
|
22
|
+
/** The fewest bars a first slice holds to draw before the older bars land: a closed bar beside the newest. A lane
|
|
23
|
+
* whose budget leaves the newest bar alone (Strike Footprint's expiry_strike rows, Interval Flow's contracts at 1h)
|
|
24
|
+
* draws nothing early: one bar, forming most of a session, is no first picture to check, and Strike Footprint learns
|
|
25
|
+
* its strike step over the whole run, so that bar could read another value once the older bars land. */
|
|
26
|
+
export const WRUN_ROW_LANE_FIRST_SLICE_MIN_BARS = 2;
|
|
27
|
+
/**
|
|
28
|
+
* A host-grid ask plan split for first paint (see the module doc). `sessions` (the chart's trade date of a bar, on
|
|
29
|
+
* every run that reads one) moves the cut forward to the first slice bar of another trade date than the bar before the cut, so the slice
|
|
30
|
+
* holds whole sessions (`sessionAligned`); when every slice bar shares that trade date (a session longer than the
|
|
31
|
+
* slice: a 5m chart inside its day) the split is the plain one, unaligned, and nothing draws before the whole answer.
|
|
32
|
+
*/
|
|
33
|
+
export function wrunRowLaneFirstPaintSplit(asks, window, budget, acquisition = {}, sessionGrid, sessions) {
|
|
18
34
|
if (budget === undefined || asks.length === 0)
|
|
19
|
-
return [...asks];
|
|
35
|
+
return { first: [...asks], older: [] };
|
|
20
36
|
const asked = [];
|
|
21
37
|
for (const ask of asks) {
|
|
22
38
|
for (const stampMs of window.barOpens) {
|
|
@@ -39,8 +55,18 @@ export function wrunRowLaneFirstPaintAsks(asks, window, budget, acquisition = {}
|
|
|
39
55
|
bytes += barBytes;
|
|
40
56
|
sliceFrom = bar.fromMs;
|
|
41
57
|
}
|
|
42
|
-
if (!Number.isFinite(sliceFrom) || asked.every((bar) => bar.fromMs >= sliceFrom))
|
|
43
|
-
return [...asks];
|
|
58
|
+
if (!Number.isFinite(sliceFrom) || asked.every((bar) => bar.fromMs >= sliceFrom)) {
|
|
59
|
+
return { first: [...asks], older: [] };
|
|
60
|
+
}
|
|
61
|
+
const aligned = sessions === undefined ? undefined : sessionAlignedCut(sliceFrom, window, sessions, sessionGrid);
|
|
62
|
+
return {
|
|
63
|
+
...cutAsks(asks, aligned ?? sliceFrom),
|
|
64
|
+
sliceFromMs: aligned ?? sliceFrom,
|
|
65
|
+
...(aligned !== undefined ? { sessionAligned: true } : {}),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** The asks cut at `sliceFrom` (never inside a bar): the slice's in their order, the older ones newest first. */
|
|
69
|
+
function cutAsks(asks, sliceFrom) {
|
|
44
70
|
const first = [];
|
|
45
71
|
const older = [];
|
|
46
72
|
for (const ask of asks) {
|
|
@@ -53,5 +79,68 @@ export function wrunRowLaneFirstPaintAsks(asks, window, budget, acquisition = {}
|
|
|
53
79
|
first.push({ ...ask, fromMs: sliceFrom });
|
|
54
80
|
}
|
|
55
81
|
}
|
|
56
|
-
return
|
|
82
|
+
return { first, older: older.sort((a, b) => b.fromMs - a.fromMs) };
|
|
83
|
+
}
|
|
84
|
+
/** The slice's start moved to the first slice bar of another trade date than the bar before the cut; undefined when
|
|
85
|
+
* no such bar exists, or a trade date cannot be read (NaN). */
|
|
86
|
+
function sessionAlignedCut(sliceFrom, window, sessions, sessionGrid) {
|
|
87
|
+
let before;
|
|
88
|
+
const slice = [];
|
|
89
|
+
for (const stampMs of window.barOpens) {
|
|
90
|
+
const span = wrunHostBarSpanOf(stampMs, window.intervalMs, sessionGrid);
|
|
91
|
+
if (span.fromMs >= sliceFrom)
|
|
92
|
+
slice.push({ stampMs, fromMs: span.fromMs });
|
|
93
|
+
else if (before === undefined || stampMs > before)
|
|
94
|
+
before = stampMs;
|
|
95
|
+
}
|
|
96
|
+
if (before === undefined)
|
|
97
|
+
return sliceFrom;
|
|
98
|
+
const cutDate = sessions(before);
|
|
99
|
+
if (!Number.isFinite(cutDate))
|
|
100
|
+
return undefined;
|
|
101
|
+
let start;
|
|
102
|
+
for (const bar of slice) {
|
|
103
|
+
const date = sessions(bar.stampMs);
|
|
104
|
+
if (!Number.isFinite(date))
|
|
105
|
+
return undefined;
|
|
106
|
+
if (date !== cutDate && (start === undefined || bar.fromMs < start))
|
|
107
|
+
start = bar.fromMs;
|
|
108
|
+
}
|
|
109
|
+
return start;
|
|
110
|
+
}
|
|
111
|
+
/** A host-grid ask plan ordered for first paint (see the module doc): the slice's asks, then the older ones. */
|
|
112
|
+
export function wrunRowLaneFirstPaintAsks(asks, window, budget, acquisition = {}, sessionGrid) {
|
|
113
|
+
const { first, older } = wrunRowLaneFirstPaintSplit(asks, window, budget, acquisition, sessionGrid);
|
|
114
|
+
return [...first, ...older];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The bars a first slice's early answer holds back as partial (bit 14), ascending, or undefined when the slice has no
|
|
118
|
+
* early answer (wrun-row-lanes.util `fetchWrunRowLaneRows`, `onFirstSlice`): every bar the older asks cover that the
|
|
119
|
+
* lane's projection reads rows for (`budget.barRows` under the acquisition the asks were budgeted under). A bar it
|
|
120
|
+
* projects at none (a day before today under `history` "today") reads nothing in the whole answer either, so it stays
|
|
121
|
+
* quiet. Undefined unless the split's cut falls on a trade date's first bar (`sessionAligned`: the slice holds whole
|
|
122
|
+
* sessions, so a slice bar reads in the first picture what it reads in the whole answer for any package whose state
|
|
123
|
+
* starts again on each trade date), when the slice holds fewer than `WRUN_ROW_LANE_FIRST_SLICE_MIN_BARS` bars, or
|
|
124
|
+
* when no older bar is projected to hold rows (nothing to wait for).
|
|
125
|
+
*/
|
|
126
|
+
export function wrunRowLaneFirstSliceHeldBars(split, window, budget, acquisition = {}, sessionGrid) {
|
|
127
|
+
const { sliceFromMs } = split;
|
|
128
|
+
if (split.sessionAligned !== true || sliceFromMs === undefined || split.older.length === 0)
|
|
129
|
+
return undefined;
|
|
130
|
+
const held = [];
|
|
131
|
+
let sliceBars = 0;
|
|
132
|
+
for (const stampMs of window.barOpens) {
|
|
133
|
+
const span = wrunHostBarSpanOf(stampMs, window.intervalMs, sessionGrid);
|
|
134
|
+
if (span.fromMs >= sliceFromMs) {
|
|
135
|
+
sliceBars += 1;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
const ask = split.older.find((candidate) => span.fromMs >= candidate.fromMs && span.fromMs < candidate.toMs);
|
|
139
|
+
if (ask === undefined)
|
|
140
|
+
continue;
|
|
141
|
+
const projected = budget.barRows({ openMs: span.fromMs, endMs: span.toMs, tier: ask.tier }, window.nowMs, acquisition);
|
|
142
|
+
if (Number.isFinite(projected) && projected > 0)
|
|
143
|
+
held.push(stampMs);
|
|
144
|
+
}
|
|
145
|
+
return held.length === 0 || sliceBars < WRUN_ROW_LANE_FIRST_SLICE_MIN_BARS ? undefined : held.sort((a, b) => a - b);
|
|
57
146
|
}
|
|
@@ -250,9 +250,14 @@ export interface WrunRowLaneDescriptor {
|
|
|
250
250
|
*/
|
|
251
251
|
presentMask?: false;
|
|
252
252
|
/** One input's projection of a bar's tuples (its own `expiries` word over a lane two inputs share, a field
|
|
253
|
-
* selection, a cut to the input's own `max_cells`): applied per input per bar, never refetching.
|
|
254
|
-
* bar's tuples as they are. */
|
|
255
|
-
cells?: (tuples: ReadonlyArray<ReadonlyArray<number>>, input: WrunRowLaneCellInput) => ReadonlyArray<ReadonlyArray<number>>;
|
|
253
|
+
* selection, a cut to the input's own `max_cells`): applied per input per bar, never refetching. `bar` names the
|
|
254
|
+
* bar's open and what `cellsWindow` answered, on a lane that declares one. Absent: the bar's tuples as they are. */
|
|
255
|
+
cells?: (tuples: ReadonlyArray<ReadonlyArray<number>>, input: WrunRowLaneCellInput, bar?: WrunRowLaneCellBarContext) => ReadonlyArray<ReadonlyArray<number>>;
|
|
256
|
+
/** The window-level pass an input reads before its per-bar projection, or undefined (absent too) when `cells` reads
|
|
257
|
+
* each bar alone: read once over every bar the instance holds (each bar's open and its exact tuples), its answer
|
|
258
|
+
* handed to `cells` on every bar (`option_prints`' union: the window's newest cut, which each bar's largest prints
|
|
259
|
+
* are unioned with). An input that reads none costs no more than before. */
|
|
260
|
+
cellsWindow?: (input: WrunRowLaneCellInput) => ((bars: ReadonlyArray<WrunRowLaneCellBar>) => unknown) | undefined;
|
|
256
261
|
/** The lane's OWN fetch in place of the chart's (a series no K control serves): the poll lanes' ask shape,
|
|
257
262
|
* answered as rows `[ts, tuple, ...]` at the asked tier, ascending. */
|
|
258
263
|
fetch?: (ask: WrunPollLaneFetchAsk) => Promise<ReadonlyArray<ReadonlyArray<unknown>>>;
|
|
@@ -260,12 +265,27 @@ export interface WrunRowLaneDescriptor {
|
|
|
260
265
|
* instance); absent: a poll lane (the reconcile re-asks it). */
|
|
261
266
|
liveByCoin?: WrunRowLaneLiveByCoin;
|
|
262
267
|
}
|
|
263
|
-
/** The input a lane's per-input projection (`cells`) reads: its name, its declaration
|
|
264
|
-
*
|
|
268
|
+
/** The input a lane's per-input projection (`cells`) reads: its name, its declaration, its `max_cells` (the row
|
|
269
|
+
* builder hands it from the static plan) and the most tuples a bar's block may hold in the run's module (`capacity`:
|
|
270
|
+
* the sheet's `capacity ?? max_cells`, a print union's `max_cells + newest` only where the module's capacity holds
|
|
271
|
+
* it, the bound the packer refuses past: wrun-cell-capacity.leaf `wrunSheetCellBlockTuples`, from the static plan).
|
|
272
|
+
* Absent `capacity` reads `maxCells`. */
|
|
265
273
|
export interface WrunRowLaneCellInput {
|
|
266
274
|
name: string;
|
|
267
275
|
source: WrunInputSource;
|
|
268
276
|
maxCells?: number;
|
|
277
|
+
capacity?: number;
|
|
278
|
+
}
|
|
279
|
+
/** One bar as a lane's window-level pass reads it (`cellsWindow`): its open and its exact tuples. */
|
|
280
|
+
export interface WrunRowLaneCellBar {
|
|
281
|
+
openMs: number;
|
|
282
|
+
tuples: ReadonlyArray<ReadonlyArray<number>>;
|
|
283
|
+
}
|
|
284
|
+
/** What a bar's projection reads beside its tuples on a lane with a window-level pass: the bar's open and the pass's
|
|
285
|
+
* answer over the whole window (`cellsWindow`). */
|
|
286
|
+
export interface WrunRowLaneCellBarContext {
|
|
287
|
+
openMs: number;
|
|
288
|
+
window: unknown;
|
|
269
289
|
}
|
|
270
290
|
/** What a row-lane file may export: one lane, several, or both. */
|
|
271
291
|
export interface WrunRowLaneModule {
|