@orangecharts/wrun-chart-host 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/constants/feature-flags.constants.d.ts +9 -0
- package/dist/constants/feature-flags.constants.js +86 -16
- 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 +15 -0
- package/dist/constants/opra-compliance.constants.js +15 -0
- package/dist/constants/option-venues.constants.d.ts +11 -6
- package/dist/constants/option-venues.constants.js +5 -2
- package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +20 -20
- package/dist/constants/venue-presets.constants.js +24 -26
- package/dist/host-env.d.ts +39 -9
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +108 -18
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
- package/dist/interfaces/opra-realtime.interface.js +10 -10
- package/dist/interfaces/replay.interface.d.ts +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +52 -15
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +94 -14
- package/dist/kscript-data/controls/live-trades-merge.util.js +132 -22
- package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
- package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
- package/dist/market-data/billing.interface.d.ts +227 -42
- package/dist/market-data/billing.interface.js +60 -12
- package/dist/market-data/venue.d.ts +88 -6
- package/dist/market-data/venues/cme.contract.copy.json +66 -0
- package/dist/market-data/venues/cme.d.ts +126 -0
- package/dist/market-data/venues/cme.js +133 -0
- package/dist/market-data/venues/index.d.ts +165 -8
- package/dist/market-data/venues/index.js +48 -6
- 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/settings-templates/index.js +7 -3
- package/dist/settings-templates/indicator-fields.d.ts +5 -4
- package/dist/settings-templates/indicator-fields.js +45 -6
- package/dist/settings-templates/tool-rules.d.ts +27 -17
- package/dist/settings-templates/tool-rules.js +27 -11
- package/dist/settings-templates/tool-tables.generated.js +91 -31
- package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
- package/dist/utility/chart/book-live-bucket.util.js +47 -0
- package/dist/utility/chart/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 +24 -3
- 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-drawing-safe-area.util.d.ts +35 -11
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +7 -2
- package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
- package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -27
- package/dist/utility/chart/kscript-venue-policy.util.js +74 -32
- package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
- package/dist/utility/chart/market-session-schedule.util.js +16 -0
- package/dist/utility/chart/marketKind.util.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/opra-read-access.leaf.d.ts +5 -3
- package/dist/utility/chart/opra-read-access.leaf.js +5 -3
- 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/rth-session.util.d.ts +3 -2
- package/dist/utility/chart/rth-session.util.js +2 -1
- package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
- package/dist/utility/chart/window-geometry.leaf.js +22 -6
- package/dist/utility/chart/wrun-run-result.util.d.ts +17 -0
- package/dist/utility/chart/wrun-run-result.util.js +145 -7
- package/dist/utility/common/transformations.util.d.ts +7 -0
- package/dist/utility/common/transformations.util.js +11 -0
- package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
- package/dist/utility/options/option-bar-anchor.util.js +340 -0
- package/dist/utility/options/option-venue.util.d.ts +21 -3
- package/dist/utility/options/option-venue.util.js +30 -3
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
- package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
- package/dist/utility/wrun/derived-roots.util.js +471 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +5 -3
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +6 -4
- 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/lanes/option_daily.js +5 -2
- package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
- package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
- 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 +15 -6
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +82 -13
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -8
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +95 -14
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +7 -3
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +35 -14
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +70 -20
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -0
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +45 -1
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +114 -6
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +56 -5
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +224 -26
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +822 -58
- 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-builtin-twin.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
- 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 +192 -13
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +437 -55
- 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 +107 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +134 -0
- package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
- package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
- package/dist/utility/wrun/wrun-frames.d.ts +27 -6
- package/dist/utility/wrun/wrun-frames.js +78 -15
- 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-hosted-wire.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +51 -21
- package/dist/utility/wrun/wrun-hud-looks.util.js +74 -28
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
- 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 +19 -9
- package/dist/utility/wrun/wrun-live-intake.util.js +213 -45
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +246 -49
- 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 +205 -48
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +277 -34
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +340 -56
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
- package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
- package/dist/utility/wrun/wrun-option-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-forecast.util.d.ts +31 -0
- package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +26 -6
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +50 -11
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +109 -19
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +222 -61
- package/dist/utility/wrun/wrun-option-views.util.d.ts +96 -18
- package/dist/utility/wrun/wrun-option-views.util.js +246 -51
- 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-output-style.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-output-style.util.js +20 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +20 -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-lifecycle.util.d.ts +10 -1
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
- package/dist/utility/wrun/wrun-overlay-recovery.util.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 +134 -37
- package/dist/utility/wrun/wrun-overlay-run.util.js +1118 -254
- 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-pane-format.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +63 -13
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +37 -24
- package/dist/utility/wrun/wrun-panel-style.util.js +100 -29
- package/dist/utility/wrun/wrun-param-map.util.d.ts +15 -11
- package/dist/utility/wrun/wrun-param-map.util.js +13 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +21 -3
- package/dist/utility/wrun/wrun-param-values.util.js +6 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +12 -11
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
- package/dist/utility/wrun/wrun-refusal.util.js +10 -1
- package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
- package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +52 -1
- package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
- package/dist/utility/wrun/wrun-socket-row-source.js +113 -8
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +9 -1
- package/dist/utility/wrun/wrun-source-rows.util.js +108 -43
- package/dist/utility/wrun/wrun-style-words.util.js +6 -4
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
- package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-tape-per-order.util.js +26 -0
- package/dist/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/utils/replay/replay-buffer-math.d.ts +53 -2
- package/dist/utils/replay/replay-buffer-math.js +227 -20
- 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 +5 -5
|
@@ -286,8 +286,9 @@ export declare function isWrunOptionPrintMarker(tuple: ArrayLike<number>): boole
|
|
|
286
286
|
* answers. The live fold applies it after every drain, so a live bar never outgrows the cut its history was read under
|
|
287
287
|
* (Flow Tape's day bar held the newest 3,000 prints from history, then every live print of the day on top, past its
|
|
288
288
|
* `max_cells`). A bar the cut empties keeps its row, empty or, when it was partial, the marker; a marker is no print.
|
|
289
|
-
* No newest cut, or `overflow: "largest"` (
|
|
290
|
-
*
|
|
289
|
+
* No newest cut, or `overflow: "largest"` (the projection makes the cut there, each bar's largest unioned with the
|
|
290
|
+
* window's newest over every print the rows hold, `wrunLargestOrNewestOptionPrints`, again on every run): the rows as
|
|
291
|
+
* they are (copied).
|
|
291
292
|
*/
|
|
292
293
|
export declare function wrunNewestOptionPrintRows(rows: ReadonlyArray<ReadonlyArray<unknown>>, acquisition: Pick<WrunOptionPrintsAcquisition, 'newest' | 'newestTailMs' | 'overflow'>): unknown[][];
|
|
293
294
|
/**
|
|
@@ -311,4 +312,42 @@ export declare function forEachWrunOptionPrintTuple(row: ReadonlyArray<unknown>,
|
|
|
311
312
|
* the bar as partial. A bar within its bound is returned as it is.
|
|
312
313
|
*/
|
|
313
314
|
export declare function wrunLargestPremiumPrints(tuples: ReadonlyArray<ReadonlyArray<number>>, maxCells: number): ReadonlyArray<ReadonlyArray<number>>;
|
|
315
|
+
/**
|
|
316
|
+
* Where the window's newest cut ends under `overflow: "largest"` (the union, the SDK's frozen contract): the window's
|
|
317
|
+
* `newest` newest prints ranked by time, then print key, newest first, exactly `newest` of them (a print's time its
|
|
318
|
+
* bar's open plus its offset; the gateway keeps every print sharing the last one's millisecond, the key cuts them here),
|
|
319
|
+
* read as the last of them: its time, its key and its bar's open. A print is inside the cut when its time, then its
|
|
320
|
+
* key, is at or after the bound's.
|
|
321
|
+
*/
|
|
322
|
+
export interface WrunNewestOptionPrintBound {
|
|
323
|
+
atMs: number;
|
|
324
|
+
key: number;
|
|
325
|
+
barOpenMs: number;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* The bound of the window's newest cut over every bar an instance holds (`WrunNewestOptionPrintBound`), or undefined
|
|
329
|
+
* when they hold fewer than `newest` prints (every print is inside the cut). A partial bar's marker is no print. The
|
|
330
|
+
* bound is the same over the gateway's union answer, today's whole download and either one merged with live prints: each
|
|
331
|
+
* holds the window's `newest` newest prints whole.
|
|
332
|
+
*/
|
|
333
|
+
export declare function wrunNewestOptionPrintBound(bars: ReadonlyArray<{
|
|
334
|
+
readonly openMs: number;
|
|
335
|
+
readonly tuples: ReadonlyArray<ReadonlyArray<number>>;
|
|
336
|
+
}>, newest: number): WrunNewestOptionPrintBound | undefined;
|
|
337
|
+
/**
|
|
338
|
+
* One bar's prints under `overflow: "largest"` beside the window's newest cut (the union, the SDK's frozen contract):
|
|
339
|
+
* its `maxCells` largest (`wrunLargestPremiumPrints`' order) and every print inside the cut (`bound`, from
|
|
340
|
+
* `wrunNewestOptionPrintBound`), each once, in the order given. So a block holds at most `maxCells` plus the cut's
|
|
341
|
+
* count, the read's capacity for the input (wrun-cell-capacity.leaf `wrunCellReadCapacity`), which a module holds whole
|
|
342
|
+
* only when its sheet's `capacity` does (`wrunCellBlockTuples`).
|
|
343
|
+
*
|
|
344
|
+
* Bit 14 on the first kept print, by a rule every answer reads alike (the gateway's union answer, today's whole
|
|
345
|
+
* download, either one merged with live prints), so the cells never depend on the path: a bar older than the bar
|
|
346
|
+
* holding the bound, past `maxCells` prints (none of its prints is newest: its largest alone, as without the cut); and
|
|
347
|
+
* the bar holding the bound, past `maxCells` prints, even when nothing it holds is left out (the gateway answers its
|
|
348
|
+
* largest and its prints inside the cut, so whether an older and smaller print was left out cannot be told there). A bar
|
|
349
|
+
* newer than that one holds only prints inside the cut, and with no bound (fewer than `newest` prints in the window)
|
|
350
|
+
* every bar holds every print, unmarked.
|
|
351
|
+
*/
|
|
352
|
+
export declare function wrunLargestOrNewestOptionPrints(tuples: ReadonlyArray<ReadonlyArray<number>>, barOpenMs: number, maxCells: number, bound: WrunNewestOptionPrintBound | undefined): ReadonlyArray<ReadonlyArray<number>>;
|
|
314
353
|
export {};
|
|
@@ -45,7 +45,9 @@
|
|
|
45
45
|
* every print of the window:
|
|
46
46
|
* - cuts: `newest` (the window's N newest prints) with `newestTailMs` (every print up to that many ms before the
|
|
47
47
|
* oldest of them), and `largestPerBar` (K = the inputs' `max_cells` + 1 largest premiums of each chart bar, which
|
|
48
|
-
* the per-input projection cuts to `max_cells` as before, bit 14 on a bar that answered more);
|
|
48
|
+
* the per-input projection cuts to `max_cells` as before, bit 14 on a bar that answered more); both asked, the
|
|
49
|
+
* gateway answers their union, and the projection keeps each bar's `max_cells` largest unioned with its prints
|
|
50
|
+
* inside the window's newest N (`wrunLargestOrNewestOptionPrints`, a block of at most `max_cells` + N);
|
|
49
51
|
* - filters, per print (`wrunOptionPrintKept`, the one rule history and live read): `types`, `sides`, `maxDte` and
|
|
50
52
|
* `moneyness` (the producer's rule, `wrunOptionPrintMoneyness`).
|
|
51
53
|
* The worker twin asks the gateway for each of them where its answer is exactly the lane's own cut (`types` as the
|
|
@@ -652,8 +654,9 @@ export function isWrunOptionPrintMarker(tuple) {
|
|
|
652
654
|
* answers. The live fold applies it after every drain, so a live bar never outgrows the cut its history was read under
|
|
653
655
|
* (Flow Tape's day bar held the newest 3,000 prints from history, then every live print of the day on top, past its
|
|
654
656
|
* `max_cells`). A bar the cut empties keeps its row, empty or, when it was partial, the marker; a marker is no print.
|
|
655
|
-
* No newest cut, or `overflow: "largest"` (
|
|
656
|
-
*
|
|
657
|
+
* No newest cut, or `overflow: "largest"` (the projection makes the cut there, each bar's largest unioned with the
|
|
658
|
+
* window's newest over every print the rows hold, `wrunLargestOrNewestOptionPrints`, again on every run): the rows as
|
|
659
|
+
* they are (copied).
|
|
657
660
|
*/
|
|
658
661
|
export function wrunNewestOptionPrintRows(rows, acquisition) {
|
|
659
662
|
const newest = acquisition.newest;
|
|
@@ -744,6 +747,25 @@ export function forEachWrunOptionPrintTuple(row, visit) {
|
|
|
744
747
|
}
|
|
745
748
|
}
|
|
746
749
|
}
|
|
750
|
+
/** The indexes of the `count` prints with the largest premium (an equal premium keeps the earlier print; a non-finite
|
|
751
|
+
* premium ranks last), ascending. */
|
|
752
|
+
function largestPremiumIndexes(tuples, count) {
|
|
753
|
+
const premium = (at) => {
|
|
754
|
+
const value = tuples[at][WRUN_OPTION_PRINT_COLUMN.premium];
|
|
755
|
+
return Number.isFinite(value) ? value : Number.NEGATIVE_INFINITY;
|
|
756
|
+
};
|
|
757
|
+
const ranked = tuples.map((_, at) => at).sort((a, b) => premium(b) - premium(a) || a - b);
|
|
758
|
+
return ranked.slice(0, count).sort((a, b) => a - b);
|
|
759
|
+
}
|
|
760
|
+
/** The kept prints of a bar, copied in the order given, bit 14 set on the FIRST one's `present` so the module reads
|
|
761
|
+
* the bar as partial. */
|
|
762
|
+
function partialPrintsAt(tuples, kept) {
|
|
763
|
+
const out = kept.map((at) => [...tuples[at]]);
|
|
764
|
+
if (out.length > 0) {
|
|
765
|
+
out[0][WRUN_OPTION_PRINT_COLUMN.present] = wrunPresentWithPartial(out[0][WRUN_OPTION_PRINT_COLUMN.present]);
|
|
766
|
+
}
|
|
767
|
+
return out;
|
|
768
|
+
}
|
|
747
769
|
/**
|
|
748
770
|
* `overflow: "largest"` over a bar over its bound (om's packer rule, wrun-host/pack.ts `wrunLargestPremiumBlock`):
|
|
749
771
|
* the `maxCells` prints with the largest premium (an equal premium keeps the earlier print; a non-finite premium
|
|
@@ -754,15 +776,60 @@ export function wrunLargestPremiumPrints(tuples, maxCells) {
|
|
|
754
776
|
const bound = Math.max(0, Math.floor(maxCells));
|
|
755
777
|
if (tuples.length <= bound)
|
|
756
778
|
return tuples;
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
779
|
+
return partialPrintsAt(tuples, largestPremiumIndexes(tuples, bound));
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* The bound of the window's newest cut over every bar an instance holds (`WrunNewestOptionPrintBound`), or undefined
|
|
783
|
+
* when they hold fewer than `newest` prints (every print is inside the cut). A partial bar's marker is no print. The
|
|
784
|
+
* bound is the same over the gateway's union answer, today's whole download and either one merged with live prints: each
|
|
785
|
+
* holds the window's `newest` newest prints whole.
|
|
786
|
+
*/
|
|
787
|
+
export function wrunNewestOptionPrintBound(bars, newest) {
|
|
788
|
+
if (!(newest >= 1))
|
|
789
|
+
return undefined;
|
|
790
|
+
const C = WRUN_OPTION_PRINT_COLUMN;
|
|
791
|
+
const prints = [];
|
|
792
|
+
for (const { openMs, tuples } of bars) {
|
|
793
|
+
for (const tuple of tuples) {
|
|
794
|
+
if (!isWrunOptionPrintMarker(tuple)) {
|
|
795
|
+
prints.push({ atMs: openMs + tuple[C.offset], key: tuple[C.key], barOpenMs: openMs });
|
|
796
|
+
}
|
|
797
|
+
}
|
|
766
798
|
}
|
|
767
|
-
|
|
799
|
+
if (prints.length < newest)
|
|
800
|
+
return undefined;
|
|
801
|
+
prints.sort((a, b) => b.atMs - a.atMs || b.key - a.key);
|
|
802
|
+
return prints[Math.floor(newest) - 1];
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* One bar's prints under `overflow: "largest"` beside the window's newest cut (the union, the SDK's frozen contract):
|
|
806
|
+
* its `maxCells` largest (`wrunLargestPremiumPrints`' order) and every print inside the cut (`bound`, from
|
|
807
|
+
* `wrunNewestOptionPrintBound`), each once, in the order given. So a block holds at most `maxCells` plus the cut's
|
|
808
|
+
* count, the read's capacity for the input (wrun-cell-capacity.leaf `wrunCellReadCapacity`), which a module holds whole
|
|
809
|
+
* only when its sheet's `capacity` does (`wrunCellBlockTuples`).
|
|
810
|
+
*
|
|
811
|
+
* Bit 14 on the first kept print, by a rule every answer reads alike (the gateway's union answer, today's whole
|
|
812
|
+
* download, either one merged with live prints), so the cells never depend on the path: a bar older than the bar
|
|
813
|
+
* holding the bound, past `maxCells` prints (none of its prints is newest: its largest alone, as without the cut); and
|
|
814
|
+
* the bar holding the bound, past `maxCells` prints, even when nothing it holds is left out (the gateway answers its
|
|
815
|
+
* largest and its prints inside the cut, so whether an older and smaller print was left out cannot be told there). A bar
|
|
816
|
+
* newer than that one holds only prints inside the cut, and with no bound (fewer than `newest` prints in the window)
|
|
817
|
+
* every bar holds every print, unmarked.
|
|
818
|
+
*/
|
|
819
|
+
export function wrunLargestOrNewestOptionPrints(tuples, barOpenMs, maxCells, bound) {
|
|
820
|
+
if (bound === undefined || barOpenMs > bound.barOpenMs)
|
|
821
|
+
return tuples;
|
|
822
|
+
if (barOpenMs < bound.barOpenMs)
|
|
823
|
+
return wrunLargestPremiumPrints(tuples, maxCells);
|
|
824
|
+
const largest = Math.max(0, Math.floor(maxCells));
|
|
825
|
+
if (tuples.length <= largest)
|
|
826
|
+
return tuples;
|
|
827
|
+
const C = WRUN_OPTION_PRINT_COLUMN;
|
|
828
|
+
const kept = new Set(largestPremiumIndexes(tuples, largest));
|
|
829
|
+
tuples.forEach((tuple, at) => {
|
|
830
|
+
const atMs = barOpenMs + tuple[C.offset];
|
|
831
|
+
if (atMs > bound.atMs || (atMs === bound.atMs && tuple[C.key] >= bound.key))
|
|
832
|
+
kept.add(at);
|
|
833
|
+
});
|
|
834
|
+
return partialPrintsAt(tuples, [...kept].sort((a, b) => a - b));
|
|
768
835
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LiveBucketVenue } from '../chart/live-bucket.util.js';
|
|
2
|
+
import { type WrunRowLaneContext, type WrunRowLaneDownloadChart, type WrunRowLaneSource } from './sources/wrun-row-lane.types.js';
|
|
3
|
+
/** The OPRA plane's delayed route, as the forecast reads it: the gate serves a read up to its now minus this
|
|
4
|
+
* (governed-route.util `servedDelaySecondsForAccess`, 15 minutes on OPRA), so a grouped read is cut at its grid's last
|
|
5
|
+
* boundary behind it and the rest is folded (k-option-strike-flow.worker.ts, the delayed tail). */
|
|
6
|
+
export declare const WRUN_OPTION_FLOW_DELAYED_FORECAST_MS: number;
|
|
7
|
+
/**
|
|
8
|
+
* The contract rows the worker is forecast to fold in the browser for one strike flow read over a window's host bars,
|
|
9
|
+
* before any fetch, by the worker's own choice (k-option-strike-flow.worker `streamHistoricalData`): every bar on a
|
|
10
|
+
* crypto chain (the grouped scopes sum every book of a coin), every bar of a grouping the gateway cannot draw on the
|
|
11
|
+
* chain's venue (`wrunOptionFlowGroupedRead` `host`, the worker's call: a Globex lattice bar off the UTC floor, a
|
|
12
|
+
* session span on a clock with no gateway session, a week), and on a delayed route (`servedTier` "delayed") the groups that end past the delayed bound (a session span's
|
|
13
|
+
* whole newest session, a bar grouping's bars ending past it). Projected by the fold plan's own rule (`projectedRows`,
|
|
14
|
+
* under the source answer budget one fold read keeps today). 0 when the data plane groups the whole window. Under
|
|
15
|
+
* `history` "today" only today's bars count (the acquisition's `todayFromMs`, else the newest bar's trade date on the
|
|
16
|
+
* chain's clock).
|
|
17
|
+
*/
|
|
18
|
+
export declare function wrunOptionStrikeFlowFoldForecastRows(args: {
|
|
19
|
+
acquisition: Readonly<Record<string, unknown>>;
|
|
20
|
+
barOpens: readonly number[];
|
|
21
|
+
barMs: number;
|
|
22
|
+
barGrid: LiveBucketVenue | undefined;
|
|
23
|
+
nowMs: number;
|
|
24
|
+
}): number;
|
|
25
|
+
/**
|
|
26
|
+
* The lane's `download.forecastBytes` (row-lanes/option_strike_flow.ts): a read of one input (its declaration, its
|
|
27
|
+
* setting-bound knobs read) on the chart's chain, priced at the forecast fold's contract rows of 21 values; undefined
|
|
28
|
+
* when the data plane groups the window, so the kit's projection of the declared read holds. A knob its rules refuse
|
|
29
|
+
* throws by name (the run's plan prices nothing for it; the lane's plan refuses the input).
|
|
30
|
+
*/
|
|
31
|
+
export declare function wrunOptionStrikeFlowForecastBytes(source: WrunRowLaneSource, ctx: WrunRowLaneContext, chart: WrunRowLaneDownloadChart): number | undefined;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FE-FOLD-CAP (OPTLOAD wave 3, an amendment to the download budget's unit R2; UW-PARITY/reports/OPTLOAD-W3/
|
|
3
|
+
* strike-family-design.md "Unit FE-FOLD-CAP"): what an `option_strike_flow` read is forecast to download where the
|
|
4
|
+
* worker folds it from the chain's contract rows in the browser, which no declaration says (the kit charges the grouped
|
|
5
|
+
* read it declares: Premium by Expiry on ES1! 1h, 2.30 MB declared, 12.90 MB measured). The run's download plan prices
|
|
6
|
+
* the read at the fold before any fetch (wrun-download-plan.util, the lane's `download.forecastBytes`), so a fold puts
|
|
7
|
+
* the run in budgeted mode and its asks name the rows their share buys (`foldBudgetRows`).
|
|
8
|
+
*
|
|
9
|
+
* Loaded by the lane on a run with the download budget's flag on, never at boot (the strike flow util rides the boot
|
|
10
|
+
* path through its K control; this module does not).
|
|
11
|
+
*/
|
|
12
|
+
import { KSCRIPT_SOURCE_CELL_BYTES } from '../chart/kscript-source-answer-budget.leaf.js';
|
|
13
|
+
import { optionTodayStartMsByClock, optionTradeDayByClock } from '../options/option-trade-date.util.js';
|
|
14
|
+
import { wrunLaneChainPlaneOf, } from './sources/wrun-row-lane.types.js';
|
|
15
|
+
import { WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD, WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH, } from './wrun-option-contract-flow.util.js';
|
|
16
|
+
import { WRUN_OPTION_STRIKE_FLOW_SCOPE, WRUN_OPTION_STRIKE_FLOW_TIERS, wrunOptionFlowClockOf, wrunOptionFlowGroupedRead, wrunOptionStrikeFlowAcquisitionOf, wrunOptionStrikeFlowFoldPlan, wrunOptionStrikeFlowKnobsOf, wrunOptionStrikeFlowSessionTierOf, } from './wrun-option-strike-flow.util.js';
|
|
17
|
+
import { wrunHostBarSpanOf } from './wrun-tier-grid.util.js';
|
|
18
|
+
const MINUTE_MS = 60_000;
|
|
19
|
+
/** The OPRA plane's delayed route, as the forecast reads it: the gate serves a read up to its now minus this
|
|
20
|
+
* (governed-route.util `servedDelaySecondsForAccess`, 15 minutes on OPRA), so a grouped read is cut at its grid's last
|
|
21
|
+
* boundary behind it and the rest is folded (k-option-strike-flow.worker.ts, the delayed tail). */
|
|
22
|
+
export const WRUN_OPTION_FLOW_DELAYED_FORECAST_MS = 15 * MINUTE_MS;
|
|
23
|
+
/**
|
|
24
|
+
* The contract rows the worker is forecast to fold in the browser for one strike flow read over a window's host bars,
|
|
25
|
+
* before any fetch, by the worker's own choice (k-option-strike-flow.worker `streamHistoricalData`): every bar on a
|
|
26
|
+
* crypto chain (the grouped scopes sum every book of a coin), every bar of a grouping the gateway cannot draw on the
|
|
27
|
+
* chain's venue (`wrunOptionFlowGroupedRead` `host`, the worker's call: a Globex lattice bar off the UTC floor, a
|
|
28
|
+
* session span on a clock with no gateway session, a week), and on a delayed route (`servedTier` "delayed") the groups that end past the delayed bound (a session span's
|
|
29
|
+
* whole newest session, a bar grouping's bars ending past it). Projected by the fold plan's own rule (`projectedRows`,
|
|
30
|
+
* under the source answer budget one fold read keeps today). 0 when the data plane groups the whole window. Under
|
|
31
|
+
* `history` "today" only today's bars count (the acquisition's `todayFromMs`, else the newest bar's trade date on the
|
|
32
|
+
* chain's clock).
|
|
33
|
+
*/
|
|
34
|
+
export function wrunOptionStrikeFlowFoldForecastRows(args) {
|
|
35
|
+
const { barMs, barGrid, nowMs } = args;
|
|
36
|
+
const acquisition = wrunOptionStrikeFlowAcquisitionOf(args.acquisition);
|
|
37
|
+
if (args.barOpens.length === 0 || !(barMs > 0) || acquisition.exchange === '')
|
|
38
|
+
return 0;
|
|
39
|
+
const clock = wrunOptionFlowClockOf(acquisition);
|
|
40
|
+
const newest = args.barOpens[args.barOpens.length - 1];
|
|
41
|
+
const todayFromMs = acquisition.history !== 'today'
|
|
42
|
+
? undefined
|
|
43
|
+
: (acquisition.todayFromMs ?? optionTodayStartMsByClock(clock, { openMs: newest, endMs: newest + barMs }));
|
|
44
|
+
const dayOf = (open) => optionTradeDayByClock(clock, open + Math.floor(barMs / 2));
|
|
45
|
+
const spanOf = (open) => wrunHostBarSpanOf(open, barMs, barGrid ?? null);
|
|
46
|
+
const bars = args.barOpens.filter((open) => todayFromMs === undefined || spanOf(open).toMs > todayFromMs);
|
|
47
|
+
if (bars.length === 0)
|
|
48
|
+
return 0;
|
|
49
|
+
// The tier the lane asks a bar at (its coarsest that fits), the window on its grid; then the worker's own choice
|
|
50
|
+
// (k-option-strike-flow.worker): the anchors the chain's venue and the group's scope take, at that tier or the
|
|
51
|
+
// coarsest finer one the anchor takes (a CME regular-hours hour groups on CME_RTH from 5 minutes).
|
|
52
|
+
const tiers = WRUN_OPTION_STRIKE_FLOW_TIERS[acquisition.group];
|
|
53
|
+
const tier = [...tiers].reverse().find((candidate) => barMs % candidate.ms === 0) ?? tiers[0];
|
|
54
|
+
const fromMs = spanOf(bars[0]).fromMs;
|
|
55
|
+
const toMs = spanOf(bars[bars.length - 1]).toMs;
|
|
56
|
+
const session = acquisition.span === 'session';
|
|
57
|
+
const { grouping } = wrunOptionFlowGroupedRead({
|
|
58
|
+
barMs,
|
|
59
|
+
barGrid,
|
|
60
|
+
fromMs: fromMs - (fromMs % tier.ms),
|
|
61
|
+
toMs: toMs % tier.ms === 0 ? toMs : toMs - (toMs % tier.ms) + tier.ms,
|
|
62
|
+
session,
|
|
63
|
+
clock,
|
|
64
|
+
exchange: acquisition.exchange,
|
|
65
|
+
read: WRUN_OPTION_STRIKE_FLOW_SCOPE[acquisition.group].read,
|
|
66
|
+
askTier: tier,
|
|
67
|
+
tiers,
|
|
68
|
+
sessionTier: wrunOptionStrikeFlowSessionTierOf(acquisition.group),
|
|
69
|
+
nowMs,
|
|
70
|
+
});
|
|
71
|
+
let folded;
|
|
72
|
+
if (wrunLaneChainPlaneOf(acquisition.exchange) === 'plain' || grouping.kind === 'host') {
|
|
73
|
+
folded = bars;
|
|
74
|
+
}
|
|
75
|
+
else if (args.acquisition.servedTier !== 'delayed') {
|
|
76
|
+
folded = [];
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const boundMs = nowMs - WRUN_OPTION_FLOW_DELAYED_FORECAST_MS;
|
|
80
|
+
// A session straddling the bound is folded whole; a bar grouping folds the bars ending past it.
|
|
81
|
+
const newestDay = dayOf(newest);
|
|
82
|
+
folded = session
|
|
83
|
+
? spanOf(newest).toMs > boundMs
|
|
84
|
+
? bars.filter((open) => dayOf(open) === newestDay)
|
|
85
|
+
: []
|
|
86
|
+
: bars.filter((open) => spanOf(open).toMs > boundMs);
|
|
87
|
+
}
|
|
88
|
+
if (folded.length === 0)
|
|
89
|
+
return 0;
|
|
90
|
+
return wrunOptionStrikeFlowFoldPlan({
|
|
91
|
+
barOpens: folded,
|
|
92
|
+
newerBarOpens: [],
|
|
93
|
+
barMs,
|
|
94
|
+
barGrid,
|
|
95
|
+
nowMs,
|
|
96
|
+
acquisition: args.acquisition,
|
|
97
|
+
}).projectedRows;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The lane's `download.forecastBytes` (row-lanes/option_strike_flow.ts): a read of one input (its declaration, its
|
|
101
|
+
* setting-bound knobs read) on the chart's chain, priced at the forecast fold's contract rows of 21 values; undefined
|
|
102
|
+
* when the data plane groups the window, so the kit's projection of the declared read holds. A knob its rules refuse
|
|
103
|
+
* throws by name (the run's plan prices nothing for it; the lane's plan refuses the input).
|
|
104
|
+
*/
|
|
105
|
+
export function wrunOptionStrikeFlowForecastBytes(source, ctx, chart) {
|
|
106
|
+
const rows = wrunOptionStrikeFlowFoldForecastRows({
|
|
107
|
+
acquisition: {
|
|
108
|
+
...wrunOptionStrikeFlowKnobsOf(source, ctx),
|
|
109
|
+
coin: chart.coin,
|
|
110
|
+
[WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD]: chart.chainExchange,
|
|
111
|
+
...(chart.servedTier !== undefined ? { servedTier: chart.servedTier } : {}),
|
|
112
|
+
},
|
|
113
|
+
barOpens: chart.barOpens,
|
|
114
|
+
barMs: chart.intervalMs,
|
|
115
|
+
barGrid: chart.barGrid ?? undefined,
|
|
116
|
+
nowMs: chart.nowMs,
|
|
117
|
+
});
|
|
118
|
+
return rows > 0 ? rows * WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH * KSCRIPT_SOURCE_CELL_BYTES : undefined;
|
|
119
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { WrunBackendTier } from './wrun-tier-grid.util.js';
|
|
2
2
|
/** The class, its lane key and its K type word (om `WRUN_OPTION_FETCH_TYPES.option_strike_flow`). */
|
|
3
3
|
export declare const WRUN_OPTION_STRIKE_FLOW_CLASS = "option_strike_flow";
|
|
4
|
+
/** The ask field a budgeted run names a browser fold's contract-row cap in (FE-FOLD-CAP, OPTLOAD W3 under R2's flag;
|
|
5
|
+
* wrun-row-lanes.util `download.fold`, the worker's `wrunOptionStrikeFlowFoldPlan` `budgetRows`). */
|
|
6
|
+
export declare const WRUN_OPTION_STRIKE_FLOW_FOLD_BUDGET_FIELD = "foldBudgetRows";
|
|
4
7
|
/** f64s per tuple, the `present` mask included (om `WRUN_OPTION_TUPLE_WIDTHS.option_strike_flow`). */
|
|
5
8
|
export declare const WRUN_OPTION_STRIKE_FLOW_WIDTH = 15;
|
|
6
9
|
/** The tuple's columns (om `WRUN_OPTION_CELL_COLUMNS.option_strike_flow`). */
|
|
@@ -41,6 +44,9 @@ export type WrunOptionStrikeFlowExpiries = {
|
|
|
41
44
|
kind: 'nearest';
|
|
42
45
|
count: number;
|
|
43
46
|
};
|
|
47
|
+
/** The `expiries` words a setting picks (om `WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS`, kit 0.96.0: a select whose
|
|
48
|
+
* `style_values` are these words): every word but "nearest:N", whose count no choice carries. */
|
|
49
|
+
export declare const WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS: readonly ["all", "0dte", "after_today"];
|
|
44
50
|
/** An `expiries` word as this class reads it (absent is "all"), or undefined for a word outside them. */
|
|
45
51
|
export declare function wrunOptionStrikeFlowExpiriesOf(value: unknown): WrunOptionStrikeFlowExpiries | undefined;
|
|
46
52
|
/** One input's knobs, canonical: each absent at its default (one acquisition for equal reads). */
|
|
@@ -66,19 +72,33 @@ export declare function wrunOptionStrikeFlowHorizon(extras: Readonly<Record<stri
|
|
|
66
72
|
servedFromMs: number;
|
|
67
73
|
completeFromMs: number;
|
|
68
74
|
} | undefined;
|
|
69
|
-
/** The tuples one SPY bar of a group holds (one 30-minute session of 13 bars measured 2026-10-19): STRIKE 357
|
|
70
|
-
* the 0DTE split), EXPIRY 75, the per-(expiry, strike) rows 2,326; 33 traded expiries
|
|
75
|
+
/** The tuples one SPY bar of a group holds (one 30-minute session of 13 bars measured 2026-10-19, `barMs`): STRIKE 357
|
|
76
|
+
* (471 with the 0DTE split), EXPIRY 75, the per-(expiry, strike) rows 2,326; 33 traded expiries; every chain. */
|
|
71
77
|
export declare const WRUN_OPTION_STRIKE_FLOW_BAR_TUPLES: Readonly<{
|
|
72
78
|
strike: 357;
|
|
73
79
|
strikeSplit: 471;
|
|
74
80
|
expiry: 75;
|
|
75
81
|
expiryStrike: 2326;
|
|
76
82
|
expiries: 33;
|
|
83
|
+
barMs: number;
|
|
77
84
|
}>;
|
|
78
|
-
/** The
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
*
|
|
85
|
+
/** The share of a measured bar's tuples a bar `barMs` wide holds, 1 from 30 minutes up: a bar's distinct contracts grow
|
|
86
|
+
* slower than its width, as the contract rows one SPY bucket holds at the 1m, 5m and 1h tiers say
|
|
87
|
+
* (`WRUN_OPTION_CONTRACT_FLOW_SESSION_ROWS`: 647, 1,395 and 4,148), read on the log-log line between neighbouring
|
|
88
|
+
* tiers: a 5-minute bar 0.46, a 1-minute bar 0.21, where a straight sixth and thirtieth under-projected them. */
|
|
89
|
+
export declare function wrunOptionStrikeFlowBarShare(barMs: number): number;
|
|
90
|
+
/** The tuples a bar `barMs` wide of one acquisition is projected to hold, from its knobs over SPY's measured bars at
|
|
91
|
+
* its share of them (`wrunOptionStrikeFlowBarShare`). One width for all kept a 5-minute Strike Footprint to its newest
|
|
92
|
+
* 30 bars. The row budget's proxy, which the host raises to what the lane's reads measured. */
|
|
93
|
+
export declare function wrunOptionStrikeFlowTuplesPerBar(acquisition: Readonly<Record<string, unknown>>, barMs?: number): number;
|
|
94
|
+
/** The facets' `maxCells`: the package's most `max_cells` of the class (tuples, `WrunRowLanePlanFacts.laneMaxCells`)
|
|
95
|
+
* where it is under the knobs' projection. A bar past it refuses the run, so no bar is projected past it. */
|
|
96
|
+
export declare function wrunOptionStrikeFlowMaxCellsField(acquisition: Readonly<Record<string, unknown>>, laneMaxCells: unknown): {
|
|
97
|
+
maxCells?: number;
|
|
98
|
+
};
|
|
99
|
+
/** The rows one host bar is projected to read (the lane's row budget; wrun-row-lanes.util `wrunRowLaneProjectedBarRows`
|
|
100
|
+
* raises it to what its reads measured): its projected tuples at its width, at most the acquisition's `maxCells`, none
|
|
101
|
+
* for a bar before today's first instant as the acquisition names it under `history` "today" (it reads nothing;
|
|
82
102
|
* wrun-option-contract-flow.util `wrunOptionFlowBarBeforeToday`, never dated off `nowMs`). */
|
|
83
103
|
export declare function wrunOptionStrikeFlowBarRows(bar: {
|
|
84
104
|
openMs: number;
|
|
@@ -7,12 +7,15 @@
|
|
|
7
7
|
* (tests/utility/wrun/sources/option_strike_flow.boot-path.spec.ts). The class: docs/features/kscript/wrun/
|
|
8
8
|
* wrun-browser-runtime.md.
|
|
9
9
|
*/
|
|
10
|
-
import { wrunOptionFlowBarBeforeToday } from './wrun-option-contract-flow.util.js';
|
|
10
|
+
import { WRUN_OPTION_CONTRACT_FLOW_SESSION_ROWS, wrunOptionFlowBarBeforeToday } from './wrun-option-contract-flow.util.js';
|
|
11
11
|
import { wrunPresentIsPartial, wrunPresentWithPartial } from './wrun-present-bits.util.js';
|
|
12
12
|
const MINUTE_MS = 60_000;
|
|
13
13
|
const DAY_MS = 86_400_000;
|
|
14
14
|
/** The class, its lane key and its K type word (om `WRUN_OPTION_FETCH_TYPES.option_strike_flow`). */
|
|
15
15
|
export const WRUN_OPTION_STRIKE_FLOW_CLASS = 'option_strike_flow';
|
|
16
|
+
/** The ask field a budgeted run names a browser fold's contract-row cap in (FE-FOLD-CAP, OPTLOAD W3 under R2's flag;
|
|
17
|
+
* wrun-row-lanes.util `download.fold`, the worker's `wrunOptionStrikeFlowFoldPlan` `budgetRows`). */
|
|
18
|
+
export const WRUN_OPTION_STRIKE_FLOW_FOLD_BUDGET_FIELD = 'foldBudgetRows';
|
|
16
19
|
/** f64s per tuple, the `present` mask included (om `WRUN_OPTION_TUPLE_WIDTHS.option_strike_flow`). */
|
|
17
20
|
export const WRUN_OPTION_STRIKE_FLOW_WIDTH = 15;
|
|
18
21
|
/** The tuple's columns (om `WRUN_OPTION_CELL_COLUMNS.option_strike_flow`). */
|
|
@@ -58,6 +61,9 @@ export const WRUN_OPTION_STRIKE_FLOW_TIERS = Object.freeze({
|
|
|
58
61
|
]),
|
|
59
62
|
});
|
|
60
63
|
const NEAREST_RE = /^nearest:([1-9]\d{0,2})$/;
|
|
64
|
+
/** The `expiries` words a setting picks (om `WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS`, kit 0.96.0: a select whose
|
|
65
|
+
* `style_values` are these words): every word but "nearest:N", whose count no choice carries. */
|
|
66
|
+
export const WRUN_OPTION_STRIKE_FLOW_EXPIRIES_WORDS = Object.freeze(['all', '0dte', 'after_today']);
|
|
61
67
|
/** An `expiries` word as this class reads it (absent is "all"), or undefined for a word outside them. */
|
|
62
68
|
export function wrunOptionStrikeFlowExpiriesOf(value) {
|
|
63
69
|
if (value === undefined || value === 'all')
|
|
@@ -107,19 +113,40 @@ export function wrunOptionStrikeFlowHorizon(extras, nowMs) {
|
|
|
107
113
|
return undefined;
|
|
108
114
|
return { servedFromMs: nowMs - reach, completeFromMs: nowMs - reach };
|
|
109
115
|
}
|
|
110
|
-
/** The tuples one SPY bar of a group holds (one 30-minute session of 13 bars measured 2026-10-19): STRIKE 357
|
|
111
|
-
* the 0DTE split), EXPIRY 75, the per-(expiry, strike) rows 2,326; 33 traded expiries
|
|
116
|
+
/** The tuples one SPY bar of a group holds (one 30-minute session of 13 bars measured 2026-10-19, `barMs`): STRIKE 357
|
|
117
|
+
* (471 with the 0DTE split), EXPIRY 75, the per-(expiry, strike) rows 2,326; 33 traded expiries; every chain. */
|
|
112
118
|
export const WRUN_OPTION_STRIKE_FLOW_BAR_TUPLES = Object.freeze({
|
|
113
119
|
strike: 357,
|
|
114
120
|
strikeSplit: 471,
|
|
115
121
|
expiry: 75,
|
|
116
122
|
expiryStrike: 2_326,
|
|
117
123
|
expiries: 33,
|
|
124
|
+
barMs: 30 * MINUTE_MS,
|
|
118
125
|
});
|
|
119
|
-
/** The
|
|
120
|
-
|
|
126
|
+
/** The share of a measured bar's tuples a bar `barMs` wide holds, 1 from 30 minutes up: a bar's distinct contracts grow
|
|
127
|
+
* slower than its width, as the contract rows one SPY bucket holds at the 1m, 5m and 1h tiers say
|
|
128
|
+
* (`WRUN_OPTION_CONTRACT_FLOW_SESSION_ROWS`: 647, 1,395 and 4,148), read on the log-log line between neighbouring
|
|
129
|
+
* tiers: a 5-minute bar 0.46, a 1-minute bar 0.21, where a straight sixth and thirtieth under-projected them. */
|
|
130
|
+
export function wrunOptionStrikeFlowBarShare(barMs) {
|
|
131
|
+
const measured = WRUN_OPTION_STRIKE_FLOW_BAR_TUPLES.barMs / MINUTE_MS;
|
|
132
|
+
const minutes = barMs / MINUTE_MS;
|
|
133
|
+
if (!(minutes > 0 && minutes < measured))
|
|
134
|
+
return 1;
|
|
135
|
+
const R = WRUN_OPTION_CONTRACT_FLOW_SESSION_ROWS;
|
|
136
|
+
// A bucket's rows, in proportion: its tier's rows a session times its minutes.
|
|
137
|
+
const rowsAt = (m) => {
|
|
138
|
+
const [m0, r0, m1, r1] = m < 5 ? [1, R['1m'], 5, 5 * R['5m']] : [5, 5 * R['5m'], 60, 60 * R['1h']];
|
|
139
|
+
return r0 * (m / m0) ** (Math.log(r1 / r0) / Math.log(m1 / m0));
|
|
140
|
+
};
|
|
141
|
+
return rowsAt(Math.max(1, minutes)) / rowsAt(measured);
|
|
142
|
+
}
|
|
143
|
+
/** The tuples a bar `barMs` wide of one acquisition is projected to hold, from its knobs over SPY's measured bars at
|
|
144
|
+
* its share of them (`wrunOptionStrikeFlowBarShare`). One width for all kept a 5-minute Strike Footprint to its newest
|
|
145
|
+
* 30 bars. The row budget's proxy, which the host raises to what the lane's reads measured. */
|
|
146
|
+
export function wrunOptionStrikeFlowTuplesPerBar(acquisition, barMs = WRUN_OPTION_STRIKE_FLOW_BAR_TUPLES.barMs) {
|
|
121
147
|
const knobs = wrunOptionStrikeFlowPayloadKnobsOf(acquisition);
|
|
122
148
|
const T = WRUN_OPTION_STRIKE_FLOW_BAR_TUPLES;
|
|
149
|
+
const share = wrunOptionStrikeFlowBarShare(barMs);
|
|
123
150
|
const sides = knobs.foldTypes ? 1 : 2;
|
|
124
151
|
const parts = knobs.splitDte ? 2 : 1;
|
|
125
152
|
const nearest = wrunOptionStrikeFlowExpiriesOf(knobs.expiries);
|
|
@@ -127,26 +154,38 @@ export function wrunOptionStrikeFlowTuplesPerBar(acquisition) {
|
|
|
127
154
|
const windowShare = knobs.strikeWindowPct !== undefined ? Math.min(1, knobs.strikeWindowPct / 25) : 1;
|
|
128
155
|
switch (knobs.group) {
|
|
129
156
|
case 'expiry':
|
|
130
|
-
return Math.ceil(T.expiry * expiryShare);
|
|
157
|
+
return Math.ceil(T.expiry * expiryShare * share);
|
|
131
158
|
case 'expiry_strike': {
|
|
132
|
-
const cells = T.expiryStrike * expiryShare * windowShare;
|
|
159
|
+
const cells = T.expiryStrike * expiryShare * windowShare * share;
|
|
133
160
|
const rows = knobs.strikeRows !== undefined ? knobs.strikeRows * 2 * Math.ceil(T.expiries * expiryShare) : Infinity;
|
|
134
161
|
return Math.ceil(Math.min(cells, rows));
|
|
135
162
|
}
|
|
136
163
|
default: {
|
|
137
164
|
const all = ((knobs.splitDte ? T.strikeSplit : T.strike) * sides) / 2;
|
|
138
165
|
const rows = knobs.strikeRows !== undefined ? knobs.strikeRows * sides * parts : Infinity;
|
|
139
|
-
return Math.ceil(Math.min(all * windowShare, rows));
|
|
166
|
+
return Math.ceil(Math.min(all * windowShare * share, rows));
|
|
140
167
|
}
|
|
141
168
|
}
|
|
142
169
|
}
|
|
143
|
-
/** The
|
|
144
|
-
*
|
|
170
|
+
/** The facets' `maxCells`: the package's most `max_cells` of the class (tuples, `WrunRowLanePlanFacts.laneMaxCells`)
|
|
171
|
+
* where it is under the knobs' projection. A bar past it refuses the run, so no bar is projected past it. */
|
|
172
|
+
export function wrunOptionStrikeFlowMaxCellsField(acquisition, laneMaxCells) {
|
|
173
|
+
return typeof laneMaxCells === 'number' &&
|
|
174
|
+
laneMaxCells >= 1 &&
|
|
175
|
+
laneMaxCells < wrunOptionStrikeFlowTuplesPerBar(acquisition)
|
|
176
|
+
? { maxCells: laneMaxCells }
|
|
177
|
+
: {};
|
|
178
|
+
}
|
|
179
|
+
/** The rows one host bar is projected to read (the lane's row budget; wrun-row-lanes.util `wrunRowLaneProjectedBarRows`
|
|
180
|
+
* raises it to what its reads measured): its projected tuples at its width, at most the acquisition's `maxCells`, none
|
|
181
|
+
* for a bar before today's first instant as the acquisition names it under `history` "today" (it reads nothing;
|
|
145
182
|
* wrun-option-contract-flow.util `wrunOptionFlowBarBeforeToday`, never dated off `nowMs`). */
|
|
146
183
|
export function wrunOptionStrikeFlowBarRows(bar, _nowMs, acquisition) {
|
|
147
184
|
if (wrunOptionFlowBarBeforeToday(bar, acquisition))
|
|
148
185
|
return 0;
|
|
149
|
-
|
|
186
|
+
const tuples = wrunOptionStrikeFlowTuplesPerBar(acquisition, bar.endMs - bar.openMs);
|
|
187
|
+
const most = acquisition.maxCells;
|
|
188
|
+
return typeof most === 'number' && most >= 1 ? Math.min(tuples, most) : tuples;
|
|
150
189
|
}
|
|
151
190
|
/** Every finite tuple a host bar row's cells hold, in order: a packed block's tuples back to back, a plain tuple as it
|
|
152
191
|
* is. A cell of another shape, and a tuple holding a value that is not finite, is skipped. */
|