@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type LiveBucketVenue } from '../chart/live-bucket.util.js';
|
|
2
|
+
import { type OptionBarAnchorRead } from '../options/option-bar-anchor.util.js';
|
|
2
3
|
import { type OptionTradeDateChain, type OptionTradeDateClockRule } from '../options/option-trade-date.util.js';
|
|
3
4
|
import { type WrunOptionContractFlowRow } from './wrun-option-contract-flow.util.js';
|
|
4
5
|
import { type WrunOptionStrikeFlowGroup, type WrunOptionStrikeFlowKnobs } from './wrun-option-strike-flow-lane.util.js';
|
|
@@ -14,16 +15,21 @@ export declare const WRUN_OPTION_STRIKE_FLOW_DTE_CLASS: Readonly<{
|
|
|
14
15
|
}>;
|
|
15
16
|
/** `strike_rows`: 1 to 200 (om `WRUN_OPTION_STRIKE_ROWS_MAX`). */
|
|
16
17
|
export declare const WRUN_OPTION_STRIKE_ROWS_MAX = 200;
|
|
17
|
-
/** The scope word of each group (pb-common `OptionPrintAggScope` STRIKE 5, EXPIRY 6, EXPIRY_STRIKE 7)
|
|
18
|
+
/** The scope word of each group (pb-common `OptionPrintAggScope` STRIKE 5, EXPIRY 6, EXPIRY_STRIKE 7) and the read its
|
|
19
|
+
* grouped ask is, as the gateway registers the anchors it takes (option-bar-anchor.util). */
|
|
18
20
|
export declare const WRUN_OPTION_STRIKE_FLOW_SCOPE: Readonly<Record<WrunOptionStrikeFlowGroup, {
|
|
19
21
|
word: string;
|
|
20
22
|
id: number;
|
|
23
|
+
read: OptionBarAnchorRead;
|
|
21
24
|
}>>;
|
|
22
|
-
/** pb-common enums the request names by number (the gateway decodes JSON with encoding/json): `BarAnchor
|
|
23
|
-
* `OptionExpiryClass`, `OptionDteBucket`, `OptionType`. */
|
|
25
|
+
/** pb-common enums the request names by number (the gateway decodes JSON with encoding/json): `BarAnchor` (the anchor
|
|
26
|
+
* mirror's values, option-bar-anchor.util), `BarSpan`, `OptionExpiryClass`, `OptionDteBucket`, `OptionType`. */
|
|
24
27
|
export declare const WRUN_OPTION_READ_ENUM: Readonly<{
|
|
25
|
-
readonly anchorUtc:
|
|
26
|
-
readonly anchorUsEquityRth:
|
|
28
|
+
readonly anchorUtc: import("@orangecharts/orange-v2-pb-common").BarAnchor.UTC;
|
|
29
|
+
readonly anchorUsEquityRth: import("@orangecharts/orange-v2-pb-common").BarAnchor.US_EQUITY_RTH;
|
|
30
|
+
readonly anchorCmeSession: import("@orangecharts/orange-v2-pb-common").BarAnchor.CME_SESSION;
|
|
31
|
+
readonly anchorCmeRth: import("@orangecharts/orange-v2-pb-common").BarAnchor.CME_RTH;
|
|
32
|
+
readonly anchorCmeEnergyRth: import("@orangecharts/orange-v2-pb-common").BarAnchor.CME_ENERGY_RTH;
|
|
27
33
|
readonly spanSession: 1;
|
|
28
34
|
readonly expiryZeroDte: 1;
|
|
29
35
|
readonly expiryAfterToday: 2;
|
|
@@ -72,6 +78,9 @@ export interface WrunOptionStrikeFlowAcquisition extends WrunOptionStrikeFlowKno
|
|
|
72
78
|
/** Today's first instant as the request names it under `history` "today" (wrun-option-contract-flow.util
|
|
73
79
|
* `WRUN_OPTION_FLOW_TODAY_FIELD`: the K control's, off the chart's newest bar). */
|
|
74
80
|
todayFromMs?: number;
|
|
81
|
+
/** FE-FOLD-CAP (OPTLOAD W3, under R2's flag): the most contract rows the ask's browser fold reads, its share of the
|
|
82
|
+
* indicator's download budget (`WRUN_OPTION_STRIKE_FLOW_FOLD_BUDGET_FIELD`); absent, the source answer budget's. */
|
|
83
|
+
foldBudgetRows?: number;
|
|
75
84
|
}
|
|
76
85
|
/** The bars an ask names (both flow classes' K controls send them, option-flow-bars.util): the run's bar span and the
|
|
77
86
|
* chart's bar grid, each absent when the ask carries none. */
|
|
@@ -90,14 +99,18 @@ export declare function wrunOptionFlowClockOf(acquisition: {
|
|
|
90
99
|
coin: string;
|
|
91
100
|
}): OptionTradeDateClockRule;
|
|
92
101
|
/**
|
|
93
|
-
* How a read's rows group, on the gateway's bar rule (contract 3.2 and 3.4
|
|
102
|
+
* How a read's rows group, on the gateway's bar rule (contract 3.2 and 3.4: the anchor mirror, option-bar-anchor.util)
|
|
103
|
+
* or the chart's own landing:
|
|
94
104
|
* - `bars`: `barSeconds` on an anchor (UTC: `ts - ts % B`; US_EQUITY_RTH: the 09:30 New York lattice, buckets outside
|
|
95
|
-
* the cash session dropped
|
|
105
|
+
* the cash session dropped; CME_RTH and CME_ENERGY_RTH: a CME regular session's lattice, 09:30 to 16:15 or 09:00 to
|
|
106
|
+
* 14:30 New York, buckets outside it dropped), exactly the chart's bars;
|
|
96
107
|
* - `session`: one group per trade date: on a New York clock the regular session's (RTH buckets only, stamped at its
|
|
97
|
-
* 09:30 open), on a UTC clock the UTC date's (stamped 00:00Z)
|
|
108
|
+
* 09:30 open), on a UTC clock the UTC date's (stamped 00:00Z), on the Globex clock of a CME group venue the trade
|
|
109
|
+
* date's (CME_SESSION: every bucket of it, stamped at its 17:00 Chicago open, a weekday holiday's session booked to
|
|
110
|
+
* the next trade date);
|
|
98
111
|
* - `host`: the chart's own bars (`wrunHostBarOf`) or, with a session span on a clock the gateway draws no session
|
|
99
|
-
* for (a CME
|
|
100
|
-
* cannot draw, so they are folded in the browser.
|
|
112
|
+
* for (a CME crypto root's 16:00 roll, or a read naming no venue), the clock's trade dates stamped at each date's
|
|
113
|
+
* first instant: groups the gateway cannot draw, so they are folded in the browser.
|
|
101
114
|
*/
|
|
102
115
|
export type WrunOptionFlowGrouping = {
|
|
103
116
|
kind: 'bars';
|
|
@@ -111,13 +124,18 @@ export type WrunOptionFlowGrouping = {
|
|
|
111
124
|
session: boolean;
|
|
112
125
|
};
|
|
113
126
|
/**
|
|
114
|
-
* The grouping of one ask's window `[fromMs, toMs)` at a tier
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
127
|
+
* The grouping of one ask's window `[fromMs, toMs)` at a tier, from the anchors `read` takes on the read's venue
|
|
128
|
+
* (`exchange`, the chain's; a decider naming none is offered no CME anchor, as the gateway lays those over the CME
|
|
129
|
+
* group's rows alone): a session span groups by trade date (the anchor whose sessions are the clock's trade dates, from
|
|
130
|
+
* a tier its sessions fit), else a chart bar of a day reads its trade date's session where that session lands on it (a
|
|
131
|
+
* daily bar holding one New York regular session, the cash session's buckets alone, one UTC date, or one Globex trade
|
|
132
|
+
* date), else the chart's bars when the gateway's bars are exactly them (every tier bucket of the window lands on the
|
|
133
|
+
* host bar the gateway's bar opens on: the UTC floor; the 09:30 New York lattice of a regular-session stock chart's 45m
|
|
134
|
+
* to 12h bars, the tier dividing 30 minutes, a bucket outside the cash session reaching no bar on either side; a CME
|
|
135
|
+
* regular session's lattice on a regular-hours CME chart, the tier dividing that anchor's (15 minutes on CME_RTH, 30 on
|
|
136
|
+
* CME_ENERGY_RTH), the window on its boundaries, a bucket the anchor drops reaching no bar or falling where the chart's
|
|
137
|
+
* product holds no trading, option-bar-anchor.util `optionChartClosedAt`: a weekday product's weekend, never an
|
|
138
|
+
* always-on root's), else the chart's own bars, folded in the browser.
|
|
121
139
|
*/
|
|
122
140
|
export declare function wrunOptionFlowGrouping(args: {
|
|
123
141
|
barMs: number | undefined;
|
|
@@ -127,9 +145,75 @@ export declare function wrunOptionFlowGrouping(args: {
|
|
|
127
145
|
toMs: number;
|
|
128
146
|
session: boolean;
|
|
129
147
|
clock: OptionTradeDateClockRule;
|
|
148
|
+
/** The read's venue, the chain's exchange: every app caller names it (tests/utility/options/
|
|
149
|
+
* option-bar-anchor.class.spec.ts), so a CME chart's anchors reach every grouped read. */
|
|
150
|
+
exchange?: string;
|
|
151
|
+
/** The read the grouping is for (the strike scopes' when absent). */
|
|
152
|
+
read?: OptionBarAnchorRead;
|
|
130
153
|
}): WrunOptionFlowGrouping;
|
|
131
|
-
/**
|
|
132
|
-
*
|
|
154
|
+
/**
|
|
155
|
+
* The grouping of one ask and the tier its grouped read rides (OPTLOAD W3 FE-ANCHOR): the ask's own tier wherever the
|
|
156
|
+
* gateway groups the window there (a session at the group's 30-minute view where that holds the window,
|
|
157
|
+
* `wrunOptionFlowGroupedTier`), else the coarsest of the read's tiers (`tiers`) finer than the ask's, dividing it and
|
|
158
|
+
* still holding the window's start, at which the chart's bars ARE an anchor's bars. A regular-hours CME chart's hours
|
|
159
|
+
* ride the 30-minute tier (their 13:30Z opens sit on it), which CME_RTH's 16:15 close does not divide (the gateway takes
|
|
160
|
+
* CME_RTH from tiers dividing 15 minutes alone), so they group from 5 minutes. Else `host`, at the ask's tier.
|
|
161
|
+
*/
|
|
162
|
+
export declare function wrunOptionFlowGroupedRead(args: {
|
|
163
|
+
barMs: number | undefined;
|
|
164
|
+
barGrid: LiveBucketVenue | undefined;
|
|
165
|
+
fromMs: number;
|
|
166
|
+
toMs: number;
|
|
167
|
+
session: boolean;
|
|
168
|
+
clock: OptionTradeDateClockRule;
|
|
169
|
+
exchange?: string;
|
|
170
|
+
read?: OptionBarAnchorRead;
|
|
171
|
+
/** The tier the lane asked. */
|
|
172
|
+
askTier: WrunBackendTier;
|
|
173
|
+
/** The read's tiers (the group's, `WRUN_OPTION_STRIKE_FLOW_TIERS`). */
|
|
174
|
+
tiers: readonly WrunBackendTier[];
|
|
175
|
+
/** The group's 30-minute view a session reads. */
|
|
176
|
+
sessionTier: WrunBackendTier;
|
|
177
|
+
nowMs: number;
|
|
178
|
+
}): {
|
|
179
|
+
grouping: WrunOptionFlowGrouping;
|
|
180
|
+
tier: WrunBackendTier;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* The window a grouped read of `[fromMs, toMs)` sends: on a session grouping the window widened to its anchor's session
|
|
184
|
+
* boundaries (the gateway refuses any other window; a CME trade date a weekday holiday's session is booked into opens
|
|
185
|
+
* at that session's open), else the window itself (a bar grouping was proved on it, its edges on the bars).
|
|
186
|
+
*/
|
|
187
|
+
export declare function wrunOptionFlowGroupingWindow(grouping: WrunOptionFlowGrouping, fromMs: number, toMs: number): {
|
|
188
|
+
fromMs: number;
|
|
189
|
+
toMs: number;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* The widest UTC groups a read of `[fromMs, toMs)` at a tier may be summed or picked to so that its answer lands on the
|
|
193
|
+
* chart exactly as the tier's buckets do, where the chart's bars themselves are no grouping the gateway draws (an RTH
|
|
194
|
+
* CME chart's hourly bars open at 13:30Z; a daily bar takes no session pick): the widest whole-minute width that divides
|
|
195
|
+
* a day, divides the host bar (or a day, for a bar of a day or longer), is a multiple of the tier and is a day only on
|
|
196
|
+
* the DAY tier, the window on its boundaries, such that every tier bucket's group opens on a bucket that lands on the
|
|
197
|
+
* bucket's own host bar (`wrunHostBarOf` over the chart's bar grid), or both on none (a Globex night on an RTH chart).
|
|
198
|
+
* One row per group, a few per host bar, never a row that straddles two host bars or a session's edge, so a consumer
|
|
199
|
+
* that lands each host bar on its newest group row lands it where today's buckets land it. Undefined when no width
|
|
200
|
+
* holds or the window cannot be walked (off the tier's grid, more than `NESTED_PROOF_MAX_BUCKETS` buckets). The one
|
|
201
|
+
* proof `options_flow` and the per-bar pick read (option-print-agg-scope.worker.util `wrunOptionsFlowBars`,
|
|
202
|
+
* option-strikes.worker.util `optionLaneBarGrouping`); `wrunOptionFlowGrouping` is the exact decider beside it.
|
|
203
|
+
*/
|
|
204
|
+
export declare function wrunOptionNestedUtcBars(args: {
|
|
205
|
+
barMs: number | undefined;
|
|
206
|
+
barGrid: LiveBucketVenue | null | undefined;
|
|
207
|
+
tierMs: number;
|
|
208
|
+
fromMs: number;
|
|
209
|
+
toMs: number;
|
|
210
|
+
}): {
|
|
211
|
+
barSeconds: number;
|
|
212
|
+
barAnchor: number;
|
|
213
|
+
} | undefined;
|
|
214
|
+
/** The trade-date group a bucket stamped `ts` sums into under the gateway's session on an anchor (contract 3.4, the
|
|
215
|
+
* anchor mirror): on RTH the New York date's 09:30 open for a bucket inside the cash session (null outside it), on UTC
|
|
216
|
+
* the UTC date's 00:00Z, on CME_SESSION the 17:00 Chicago open of the trade date's first session day. */
|
|
133
217
|
export declare function wrunOptionFlowSessionStampMs(ts: number, barAnchor: number): number | null;
|
|
134
218
|
/**
|
|
135
219
|
* The stamp of the group a bucket stamped `ts` sums into, on the browser's side of a grouping (the fold's): the
|
|
@@ -318,6 +402,10 @@ export type WrunOptionStrikeFlowFoldRead = WrunTierSegment;
|
|
|
318
402
|
* bars. A newest bar that cannot fit alone is skipped (a forming day read from minutes); from the first bar that fits,
|
|
319
403
|
* a bar that would pass the budget stops the walk. The kept bars are read per run of one tier (`reads`); every asked
|
|
320
404
|
* bar outside them is partial. `newerBarOpens` are the host bars after the ask, up to the clock.
|
|
405
|
+
*
|
|
406
|
+
* FE-FOLD-CAP (OPTLOAD W3, under R2's flag): `budgetRows` (the ask's `foldBudgetRows`, its share of the indicator's
|
|
407
|
+
* download budget in contract rows) caps the walk below the source answer budget; absent, the answer budget's 49,932
|
|
408
|
+
* rows a read, today's plan. `projectedRows` is what the kept bars are projected to read.
|
|
321
409
|
*/
|
|
322
410
|
export declare function wrunOptionStrikeFlowFoldPlan(args: {
|
|
323
411
|
barOpens: readonly number[];
|
|
@@ -326,11 +414,13 @@ export declare function wrunOptionStrikeFlowFoldPlan(args: {
|
|
|
326
414
|
barGrid: LiveBucketVenue | undefined;
|
|
327
415
|
nowMs: number;
|
|
328
416
|
acquisition: Readonly<Record<string, unknown>>;
|
|
417
|
+
budgetRows?: number;
|
|
329
418
|
}): {
|
|
330
419
|
reads: WrunOptionStrikeFlowFoldRead[];
|
|
331
420
|
partialBars: number[];
|
|
332
421
|
keptFromMs: number;
|
|
333
422
|
keptToMs: number;
|
|
423
|
+
projectedRows: number;
|
|
334
424
|
};
|
|
335
425
|
/** The host bars `[fromMs, toMs)` holds on the chart's grid, ascending (`liveBucketStartsInRange` over the grid). */
|
|
336
426
|
export declare function wrunOptionFlowHostBars(fromMs: number, toMs: number, barMs: number, barGrid: LiveBucketVenue | undefined): number[];
|
|
@@ -18,11 +18,14 @@
|
|
|
18
18
|
* - GROUPED (the data plane computes): OPTION_PRINT_AGG's STRIKE, EXPIRY or EXPIRY_STRIKE scope rows, grouped to the
|
|
19
19
|
* chart's bar (`barSeconds` and `barAnchor`) or trade date (`span`) by the gateway, every knob applied there
|
|
20
20
|
* (`optionRead`, `wrunOptionStrikeFlowOptionRead`), one row per group key per bar (`wrunOptionStrikeFlowTupleOf`);
|
|
21
|
+
* the anchors are the gateway's own (the one mirror, option-bar-anchor.util: UTC, US_EQUITY_RTH, a CME chart's
|
|
22
|
+
* regular session on CME_RTH or CME_ENERGY_RTH, its Globex trade date on CME_SESSION), offered where they land
|
|
23
|
+
* (`wrunOptionFlowGrouping`, at a tier the anchor takes: `wrunOptionFlowGroupedRead`);
|
|
21
24
|
* - FOLDED (today's ask): the chain's CONTRACT rows at a contract tier, summed per group key and cut by the same rules
|
|
22
25
|
* in the browser (`foldWrunOptionStrikeFlowGroup`, section 6.4 step by step), when the gateway refuses `optionRead` by
|
|
23
26
|
* name (a deployment without the read: the session's fallback for the plane), when the chart's bars are no grouping
|
|
24
|
-
* the gateway can draw (a
|
|
25
|
-
* venue: the gateway groups by coin, every book together).
|
|
27
|
+
* the gateway can draw (a Globex lattice bar off the UTC floor, a week), or when the chain's book is one of several of
|
|
28
|
+
* its coin (a crypto venue: the gateway groups by coin, every book together).
|
|
26
29
|
* The worker twin answers one row per group stamp, `[stampMs, block]`, the block one Float64Array of the stamp's tuples
|
|
27
30
|
* back to back (`packWrunOptionStrikeFlowTuples`), handed over by transfer; the lane's fold reads them in place
|
|
28
31
|
* (`foldWrunOptionStrikeFlowBar`, the identity of a grouped bar).
|
|
@@ -33,11 +36,12 @@
|
|
|
33
36
|
*/
|
|
34
37
|
import { KSCRIPT_SOURCE_CELL_BYTES, kScriptSourceAnswerRows } from '../chart/kscript-source-answer-budget.leaf.js';
|
|
35
38
|
import { liveBucketStartsInRange } from '../chart/live-bucket.util.js';
|
|
36
|
-
import { isEquityRegularSessionGated
|
|
39
|
+
import { isEquityRegularSessionGated } from '../chart/us-equities-session.util.js';
|
|
40
|
+
import { OPTION_BAR_ANCHOR, OPTION_BAR_ANCHOR_RULES, optionBarAnchorRuleOf, optionBarAnchorsTaken, optionChartClosedAt, optionGridCeilBoundaryMs, optionGridFloorBoundaryMs, optionSessionAnchorOf, } from '../options/option-bar-anchor.util.js';
|
|
37
41
|
import { optionExpiresOnTradeDay, optionTradeDateClockOf, optionTradeDayByClock, optionTradeDayStartMsByClock, } from '../options/option-trade-date.util.js';
|
|
38
42
|
import { wrunPartialMarkerTuple } from './wrun-present-bits.util.js';
|
|
39
43
|
import { WRUN_OPTION_CONTRACT_FLOW_BOOK_FIELD, WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD, WRUN_OPTION_CONTRACT_FLOW_RAW, WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH, WRUN_OPTION_PRINT_AGG_TIERS, wrunOptionContractFlowBarRows, wrunOptionFlowTodayFromOf, } from './wrun-option-contract-flow.util.js';
|
|
40
|
-
import { compareWrunOptionStrikeFlowTuples, WRUN_OPTION_FLOW_HISTORY, WRUN_OPTION_FLOW_SPANS, WRUN_OPTION_STRIKE_FLOW_COLUMN, WRUN_OPTION_STRIKE_FLOW_GROUPS, WRUN_OPTION_STRIKE_FLOW_TIERS, WRUN_OPTION_STRIKE_FLOW_WIDTH, wrunOptionStrikeFlowExpiriesOf, wrunOptionStrikeFlowPayloadKnobsOf, } from './wrun-option-strike-flow-lane.util.js';
|
|
44
|
+
import { compareWrunOptionStrikeFlowTuples, WRUN_OPTION_FLOW_HISTORY, WRUN_OPTION_FLOW_SPANS, WRUN_OPTION_STRIKE_FLOW_COLUMN, WRUN_OPTION_STRIKE_FLOW_FOLD_BUDGET_FIELD, WRUN_OPTION_STRIKE_FLOW_GROUPS, WRUN_OPTION_STRIKE_FLOW_TIERS, WRUN_OPTION_STRIKE_FLOW_WIDTH, wrunOptionStrikeFlowExpiriesOf, wrunOptionStrikeFlowPayloadKnobsOf, } from './wrun-option-strike-flow-lane.util.js';
|
|
41
45
|
import { refuseWrunOptionKnob, WRUN_OPTION_STRIKE_WINDOW_MAX_PCT } from './wrun-option-knobs.util.js';
|
|
42
46
|
import { wrunOptionChainAskStampHolds } from './wrun-option-prints.util.js';
|
|
43
47
|
import { wrunBarTiers, wrunHostBarOf, wrunHostBarSpanOf, wrunTierSegments, } from './wrun-tier-grid.util.js';
|
|
@@ -67,17 +71,21 @@ export const WRUN_OPTION_STRIKE_FLOW_COLUMNS = Object.freeze([
|
|
|
67
71
|
export const WRUN_OPTION_STRIKE_FLOW_DTE_CLASS = Object.freeze({ whole: 0, zero: 1, later: 2 });
|
|
68
72
|
/** `strike_rows`: 1 to 200 (om `WRUN_OPTION_STRIKE_ROWS_MAX`). */
|
|
69
73
|
export const WRUN_OPTION_STRIKE_ROWS_MAX = 200;
|
|
70
|
-
/** The scope word of each group (pb-common `OptionPrintAggScope` STRIKE 5, EXPIRY 6, EXPIRY_STRIKE 7)
|
|
74
|
+
/** The scope word of each group (pb-common `OptionPrintAggScope` STRIKE 5, EXPIRY 6, EXPIRY_STRIKE 7) and the read its
|
|
75
|
+
* grouped ask is, as the gateway registers the anchors it takes (option-bar-anchor.util). */
|
|
71
76
|
export const WRUN_OPTION_STRIKE_FLOW_SCOPE = Object.freeze({
|
|
72
|
-
strike: { word: 'STRIKE', id: 5 },
|
|
73
|
-
expiry: { word: 'EXPIRY', id: 6 },
|
|
74
|
-
expiry_strike: { word: 'EXPIRY_STRIKE', id: 7 },
|
|
77
|
+
strike: { word: 'STRIKE', id: 5, read: 'OPTION_PRINT_AGG/STRIKE' },
|
|
78
|
+
expiry: { word: 'EXPIRY', id: 6, read: 'OPTION_PRINT_AGG/EXPIRY' },
|
|
79
|
+
expiry_strike: { word: 'EXPIRY_STRIKE', id: 7, read: 'OPTION_PRINT_AGG/EXPIRY_STRIKE' },
|
|
75
80
|
});
|
|
76
|
-
/** pb-common enums the request names by number (the gateway decodes JSON with encoding/json): `BarAnchor
|
|
77
|
-
* `OptionExpiryClass`, `OptionDteBucket`, `OptionType`. */
|
|
81
|
+
/** pb-common enums the request names by number (the gateway decodes JSON with encoding/json): `BarAnchor` (the anchor
|
|
82
|
+
* mirror's values, option-bar-anchor.util), `BarSpan`, `OptionExpiryClass`, `OptionDteBucket`, `OptionType`. */
|
|
78
83
|
export const WRUN_OPTION_READ_ENUM = Object.freeze({
|
|
79
|
-
anchorUtc:
|
|
80
|
-
anchorUsEquityRth:
|
|
84
|
+
anchorUtc: OPTION_BAR_ANCHOR.UTC,
|
|
85
|
+
anchorUsEquityRth: OPTION_BAR_ANCHOR.US_EQUITY_RTH,
|
|
86
|
+
anchorCmeSession: OPTION_BAR_ANCHOR.CME_SESSION,
|
|
87
|
+
anchorCmeRth: OPTION_BAR_ANCHOR.CME_RTH,
|
|
88
|
+
anchorCmeEnergyRth: OPTION_BAR_ANCHOR.CME_ENERGY_RTH,
|
|
81
89
|
spanSession: 1,
|
|
82
90
|
expiryZeroDte: 1,
|
|
83
91
|
expiryAfterToday: 2,
|
|
@@ -205,6 +213,7 @@ export function wrunOptionStrikeFlowAcquisitionOf(payload) {
|
|
|
205
213
|
const book = upperOf(payload?.[WRUN_OPTION_CONTRACT_FLOW_BOOK_FIELD]);
|
|
206
214
|
const knobs = wrunOptionStrikeFlowPayloadKnobsOf(payload);
|
|
207
215
|
const todayFromMs = wrunOptionFlowTodayFromOf(payload);
|
|
216
|
+
const foldBudget = payload?.[WRUN_OPTION_STRIKE_FLOW_FOLD_BUDGET_FIELD];
|
|
208
217
|
return {
|
|
209
218
|
coin,
|
|
210
219
|
exchange: upperOf(payload?.[WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD]),
|
|
@@ -213,6 +222,9 @@ export function wrunOptionStrikeFlowAcquisitionOf(payload) {
|
|
|
213
222
|
...(typeof payload?.tier === 'string' ? { tier: payload.tier } : {}),
|
|
214
223
|
...wrunOptionFlowBarsOf(payload),
|
|
215
224
|
...(knobs.history === 'today' && todayFromMs !== undefined ? { todayFromMs } : {}),
|
|
225
|
+
...(typeof foldBudget === 'number' && Number.isInteger(foldBudget) && foldBudget >= 1
|
|
226
|
+
? { foldBudgetRows: foldBudget }
|
|
227
|
+
: {}),
|
|
216
228
|
};
|
|
217
229
|
}
|
|
218
230
|
/** Whether a payload is an `option_strike_flow` lane ask the K control serves: a coin, a group, one of the class's tiers
|
|
@@ -231,33 +243,33 @@ export function wrunOptionFlowClockOf(acquisition) {
|
|
|
231
243
|
}
|
|
232
244
|
/** The most tier buckets a grouping is proved over bucket by bucket (beyond it the fold reads the chart's bars). */
|
|
233
245
|
const GROUPING_PROOF_MAX_BUCKETS = 60_000;
|
|
234
|
-
/** The
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if (clock.zone === 'America/New_York')
|
|
239
|
-
return WRUN_OPTION_READ_ENUM.anchorUsEquityRth;
|
|
240
|
-
if (clock.zone === 'UTC')
|
|
241
|
-
return WRUN_OPTION_READ_ENUM.anchorUtc;
|
|
242
|
-
return undefined;
|
|
243
|
-
}
|
|
246
|
+
/** The read a grouping is for when its caller names none: the strike scopes' (every anchor is theirs to take). */
|
|
247
|
+
const STRIKE_READ = 'OPTION_PRINT_AGG/STRIKE';
|
|
248
|
+
const everyDrop = () => true;
|
|
249
|
+
const noDrop = () => false;
|
|
244
250
|
/**
|
|
245
|
-
* The grouping of one ask's window `[fromMs, toMs)` at a tier
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
251
|
+
* The grouping of one ask's window `[fromMs, toMs)` at a tier, from the anchors `read` takes on the read's venue
|
|
252
|
+
* (`exchange`, the chain's; a decider naming none is offered no CME anchor, as the gateway lays those over the CME
|
|
253
|
+
* group's rows alone): a session span groups by trade date (the anchor whose sessions are the clock's trade dates, from
|
|
254
|
+
* a tier its sessions fit), else a chart bar of a day reads its trade date's session where that session lands on it (a
|
|
255
|
+
* daily bar holding one New York regular session, the cash session's buckets alone, one UTC date, or one Globex trade
|
|
256
|
+
* date), else the chart's bars when the gateway's bars are exactly them (every tier bucket of the window lands on the
|
|
257
|
+
* host bar the gateway's bar opens on: the UTC floor; the 09:30 New York lattice of a regular-session stock chart's 45m
|
|
258
|
+
* to 12h bars, the tier dividing 30 minutes, a bucket outside the cash session reaching no bar on either side; a CME
|
|
259
|
+
* regular session's lattice on a regular-hours CME chart, the tier dividing that anchor's (15 minutes on CME_RTH, 30 on
|
|
260
|
+
* CME_ENERGY_RTH), the window on its boundaries, a bucket the anchor drops reaching no bar or falling where the chart's
|
|
261
|
+
* product holds no trading, option-bar-anchor.util `optionChartClosedAt`: a weekday product's weekend, never an
|
|
262
|
+
* always-on root's), else the chart's own bars, folded in the browser.
|
|
252
263
|
*/
|
|
253
264
|
export function wrunOptionFlowGrouping(args) {
|
|
254
|
-
const { barMs, barGrid, tierMs, fromMs, toMs, clock } = args;
|
|
255
|
-
const
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
(sessionAnchor === WRUN_OPTION_READ_ENUM.anchorUtc ? DAY_MS % tierMs === 0 : HALF_HOUR_MS % tierMs === 0);
|
|
265
|
+
const { barMs, barGrid, tierMs, fromMs, toMs, clock, exchange } = args;
|
|
266
|
+
const read = args.read ?? STRIKE_READ;
|
|
267
|
+
const sessionRule = optionSessionAnchorOf(clock, read, exchange);
|
|
268
|
+
const sessionServed = sessionRule?.fitsTier(tierMs, 0, true) === true ? sessionRule : undefined;
|
|
259
269
|
if (args.session) {
|
|
260
|
-
return sessionServed
|
|
270
|
+
return sessionServed !== undefined
|
|
271
|
+
? { kind: 'session', barAnchor: sessionServed.anchor }
|
|
272
|
+
: { kind: 'host', session: true };
|
|
261
273
|
}
|
|
262
274
|
if (barMs === undefined || !(tierMs > 0) || !(toMs > fromMs) || fromMs % tierMs !== 0 || toMs % tierMs !== 0) {
|
|
263
275
|
return { kind: 'host', session: false };
|
|
@@ -266,13 +278,13 @@ export function wrunOptionFlowGrouping(args) {
|
|
|
266
278
|
if (buckets > GROUPING_PROOF_MAX_BUCKETS)
|
|
267
279
|
return { kind: 'host', session: false };
|
|
268
280
|
/** Whether every bucket's group (`barOf`: the host bar its group lands on, null for a bucket the anchor drops) is the
|
|
269
|
-
* bucket's own host bar; a dropped bucket counts only where
|
|
281
|
+
* bucket's own host bar; a dropped bucket holding a host bar counts only where `drops` says the drop loses no row. */
|
|
270
282
|
const lands = (barOf, drops) => {
|
|
271
283
|
for (let ts = fromMs; ts < toMs; ts += tierMs) {
|
|
272
284
|
const bar = barOf(ts);
|
|
273
285
|
const host = wrunHostBarOf(ts, barMs, barGrid);
|
|
274
286
|
if (bar === null) {
|
|
275
|
-
if (
|
|
287
|
+
if (host !== null && !drops(ts))
|
|
276
288
|
return false;
|
|
277
289
|
continue;
|
|
278
290
|
}
|
|
@@ -281,36 +293,163 @@ export function wrunOptionFlowGrouping(args) {
|
|
|
281
293
|
}
|
|
282
294
|
return true;
|
|
283
295
|
};
|
|
284
|
-
if (barMs === DAY_MS && sessionServed) {
|
|
285
|
-
const
|
|
296
|
+
if (barMs === DAY_MS && sessionServed !== undefined) {
|
|
297
|
+
const rule = sessionServed;
|
|
286
298
|
const sessionBar = (ts) => {
|
|
287
|
-
const stamp =
|
|
299
|
+
const stamp = rule.sessionOpenMs(ts);
|
|
288
300
|
return stamp === null ? null : wrunHostBarOf(stamp, barMs, barGrid);
|
|
289
301
|
};
|
|
290
|
-
|
|
291
|
-
|
|
302
|
+
// A regular session drops the buckets off its hours, which the daily candle of its chart never holds.
|
|
303
|
+
if (lands(sessionBar, rule.session !== undefined ? everyDrop : noDrop)) {
|
|
304
|
+
return { kind: 'session', barAnchor: rule.anchor };
|
|
292
305
|
}
|
|
293
306
|
}
|
|
294
307
|
if (barMs >= DAY_MS || barMs % tierMs !== 0)
|
|
295
308
|
return { kind: 'host', session: false };
|
|
296
|
-
if (fromMs % barMs === 0 && toMs % barMs === 0 && lands((ts) => ts - (ts % barMs),
|
|
297
|
-
return { kind: 'bars', barSeconds: barMs / 1000, barAnchor:
|
|
309
|
+
if (fromMs % barMs === 0 && toMs % barMs === 0 && lands((ts) => ts - (ts % barMs), noDrop)) {
|
|
310
|
+
return { kind: 'bars', barSeconds: barMs / 1000, barAnchor: OPTION_BAR_ANCHOR.UTC };
|
|
298
311
|
}
|
|
299
|
-
|
|
312
|
+
const cashSession = OPTION_BAR_ANCHOR_RULES[OPTION_BAR_ANCHOR.US_EQUITY_RTH];
|
|
313
|
+
if (cashSession.fitsTier(tierMs, barMs, false) &&
|
|
300
314
|
isEquityRegularSessionGated(barGrid?.exchange, barGrid?.sessionType) &&
|
|
301
|
-
lands((ts) =>
|
|
302
|
-
return { kind: 'bars', barSeconds: barMs / 1000, barAnchor:
|
|
315
|
+
lands((ts) => cashSession.barOpenMs(ts, barMs), everyDrop)) {
|
|
316
|
+
return { kind: 'bars', barSeconds: barMs / 1000, barAnchor: cashSession.anchor };
|
|
317
|
+
}
|
|
318
|
+
// A CME regular session drops its weekend days: only where the chart's product trades none there.
|
|
319
|
+
const chartClosed = optionChartClosedAt(barGrid);
|
|
320
|
+
for (const rule of wrunOptionFlowVenueSessionRules(read, exchange)) {
|
|
321
|
+
if (!rule.fitsTier(tierMs, barMs, false) || !rule.isBoundary(fromMs, barMs, false))
|
|
322
|
+
continue;
|
|
323
|
+
if (!rule.isBoundary(toMs, barMs, false))
|
|
324
|
+
continue;
|
|
325
|
+
if (lands((ts) => rule.barOpenMs(ts, barMs), chartClosed)) {
|
|
326
|
+
return { kind: 'bars', barSeconds: barMs / 1000, barAnchor: rule.anchor };
|
|
327
|
+
}
|
|
303
328
|
}
|
|
304
329
|
return { kind: 'host', session: false };
|
|
305
330
|
}
|
|
306
|
-
/** The
|
|
307
|
-
*
|
|
331
|
+
/** The regular sessions a read takes on its venue that one venue group's rows alone are laid on (a CME group venue:
|
|
332
|
+
* CME_RTH, CME_ENERGY_RTH), in pb-common's order; none on a venue no such anchor lays, or a read naming no venue. */
|
|
333
|
+
function wrunOptionFlowVenueSessionRules(read, exchange) {
|
|
334
|
+
return optionBarAnchorsTaken(read, exchange).filter((rule) => rule.venues !== 'every' && rule.session !== undefined);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* The grouping of one ask and the tier its grouped read rides (OPTLOAD W3 FE-ANCHOR): the ask's own tier wherever the
|
|
338
|
+
* gateway groups the window there (a session at the group's 30-minute view where that holds the window,
|
|
339
|
+
* `wrunOptionFlowGroupedTier`), else the coarsest of the read's tiers (`tiers`) finer than the ask's, dividing it and
|
|
340
|
+
* still holding the window's start, at which the chart's bars ARE an anchor's bars. A regular-hours CME chart's hours
|
|
341
|
+
* ride the 30-minute tier (their 13:30Z opens sit on it), which CME_RTH's 16:15 close does not divide (the gateway takes
|
|
342
|
+
* CME_RTH from tiers dividing 15 minutes alone), so they group from 5 minutes. Else `host`, at the ask's tier.
|
|
343
|
+
*/
|
|
344
|
+
export function wrunOptionFlowGroupedRead(args) {
|
|
345
|
+
const { askTier, fromMs, nowMs } = args;
|
|
346
|
+
const at = (tier) => wrunOptionFlowGrouping({
|
|
347
|
+
barMs: args.barMs,
|
|
348
|
+
barGrid: args.barGrid,
|
|
349
|
+
tierMs: tier.ms,
|
|
350
|
+
fromMs,
|
|
351
|
+
toMs: args.toMs,
|
|
352
|
+
session: args.session,
|
|
353
|
+
clock: args.clock,
|
|
354
|
+
exchange: args.exchange,
|
|
355
|
+
read: args.read,
|
|
356
|
+
});
|
|
357
|
+
const grouping = at(askTier);
|
|
358
|
+
if (grouping.kind !== 'host') {
|
|
359
|
+
return { grouping, tier: wrunOptionFlowGroupedTier(grouping, askTier, args.sessionTier, fromMs, nowMs) };
|
|
360
|
+
}
|
|
361
|
+
if (!args.session) {
|
|
362
|
+
const finer = args.tiers
|
|
363
|
+
.filter((tier) => tier.ms > 0 &&
|
|
364
|
+
tier.ms < askTier.ms &&
|
|
365
|
+
askTier.ms % tier.ms === 0 &&
|
|
366
|
+
(tier.retentionMs === undefined || fromMs >= nowMs - tier.retentionMs))
|
|
367
|
+
.sort((a, b) => b.ms - a.ms);
|
|
368
|
+
for (const tier of finer) {
|
|
369
|
+
const stepped = at(tier);
|
|
370
|
+
if (stepped.kind === 'bars')
|
|
371
|
+
return { grouping: stepped, tier };
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return { grouping, tier: askTier };
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* The window a grouped read of `[fromMs, toMs)` sends: on a session grouping the window widened to its anchor's session
|
|
378
|
+
* boundaries (the gateway refuses any other window; a CME trade date a weekday holiday's session is booked into opens
|
|
379
|
+
* at that session's open), else the window itself (a bar grouping was proved on it, its edges on the bars).
|
|
380
|
+
*/
|
|
381
|
+
export function wrunOptionFlowGroupingWindow(grouping, fromMs, toMs) {
|
|
382
|
+
if (grouping.kind !== 'session')
|
|
383
|
+
return { fromMs, toMs };
|
|
384
|
+
const grid = {
|
|
385
|
+
anchor: grouping.barAnchor,
|
|
386
|
+
seconds: 0,
|
|
387
|
+
session: true,
|
|
388
|
+
};
|
|
389
|
+
return { fromMs: optionGridFloorBoundaryMs(grid, fromMs), toMs: optionGridCeilBoundaryMs(grid, toMs) };
|
|
390
|
+
}
|
|
391
|
+
/** The most tier buckets the nested proof walks for one read (the gateway's own limit is 15,000 points a request). */
|
|
392
|
+
const NESTED_PROOF_MAX_BUCKETS = 50_000;
|
|
393
|
+
/** Every UTC group width the gateway takes, widest first: the whole minutes that divide a day (contract 3.2: B below a
|
|
394
|
+
* day, or a day on the DAY tier; a width that divides a day keeps the UTC grid whole across days). */
|
|
395
|
+
const NESTED_UTC_WIDTHS_MS = Object.freeze(Array.from({ length: 1440 }, (_, at) => 1440 - at)
|
|
396
|
+
.filter((minutes) => 1440 % minutes === 0)
|
|
397
|
+
.map((minutes) => minutes * MINUTE_MS));
|
|
398
|
+
/**
|
|
399
|
+
* The widest UTC groups a read of `[fromMs, toMs)` at a tier may be summed or picked to so that its answer lands on the
|
|
400
|
+
* chart exactly as the tier's buckets do, where the chart's bars themselves are no grouping the gateway draws (an RTH
|
|
401
|
+
* CME chart's hourly bars open at 13:30Z; a daily bar takes no session pick): the widest whole-minute width that divides
|
|
402
|
+
* a day, divides the host bar (or a day, for a bar of a day or longer), is a multiple of the tier and is a day only on
|
|
403
|
+
* the DAY tier, the window on its boundaries, such that every tier bucket's group opens on a bucket that lands on the
|
|
404
|
+
* bucket's own host bar (`wrunHostBarOf` over the chart's bar grid), or both on none (a Globex night on an RTH chart).
|
|
405
|
+
* One row per group, a few per host bar, never a row that straddles two host bars or a session's edge, so a consumer
|
|
406
|
+
* that lands each host bar on its newest group row lands it where today's buckets land it. Undefined when no width
|
|
407
|
+
* holds or the window cannot be walked (off the tier's grid, more than `NESTED_PROOF_MAX_BUCKETS` buckets). The one
|
|
408
|
+
* proof `options_flow` and the per-bar pick read (option-print-agg-scope.worker.util `wrunOptionsFlowBars`,
|
|
409
|
+
* option-strikes.worker.util `optionLaneBarGrouping`); `wrunOptionFlowGrouping` is the exact decider beside it.
|
|
410
|
+
*/
|
|
411
|
+
export function wrunOptionNestedUtcBars(args) {
|
|
412
|
+
const { barMs, barGrid, tierMs, fromMs, toMs } = args;
|
|
413
|
+
if (barMs === undefined || !(barMs > 0) || !(tierMs > 0) || !Number.isFinite(fromMs) || !(toMs > fromMs)) {
|
|
414
|
+
return undefined;
|
|
415
|
+
}
|
|
416
|
+
if (fromMs % tierMs !== 0 || toMs % tierMs !== 0)
|
|
417
|
+
return undefined;
|
|
418
|
+
const count = (toMs - fromMs) / tierMs;
|
|
419
|
+
if (count > NESTED_PROOF_MAX_BUCKETS)
|
|
420
|
+
return undefined;
|
|
421
|
+
const host = new Array(count);
|
|
422
|
+
for (let at = 0; at < count; at += 1)
|
|
423
|
+
host[at] = wrunHostBarOf(fromMs + at * tierMs, barMs, barGrid);
|
|
424
|
+
/** Whether every bucket's group (opening at `ts - ts % width`, a bucket of the window) lands where the bucket does. */
|
|
425
|
+
const nests = (width) => {
|
|
426
|
+
for (let at = 0; at < count; at += 1) {
|
|
427
|
+
const ts = fromMs + at * tierMs;
|
|
428
|
+
const slot = (ts - (ts % width) - fromMs) / tierMs;
|
|
429
|
+
if (!(slot >= 0 && slot <= at && Number.isInteger(slot)) || host[slot] !== host[at])
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
432
|
+
return true;
|
|
433
|
+
};
|
|
434
|
+
for (const width of NESTED_UTC_WIDTHS_MS) {
|
|
435
|
+
if (width % tierMs !== 0 || (width === DAY_MS && tierMs !== DAY_MS))
|
|
436
|
+
continue;
|
|
437
|
+
if (barMs < DAY_MS && barMs % width !== 0)
|
|
438
|
+
continue;
|
|
439
|
+
if (fromMs % width !== 0 || toMs % width !== 0)
|
|
440
|
+
continue;
|
|
441
|
+
if (nests(width))
|
|
442
|
+
return { barSeconds: width / 1000, barAnchor: OPTION_BAR_ANCHOR.UTC };
|
|
443
|
+
}
|
|
444
|
+
return undefined;
|
|
445
|
+
}
|
|
446
|
+
/** The trade-date group a bucket stamped `ts` sums into under the gateway's session on an anchor (contract 3.4, the
|
|
447
|
+
* anchor mirror): on RTH the New York date's 09:30 open for a bucket inside the cash session (null outside it), on UTC
|
|
448
|
+
* the UTC date's 00:00Z, on CME_SESSION the 17:00 Chicago open of the trade date's first session day. */
|
|
308
449
|
export function wrunOptionFlowSessionStampMs(ts, barAnchor) {
|
|
309
450
|
if (!Number.isFinite(ts))
|
|
310
451
|
return null;
|
|
311
|
-
|
|
312
|
-
return usEquityAnchoredBucketStartMs(ts, DAY_MS);
|
|
313
|
-
return ts - (((ts % DAY_MS) + DAY_MS) % DAY_MS);
|
|
452
|
+
return optionBarAnchorRuleOf(barAnchor)?.sessionOpenMs(ts) ?? null;
|
|
314
453
|
}
|
|
315
454
|
/**
|
|
316
455
|
* The stamp of the group a bucket stamped `ts` sums into, on the browser's side of a grouping (the fold's): the
|
|
@@ -321,12 +460,8 @@ export function wrunOptionFlowGroupStampMs(ts, grouping, bars) {
|
|
|
321
460
|
if (!Number.isFinite(ts))
|
|
322
461
|
return null;
|
|
323
462
|
switch (grouping.kind) {
|
|
324
|
-
case 'bars':
|
|
325
|
-
|
|
326
|
-
return grouping.barAnchor === WRUN_OPTION_READ_ENUM.anchorUsEquityRth
|
|
327
|
-
? usEquityAnchoredBucketStartMs(ts, barMs)
|
|
328
|
-
: ts - (((ts % barMs) + barMs) % barMs);
|
|
329
|
-
}
|
|
463
|
+
case 'bars':
|
|
464
|
+
return optionBarAnchorRuleOf(grouping.barAnchor)?.barOpenMs(ts, grouping.barSeconds * 1000) ?? null;
|
|
330
465
|
case 'session':
|
|
331
466
|
return wrunOptionFlowSessionStampMs(ts, grouping.barAnchor);
|
|
332
467
|
case 'host': {
|
|
@@ -668,6 +803,10 @@ export function wrunOptionStrikeFlowZeroDte(row, tierMs, clock) {
|
|
|
668
803
|
* bars. A newest bar that cannot fit alone is skipped (a forming day read from minutes); from the first bar that fits,
|
|
669
804
|
* a bar that would pass the budget stops the walk. The kept bars are read per run of one tier (`reads`); every asked
|
|
670
805
|
* bar outside them is partial. `newerBarOpens` are the host bars after the ask, up to the clock.
|
|
806
|
+
*
|
|
807
|
+
* FE-FOLD-CAP (OPTLOAD W3, under R2's flag): `budgetRows` (the ask's `foldBudgetRows`, its share of the indicator's
|
|
808
|
+
* download budget in contract rows) caps the walk below the source answer budget; absent, the answer budget's 49,932
|
|
809
|
+
* rows a read, today's plan. `projectedRows` is what the kept bars are projected to read.
|
|
671
810
|
*/
|
|
672
811
|
export function wrunOptionStrikeFlowFoldPlan(args) {
|
|
673
812
|
const { barOpens, barMs, barGrid, nowMs } = args;
|
|
@@ -680,8 +819,18 @@ export function wrunOptionStrikeFlowFoldPlan(args) {
|
|
|
680
819
|
choice: 'coarsest',
|
|
681
820
|
sessionGrid: barGrid ?? null,
|
|
682
821
|
});
|
|
683
|
-
// The per-contract read weighs as `option_contract_flow`'s raw rows do: the same read, the same budget
|
|
684
|
-
|
|
822
|
+
// The per-contract read weighs as `option_contract_flow`'s raw rows do: the same read, the same budget; a budgeted
|
|
823
|
+
// run's share caps it below (the smaller wins).
|
|
824
|
+
const answerRows = kScriptSourceAnswerRows(WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH);
|
|
825
|
+
const cap = args.budgetRows;
|
|
826
|
+
const capped = typeof cap === 'number' && cap >= 1;
|
|
827
|
+
const budget = capped ? Math.min(answerRows, Math.floor(cap)) : answerRows;
|
|
828
|
+
// The projection finds the chain's plane by the contract flow's exchange field (`flowExchange`): a lane's extras name
|
|
829
|
+
// it there (the lane's forecast), the worker's parsed acquisition as `exchange`. Under a cap both read the chain's own
|
|
830
|
+
// plane, so the cap the forecast priced is the cap the worker folds by (INT 2026-10-23: the worker read the plain
|
|
831
|
+
// plane, an ES1! regular-hours hour at 1,458 rows for the CME plane's 4,913, and its 5,831-row cap folded 3 hours).
|
|
832
|
+
// Without a cap the plan reads as it did (the flag-off fold, unchanged).
|
|
833
|
+
const projection = capped ? wrunOptionStrikeFlowProjectionOf(args.acquisition) : args.acquisition;
|
|
685
834
|
let rows = 0;
|
|
686
835
|
let keptFromMs = Number.POSITIVE_INFINITY;
|
|
687
836
|
let keptToMs = Number.NEGATIVE_INFINITY;
|
|
@@ -693,7 +842,7 @@ export function wrunOptionStrikeFlowFoldPlan(args) {
|
|
|
693
842
|
continue;
|
|
694
843
|
}
|
|
695
844
|
const span = bar.span ?? wrunHostBarSpanOf(bar.barOpenMs, barMs, barGrid ?? null);
|
|
696
|
-
const projected = wrunOptionContractFlowBarRows({ openMs: span.fromMs, endMs: span.toMs, tier: bar.tier }, nowMs,
|
|
845
|
+
const projected = wrunOptionContractFlowBarRows({ openMs: span.fromMs, endMs: span.toMs, tier: bar.tier }, nowMs, projection);
|
|
697
846
|
const barRows = Number.isFinite(projected) && projected > 0 ? projected : 0;
|
|
698
847
|
if (keptToMs === Number.NEGATIVE_INFINITY && barRows > budget)
|
|
699
848
|
continue;
|
|
@@ -712,8 +861,20 @@ export function wrunOptionStrikeFlowFoldPlan(args) {
|
|
|
712
861
|
partialBars: barOpens.filter((open) => !keptSet.has(open)),
|
|
713
862
|
keptFromMs,
|
|
714
863
|
keptToMs,
|
|
864
|
+
projectedRows: rows,
|
|
715
865
|
};
|
|
716
866
|
}
|
|
867
|
+
/** A strike flow acquisition as the contract flow projection reads it (`wrunOptionStrikeFlowFoldPlan` under a cap): the
|
|
868
|
+
* chain's exchange in `flowExchange`, from the parsed acquisition's `exchange` when the field is missing. */
|
|
869
|
+
function wrunOptionStrikeFlowProjectionOf(acquisition) {
|
|
870
|
+
const named = acquisition[WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD];
|
|
871
|
+
if (typeof named === 'string' && named.trim() !== '')
|
|
872
|
+
return acquisition;
|
|
873
|
+
const exchange = acquisition.exchange;
|
|
874
|
+
return typeof exchange === 'string' && exchange.trim() !== ''
|
|
875
|
+
? { ...acquisition, [WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD]: exchange }
|
|
876
|
+
: acquisition;
|
|
877
|
+
}
|
|
717
878
|
/** The host bars `[fromMs, toMs)` holds on the chart's grid, ascending (`liveBucketStartsInRange` over the grid). */
|
|
718
879
|
export function wrunOptionFlowHostBars(fromMs, toMs, barMs, barGrid) {
|
|
719
880
|
if (!(toMs > fromMs) || !(barMs > 0))
|