@orangecharts/wrun-chart-host 0.6.0 → 0.7.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 +13 -5
- package/dist/constants/marketCapabilities.constants.d.ts +5 -0
- package/dist/constants/marketCapabilities.constants.js +16 -0
- package/dist/host-ports.types.d.ts +35 -3
- package/dist/index.d.ts +11 -1
- package/dist/index.js +11 -1
- package/dist/indicators/controls/tpo-session.util.js +42 -18
- package/dist/market-data/billing.interface.d.ts +2 -1
- package/dist/settings-templates/indicator-fields.js +10 -0
- package/dist/utility/chart/crypto-index.leaf.d.ts +16 -0
- package/dist/utility/chart/crypto-index.leaf.js +19 -0
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +11 -5
- package/dist/utility/chart/index-mode.util.js +22 -10
- package/dist/utility/chart/kscript-source-answer-budget.leaf.d.ts +36 -0
- package/dist/utility/chart/kscript-source-answer-budget.leaf.js +39 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +38 -1
- package/dist/utility/chart/kscript-source-degrade.leaf.js +39 -1
- package/dist/utility/chart/live-bucket.util.d.ts +2 -1
- package/dist/utility/chart/live-bucket.util.js +47 -15
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +15 -1
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +9 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +3 -1
- package/dist/utility/chart/market-session-schedule.util.js +24 -2
- package/dist/utility/chart/marketKind.util.d.ts +12 -7
- package/dist/utility/chart/marketKind.util.js +15 -5
- package/dist/utility/chart/ny-calendar.util.d.ts +104 -0
- package/dist/utility/chart/ny-calendar.util.js +346 -0
- package/dist/utility/chart/om-panel.util.d.ts +14 -2
- package/dist/utility/chart/om-panel.util.js +108 -40
- package/dist/utility/chart/rth-session.util.d.ts +10 -7
- package/dist/utility/chart/rth-session.util.js +17 -22
- package/dist/utility/chart/trading-day.util.js +90 -18
- package/dist/utility/chart/us-equities-session.util.js +20 -67
- package/dist/utility/chart/wrun-bar-session-facts.util.js +14 -1
- package/dist/utility/common/time.util.d.ts +7 -1
- package/dist/utility/common/time.util.js +11 -41
- package/dist/utility/number-format.util.d.ts +17 -7
- package/dist/utility/number-format.util.js +18 -8
- package/dist/utility/options/option-symbol.util.js +13 -2
- package/dist/utility/symbol-selection/contract-expiry.util.js +9 -1
- package/dist/utility/watchlist/import/import-request.leaf.d.ts +4 -1
- package/dist/utility/watchlist/import/import-request.leaf.js +5 -2
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +25 -4
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +62 -4
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +19 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +57 -0
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +23 -0
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +90 -0
- package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.d.ts +39 -0
- package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.js +60 -0
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +77 -0
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +195 -0
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +56 -0
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +70 -0
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +53 -0
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +239 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +16 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +14 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +43 -18
- package/dist/utility/wrun/sources/lanes/options_flow.js +209 -72
- package/dist/utility/wrun/sources/lanes/token_supply.js +5 -31
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -18
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +12 -57
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +1 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +22 -8
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +61 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +103 -8
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +5 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +24 -12
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +55 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +95 -18
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +15 -1
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +23 -8
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +11 -11
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +14 -2
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +6 -3
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +43 -8
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +77 -11
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -16
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +2 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +52 -12
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +110 -46
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +10 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +12 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +53 -18
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +45 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.js +14 -8
- package/dist/utility/wrun/wrun-failure-cause.d.ts +1 -1
- package/dist/utility/wrun/wrun-failure-cause.js +14 -0
- package/dist/utility/wrun/wrun-frames.js +6 -2
- package/dist/utility/wrun/wrun-host.service.d.ts +26 -18
- package/dist/utility/wrun/wrun-host.service.js +49 -52
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +2 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +7 -4
- package/dist/utility/wrun/wrun-kit-run-tables.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-kit-run-tables.util.js +87 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +2 -1
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +8 -2
- package/dist/utility/wrun/wrun-live-tick.util.js +35 -16
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +40 -13
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +39 -12
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +70 -21
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +257 -112
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +62 -22
- package/dist/utility/wrun/wrun-option-prints.util.js +148 -46
- package/dist/utility/wrun/wrun-option-views.util.d.ts +262 -0
- package/dist/utility/wrun/wrun-option-views.util.js +356 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +23 -2
- package/dist/utility/wrun/wrun-options-chain.util.js +37 -3
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +18 -3
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +32 -7
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -3
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +146 -18
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +50 -6
- package/dist/utility/wrun/wrun-overlay-run.util.js +816 -243
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +5 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +28 -12
- package/dist/utility/wrun/wrun-pin-venues.util.js +4 -6
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +39 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-refusal-surface.util.js +5 -4
- package/dist/utility/wrun/wrun-refusal.util.d.ts +66 -6
- package/dist/utility/wrun/wrun-refusal.util.js +335 -40
- package/dist/utility/wrun/wrun-source-rows.util.js +11 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +28 -3
- package/dist/utility/wrun/wrun-tier-grid.util.js +79 -19
- package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +14 -3
- package/dist/utility/wrun/wrun-transient-rerun.util.js +33 -8
- package/package.json +5 -5
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +0 -12
- package/dist/utility/wrun/wrun-opra-underlying.util.js +0 -1
|
@@ -87,19 +87,23 @@ export interface WrunRowLaneHorizon {
|
|
|
87
87
|
completeFromMs?: number;
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
|
-
* A read
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
90
|
+
* A read whose answer can pass the source answer budget (`option_contract_flow` reads every contract of the
|
|
91
|
+
* underlying): how many numeric cells one answered row holds (the raw tuple the worker hands over) and the rows one
|
|
92
|
+
* host bar is projected to read at its tier, up to the clock, for the instance's own acquisition (its payload: a chain
|
|
93
|
+
* lane's plane follows the exchange it names, so each plane reads its own projection). The cap is never the lane's to
|
|
94
|
+
* pick: it is the source answer budget (kscript-source-answer-budget.leaf) in rows of that width
|
|
95
|
+
* (`wrunRowLaneMaxRows`), the one size the row cache, the worker's row cap and the fetch guard agree on. Before any
|
|
96
|
+
* fetch the host keeps the NEWEST asked bars whose projected rows fit it and marks every older asked bar PARTIAL (bit
|
|
97
|
+
* 14 of `present`: one marker tuple), the asks starting at the first kept bar's open, never inside a bar; a bar whose
|
|
98
|
+
* own projection passes it leaves every bar at or before it partial. Applied after the tier rule and the horizon.
|
|
95
99
|
*/
|
|
96
100
|
export interface WrunRowLaneRowBudget {
|
|
97
|
-
|
|
101
|
+
cellsPerRow: number;
|
|
98
102
|
barRows: (bar: {
|
|
99
103
|
openMs: number;
|
|
100
104
|
endMs: number;
|
|
101
105
|
tier?: WrunBackendTier;
|
|
102
|
-
}, nowMs: number) => number;
|
|
106
|
+
}, nowMs: number, acquisition: Readonly<Record<string, unknown>>) => number;
|
|
103
107
|
}
|
|
104
108
|
/** What a lane's live fold reads beside the points: the chart's bar span and grid, and the acquisition the
|
|
105
109
|
* instance's history was asked with (its knobs: a floor, an expiry set). */
|
|
@@ -110,14 +114,22 @@ export interface WrunRowLaneFoldContext {
|
|
|
110
114
|
}
|
|
111
115
|
/**
|
|
112
116
|
* A lane fed live by COIN (UW-PARITY rule for the print class): a coin-scoped channel carries every point of
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
+
* an underlying (one print per contract of the root), and the intake admits a point whose coin is the coin the
|
|
118
|
+
* instance was asked for (`WrunRowLaneDescriptor.coinOf`), whatever contract it names, the chart's own market or not.
|
|
119
|
+
* The channel's key is `wrunCoinChannel` (live-feed-channel-factory.util): for a governed lane its plane's exchange,
|
|
120
|
+
* for a `chain` lane the exchange the instance's chain lists on (a crypto venue, OPRA, a CME Group exchange), with
|
|
121
|
+
* the instance's coin (its chain's underlying), on a governed exchange only while the read is routed real-time
|
|
122
|
+
* (wrun-coin-lane-live.util). The lane's `fold` keeps only the points its acquisition reads (a chain lane's: its
|
|
123
|
+
* exchange and its ONE book). No lane opens a channel until the live-feed serves the coin route.
|
|
117
124
|
*/
|
|
118
125
|
export interface WrunRowLaneLiveByCoin {
|
|
119
126
|
/** The fan-out's script source name the lane's frames arrive under. */
|
|
120
127
|
scriptSource: string;
|
|
128
|
+
/** A chain lane's planes whose coin channel carries its points (a live producer of its type streams there): an
|
|
129
|
+
* instance whose chain lists on another plane subscribes nothing and refreshes from history alone, the live tick's
|
|
130
|
+
* reconcile re-asking it as it re-asks a lane with no channel (its answer merged by `reconcile`). Absent: every
|
|
131
|
+
* plane. */
|
|
132
|
+
chainPlanes?: readonly WrunLaneChainPlane[];
|
|
121
133
|
/** The coin a point names (its series' coin); absent: `point.series.coin`, else the frame's own. */
|
|
122
134
|
coinOf?: (point: unknown) => string | undefined;
|
|
123
135
|
/** A point's time, ms (the host bar it folds into); null for a point that names none. */
|
|
@@ -147,6 +159,8 @@ export interface WrunRowLaneChain {
|
|
|
147
159
|
/** The plane a chain lane instance reads: the gate its chain's exchange rides (`opra`, `cme`), or `plain` (a crypto
|
|
148
160
|
* options venue: no gate, no licence delay, no plane stamp, no routed tier). */
|
|
149
161
|
export type WrunLaneChainPlane = 'opra' | 'cme' | 'plain';
|
|
162
|
+
/** Every chain plane (the registry checks a lane's `liveByCoin.chainPlanes` against it). */
|
|
163
|
+
export declare const WRUN_LANE_CHAIN_PLANES: readonly WrunLaneChainPlane[];
|
|
150
164
|
/** An exchange's plane, read off the governed exchange sets the gate table is built from (never a venue list): a CME
|
|
151
165
|
* Group exchange is `cme`, OPRA `opra`, any other `plain`. Here, beside the chain mark, so the planner on the row
|
|
152
166
|
* builder's (and the boot path's) import graph reads it without the chain resolver's module. */
|
|
@@ -197,9 +211,9 @@ export interface WrunRowLaneDescriptor {
|
|
|
197
211
|
* identity, facets and plane fields) and the window's clock, for a flow or snapshot lane. Absent: the tier rule
|
|
198
212
|
* alone. */
|
|
199
213
|
horizon?: (extras: Readonly<Record<string, unknown>>, nowMs: number) => WrunRowLaneHorizon | undefined;
|
|
200
|
-
/** The
|
|
201
|
-
* that fit are read, every older asked bar is partial. Absent: the asks as the tier rule and the
|
|
202
|
-
* them. */
|
|
214
|
+
/** The source answer budget the lane's read keeps under (`WrunRowLaneRowBudget`), for a flow or snapshot lane: the
|
|
215
|
+
* newest bars that fit are read, every older asked bar is partial. Absent: the asks as the tier rule and the
|
|
216
|
+
* horizon made them (a lane whose answer cannot pass the budget). */
|
|
203
217
|
rowBudget?: WrunRowLaneRowBudget;
|
|
204
218
|
/**
|
|
205
219
|
* The lane reads a governed plane on every chart it serves: `opra` (US options data). Its inputs are refused by
|
|
@@ -215,7 +229,7 @@ export interface WrunRowLaneDescriptor {
|
|
|
215
229
|
* the one chain resolver (sources/opra-option-lanes.util `decideWrunLaneChain`), never per descriptor (see
|
|
216
230
|
* `WrunRowLaneChain`). It is admitted on every chart (a chart with no chain is refused by name in its identity or
|
|
217
231
|
* facets), and its asks ride the native-rows path on every plane (its rows are its chain's, never the chart
|
|
218
|
-
* market's).
|
|
232
|
+
* market's). It may be fed live by coin too (`liveByCoin`): each instance subscribes its own chain's channel.
|
|
219
233
|
*/
|
|
220
234
|
chain?: WrunRowLaneChain;
|
|
221
235
|
/** How an empty answer reads: `quiet` (a window with nothing in it is legitimate: present EMPTY blocks) or
|
|
@@ -242,7 +256,8 @@ export interface WrunRowLaneDescriptor {
|
|
|
242
256
|
/** The lane's OWN fetch in place of the chart's (a series no K control serves): the poll lanes' ask shape,
|
|
243
257
|
* answered as rows `[ts, tuple, ...]` at the asked tier, ascending. */
|
|
244
258
|
fetch?: (ask: WrunPollLaneFetchAsk) => Promise<ReadonlyArray<ReadonlyArray<unknown>>>;
|
|
245
|
-
/** Live points by coin (see `WrunRowLaneLiveByCoin
|
|
259
|
+
/** Live points by coin (see `WrunRowLaneLiveByCoin`: a governed lane's plane, a chain lane's own chain per
|
|
260
|
+
* instance); absent: a poll lane (the reconcile re-asks it). */
|
|
246
261
|
liveByCoin?: WrunRowLaneLiveByCoin;
|
|
247
262
|
}
|
|
248
263
|
/** The input a lane's per-input projection (`cells`) reads: its name, its declaration and the most tuples a bar of
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { isCmeGoverned } from '../../chart/cme-realtime.util.js';
|
|
2
2
|
import { isOpraGoverned } from '../../v2/opra-governed.util.js';
|
|
3
|
+
/** Every chain plane (the registry checks a lane's `liveByCoin.chainPlanes` against it). */
|
|
4
|
+
export const WRUN_LANE_CHAIN_PLANES = Object.freeze(['opra', 'cme', 'plain']);
|
|
3
5
|
/** An exchange's plane, read off the governed exchange sets the gate table is built from (never a venue list): a CME
|
|
4
6
|
* Group exchange is `cme`, OPRA `opra`, any other `plain`. Here, beside the chain mark, so the planner on the row
|
|
5
7
|
* builder's (and the boot path's) import graph reads it without the chain resolver's module. */
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
* chart's grid (exact width, finite values or NaN outside a lane's `finiteColumns`, the lane's per-input
|
|
21
21
|
* projection with a partial bar kept partial unless the class carries no `present` mask; a `latest` lane on the
|
|
22
22
|
* live row).
|
|
23
|
+
* - `wrunRowLaneReachFromMs` / `wrunRunSourceReachFromMs`: how far back a lane's source holds rows (its horizon, its
|
|
24
|
+
* longest-kept tier), and where a run's history sources begin, which the warm-up decider reads so a first value a
|
|
25
|
+
* source's history explains never buys a page of older candles.
|
|
23
26
|
*/
|
|
24
27
|
import type { WrunIndicatorMetadata, WrunInputSource } from '../../../interfaces/wrun-runtime.interface.js';
|
|
25
28
|
import type { LiveBucketVenue } from '../../chart/live-bucket.util.js';
|
|
@@ -134,9 +137,13 @@ export declare function wrunRowLaneEmptyAnswer(lane: Pick<WrunRowLaneDescriptor,
|
|
|
134
137
|
* declare `missing: "empty"` (a celled input's fill over an empty lane, the honest-picture rule). */
|
|
135
138
|
export declare function wrunRowLaneRequired(metadata: WrunIndicatorMetadata, instance: Pick<WrunRowLaneInstance, 'inputIndexes' | 'laneKey'>): boolean;
|
|
136
139
|
/** The fetch options a row lane's asks carry: the native-rows path for a governed lane and a chain lane (their rows
|
|
137
|
-
* are their plane's or their chain's, never the chart market's, an index-mode one included)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
* are their plane's or their chain's, never the chart market's, an index-mode one included); `endExclusive` for a
|
|
141
|
+
* flow or snapshot lane, whose host-grid asks end at their last bar's close (`wrunHostGridFetchTo`), so the fetch
|
|
142
|
+
* pads no inclusive bar past it (a padded ask read the next bar, one the source answer budget had left partial, and
|
|
143
|
+
* landed it there: OPTFLOW-HANG review 2026-10-20). A `latest` lane's ask keeps the padding. */
|
|
144
|
+
export declare function wrunRowLaneFetchOptions(lane: Pick<WrunRowLaneDescriptor, 'governed' | 'chain' | 'landing'>): {
|
|
145
|
+
nativeRows?: true;
|
|
146
|
+
endExclusive?: true;
|
|
140
147
|
} | undefined;
|
|
141
148
|
/** The payload field a tiered ask names its backend tier in (`landing.tiers`, the tier's key). */
|
|
142
149
|
export declare const WRUN_ROW_LANE_TIER_FIELD = "tier";
|
|
@@ -154,8 +161,11 @@ export interface WrunRowLaneWindow {
|
|
|
154
161
|
* the lane's own `fold` when it has one), a snapshot's bar its tier answered nothing for asked again one tier coarser
|
|
155
162
|
* where one fits and retains it when the lane's `coarserWhenEmpty` says so of the acquisition (D12), and the bars no
|
|
156
163
|
* tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty); a `latest` lane asked
|
|
157
|
-
* once over `fallback`, its rows as they come.
|
|
158
|
-
*
|
|
164
|
+
* once over `fallback`, its rows as they come. A flow sums every bucket inside its bar, so its plan reads the window's
|
|
165
|
+
* bar grid as its session grid (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME session bar of a day or longer
|
|
166
|
+
* is fit, budgeted and asked over its Globex session, from the 17:00 Chicago open before its 00:00Z stamp, never from
|
|
167
|
+
* a UTC day bucket; a snapshot keeps its stamps (D12's settlement DAY rows). `ask` is the caller's fetch (the full
|
|
168
|
+
* run's, a reconcile's). Ascending, one row per host bar.
|
|
159
169
|
*/
|
|
160
170
|
export declare function fetchWrunRowLaneRows(lane: WrunRowLaneDescriptor, extras: Readonly<Record<string, unknown>>, window: WrunRowLaneWindow, fallback: {
|
|
161
171
|
fromTs: number;
|
|
@@ -164,29 +174,59 @@ export declare function fetchWrunRowLaneRows(lane: WrunRowLaneDescriptor, extras
|
|
|
164
174
|
/**
|
|
165
175
|
* A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that
|
|
166
176
|
* opens before `completeFromMs` joins the partial bars, and the asks start at the first bar that ends after
|
|
167
|
-
* `servedFromMs` (an ask wholly before it is dropped).
|
|
177
|
+
* `servedFromMs` (an ask wholly before it is dropped). A bar opens and ends where its span does (`wrunHostBarSpanOf`:
|
|
178
|
+
* its session under the plan's session grid, a flow's). No horizon: the plan as the tier rule made it. The cut a
|
|
179
|
+
* host-grid poll lane's `horizon` takes too (wrun-poll-lanes.util `wrunHostGridAsksWithinHorizon`, its one home).
|
|
168
180
|
*/
|
|
169
181
|
export declare function wrunRowLaneAsksWithinHorizon(plan: {
|
|
170
182
|
asks: WrunHostGridAsk[];
|
|
171
183
|
partialBars: number[];
|
|
172
|
-
}, window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs'>, horizon: WrunRowLaneHorizon | undefined): {
|
|
184
|
+
}, window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs'>, horizon: WrunRowLaneHorizon | undefined, sessionGrid?: LiveBucketVenue | null): {
|
|
173
185
|
asks: WrunHostGridAsk[];
|
|
174
186
|
partialBars: number[];
|
|
175
187
|
};
|
|
188
|
+
/** A row budget's cap in rows: the source answer budget (kscript-source-answer-budget.leaf) in rows of the lane's
|
|
189
|
+
* answered width. One number for every lane, the row cache and the worker's cap; a lane never picks its own. */
|
|
190
|
+
export declare function wrunRowLaneMaxRows(budget: Pick<WrunRowLaneRowBudget, 'cellsPerRow'>): number;
|
|
176
191
|
/**
|
|
177
192
|
* A host-grid ask plan cut to a lane's row budget (`WrunRowLaneRowBudget`), before any fetch: walking the asked bars
|
|
178
|
-
* from the newest, each at its ask's tier
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
193
|
+
* from the newest, each at its ask's tier and projected for the instance's own `acquisition` (its payload: a chain
|
|
194
|
+
* lane's plane names its projection), it keeps one run of bars whose projected rows fit `maxRows` (the source answer
|
|
195
|
+
* budget in the lane's rows); every asked bar outside it joins the partial bars and the asks are cut to it (a bar is
|
|
196
|
+
* read whole or not at all).
|
|
197
|
+
* - The NEWEST bars that cannot fit even alone (a daily chart's forming day read from minutes, 262,000 SPY rows at the
|
|
198
|
+
* close) are left partial and the walk goes on to the older bars, so one heavy bar never leaves the whole window
|
|
199
|
+
* unread.
|
|
200
|
+
* - From the first bar that fits, a bar whose projection would pass the cap stops the walk there.
|
|
201
|
+
* A bar is projected, kept and cut over its span (`wrunHostBarSpanOf`: its session under the plan's session grid, a
|
|
202
|
+
* flow's) and marked partial by its stamp. No budget, or every bar fitting: the plan as it came.
|
|
182
203
|
*/
|
|
183
204
|
export declare function wrunRowLaneAsksWithinRowBudget(plan: {
|
|
184
205
|
asks: WrunHostGridAsk[];
|
|
185
206
|
partialBars: number[];
|
|
186
|
-
}, window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs' | 'nowMs'>, budget: WrunRowLaneRowBudget | undefined): {
|
|
207
|
+
}, window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs' | 'nowMs'>, budget: WrunRowLaneRowBudget | undefined, acquisition?: Readonly<Record<string, unknown>>, sessionGrid?: LiveBucketVenue | null): {
|
|
187
208
|
asks: WrunHostGridAsk[];
|
|
188
209
|
partialBars: number[];
|
|
189
210
|
};
|
|
211
|
+
/**
|
|
212
|
+
* How far back one row lane's source holds rows for an acquisition at the clock: the later of its horizon's served
|
|
213
|
+
* start and the oldest bar its longest-kept tier still holds; null when it names neither, or a tier keeps its rows for
|
|
214
|
+
* good (it may answer any window). A `latest` lane reads one snapshot on the live row, no history: undefined.
|
|
215
|
+
*/
|
|
216
|
+
export declare function wrunRowLaneReachFromMs(lane: Pick<WrunRowLaneDescriptor, 'landing' | 'horizon'>, extras: Readonly<Record<string, unknown>>, nowMs: number): number | null | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* Where the rows of a run's history sources begin at the clock: the warm-up decider's `sourceReachFromTs`
|
|
219
|
+
* (local-kscript-warmup-depth.util), the earliest reach among the row lane instances that read a history
|
|
220
|
+
* (`wrunRowLaneReachFromMs`). A visible first value at or after it, with it at or after the loaded start, is a
|
|
221
|
+
* source's history beginning, never a warm-up a page of older candles could fill. Null when no instance reads a
|
|
222
|
+
* history, when one names no reach, or when the run reads any other source beside the chart's candles (a poll lane, a
|
|
223
|
+
* pinned leg, a trades lane: none names its reach yet), since older candles may then still bring that source rows.
|
|
224
|
+
*/
|
|
225
|
+
export declare function wrunRunSourceReachFromMs(args: {
|
|
226
|
+
rowLanes: ReadonlyArray<Pick<WrunRowLaneInstance, 'laneKey' | 'extras'>>;
|
|
227
|
+
readsOtherSources: boolean;
|
|
228
|
+
nowMs: number;
|
|
229
|
+
}): number | null;
|
|
190
230
|
/** The ask shape a lane's own `fetch` takes, over a window. */
|
|
191
231
|
export declare function wrunRowLaneOwnAsk(extras: Readonly<Record<string, unknown>>, fromTs: number, toTs: number, intervalMs: number): WrunPollLaneFetchAsk;
|
|
192
232
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { kScriptSourceAnswerRows } from '../../chart/kscript-source-answer-budget.leaf.js';
|
|
1
2
|
import { wrunRowLaneByKey, wrunRowLaneOfClass, wrunRowLanes } from './row-lane-registry.js';
|
|
2
|
-
import { assertWrunLaneChainPlaneReadable, stableJson, wrunChainLaneStop, wrunChartOpraPlane, wrunLaneNoChainRefusal, wrunOpraPlaneStopDetail, wrunPollLaneChainAsk, wrunPollLaneChainExchange, wrunPollLaneChainGovernedExchange, wrunPollLaneChainPlane, wrunUnservedLaneInput, } from './wrun-poll-lanes.util.js';
|
|
3
|
+
import { assertWrunLaneChainPlaneReadable, stableJson, wrunChainLaneStop, wrunChartOpraPlane, wrunHostGridAsksWithinHorizon, wrunLaneNoChainRefusal, wrunOpraPlaneStopDetail, wrunPollLaneChainAsk, wrunPollLaneChainExchange, wrunPollLaneChainGovernedExchange, wrunPollLaneChainPlane, wrunUnservedLaneInput, } from './wrun-poll-lanes.util.js';
|
|
3
4
|
import { WRUN_ROW_LANE_ID_PREFIX, } from './wrun-row-lane.types.js';
|
|
4
5
|
import { assertWrunOpraLaneReadable } from '../wrun-opra-lane.util.js';
|
|
5
6
|
import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../wrun-present-bits.util.js';
|
|
6
|
-
import { wrunCellRowsWithPartialBars, wrunHostGridAsks, wrunHostGridFallbackAsks,
|
|
7
|
+
import { wrunCellRowsWithPartialBars, wrunHostBarSpanOf, wrunHostGridAsks, wrunHostGridFallbackAsks, wrunLandCellRowsOnHostBars, } from '../wrun-tier-grid.util.js';
|
|
7
8
|
/**
|
|
8
9
|
* The static plan: every input whose class a row lane serves, in declaration order, with its lane. Refused by
|
|
9
10
|
* name: a scalar input (a row lane serves cell blocks) and a celled one with no `max_cells` (the bound its blocks
|
|
@@ -230,9 +231,19 @@ export function wrunRowLaneRequired(metadata, instance) {
|
|
|
230
231
|
return metadata.inputs.some((input) => instance.inputIndexes.includes(input.index) && metadata.inputSources[input.name]?.missing !== 'empty');
|
|
231
232
|
}
|
|
232
233
|
/** The fetch options a row lane's asks carry: the native-rows path for a governed lane and a chain lane (their rows
|
|
233
|
-
* are their plane's or their chain's, never the chart market's, an index-mode one included)
|
|
234
|
+
* are their plane's or their chain's, never the chart market's, an index-mode one included); `endExclusive` for a
|
|
235
|
+
* flow or snapshot lane, whose host-grid asks end at their last bar's close (`wrunHostGridFetchTo`), so the fetch
|
|
236
|
+
* pads no inclusive bar past it (a padded ask read the next bar, one the source answer budget had left partial, and
|
|
237
|
+
* landed it there: OPTFLOW-HANG review 2026-10-20). A `latest` lane's ask keeps the padding. */
|
|
234
238
|
export function wrunRowLaneFetchOptions(lane) {
|
|
235
|
-
|
|
239
|
+
const nativeRows = lane.governed !== undefined || lane.chain !== undefined;
|
|
240
|
+
const endExclusive = lane.landing.kind !== 'latest';
|
|
241
|
+
if (!nativeRows && !endExclusive)
|
|
242
|
+
return undefined;
|
|
243
|
+
return {
|
|
244
|
+
...(nativeRows ? { nativeRows: true } : {}),
|
|
245
|
+
...(endExclusive ? { endExclusive: true } : {}),
|
|
246
|
+
};
|
|
236
247
|
}
|
|
237
248
|
/** The payload field a tiered ask names its backend tier in (`landing.tiers`, the tier's key). */
|
|
238
249
|
export const WRUN_ROW_LANE_TIER_FIELD = 'tier';
|
|
@@ -243,24 +254,31 @@ export const WRUN_ROW_LANE_TIER_FIELD = 'tier';
|
|
|
243
254
|
* the lane's own `fold` when it has one), a snapshot's bar its tier answered nothing for asked again one tier coarser
|
|
244
255
|
* where one fits and retains it when the lane's `coarserWhenEmpty` says so of the acquisition (D12), and the bars no
|
|
245
256
|
* tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty); a `latest` lane asked
|
|
246
|
-
* once over `fallback`, its rows as they come.
|
|
247
|
-
*
|
|
257
|
+
* once over `fallback`, its rows as they come. A flow sums every bucket inside its bar, so its plan reads the window's
|
|
258
|
+
* bar grid as its session grid (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME session bar of a day or longer
|
|
259
|
+
* is fit, budgeted and asked over its Globex session, from the 17:00 Chicago open before its 00:00Z stamp, never from
|
|
260
|
+
* a UTC day bucket; a snapshot keeps its stamps (D12's settlement DAY rows). `ask` is the caller's fetch (the full
|
|
261
|
+
* run's, a reconcile's). Ascending, one row per host bar.
|
|
248
262
|
*/
|
|
249
263
|
export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask) {
|
|
250
264
|
const landing = lane.landing;
|
|
251
265
|
if (landing.kind === 'latest')
|
|
252
266
|
return (await ask(extras, fallback.fromTs, fallback.toTs)).map((row) => [...row]);
|
|
267
|
+
const sessionGrid = landing.kind === 'flow' ? window.barGrid : undefined;
|
|
253
268
|
const { asks, partialBars } = wrunRowLaneAsksWithinRowBudget(wrunRowLaneAsksWithinHorizon(wrunHostGridAsks({
|
|
254
269
|
tiers: landing.tiers,
|
|
255
270
|
barOpens: window.barOpens,
|
|
256
271
|
intervalMs: window.intervalMs,
|
|
257
272
|
nowMs: window.nowMs,
|
|
258
273
|
choice: landing.tierChoice,
|
|
259
|
-
|
|
274
|
+
sessionGrid,
|
|
275
|
+
}), window, lane.horizon?.(extras, window.nowMs), sessionGrid), window, lane.rowBudget, extras, sessionGrid);
|
|
260
276
|
const fold = landing.fold;
|
|
261
277
|
const askAndLand = async (gridAsk) => {
|
|
262
278
|
const askExtras = gridAsk.tier === undefined ? extras : { ...extras, [WRUN_ROW_LANE_TIER_FIELD]: gridAsk.tier.key };
|
|
263
|
-
|
|
279
|
+
// Rows stamped at or past the ask's end belong to a bar the plan did not ask (a skipped newest bar): never land
|
|
280
|
+
// them, whatever the control answered.
|
|
281
|
+
const rows = (await ask(askExtras, gridAsk.fromMs, gridAsk.toMs)).filter((row) => Number(row[0]) < gridAsk.toMs);
|
|
264
282
|
return wrunLandCellRowsOnHostBars(rows, landing.kind, { intervalMs: window.intervalMs, barGrid: window.barGrid, tierMs: gridAsk.tier?.ms, nowMs: window.nowMs }, fold === undefined ? undefined : (group) => fold(group, askExtras));
|
|
265
283
|
};
|
|
266
284
|
const byBar = new Map();
|
|
@@ -298,66 +316,68 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
|
|
|
298
316
|
/**
|
|
299
317
|
* A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that
|
|
300
318
|
* opens before `completeFromMs` joins the partial bars, and the asks start at the first bar that ends after
|
|
301
|
-
* `servedFromMs` (an ask wholly before it is dropped).
|
|
319
|
+
* `servedFromMs` (an ask wholly before it is dropped). A bar opens and ends where its span does (`wrunHostBarSpanOf`:
|
|
320
|
+
* its session under the plan's session grid, a flow's). No horizon: the plan as the tier rule made it. The cut a
|
|
321
|
+
* host-grid poll lane's `horizon` takes too (wrun-poll-lanes.util `wrunHostGridAsksWithinHorizon`, its one home).
|
|
302
322
|
*/
|
|
303
|
-
export function wrunRowLaneAsksWithinHorizon(plan, window, horizon) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
for (const open of window.barOpens)
|
|
311
|
-
if (open < completeFrom)
|
|
312
|
-
partial.add(open);
|
|
313
|
-
let asks = plan.asks;
|
|
314
|
-
if (servedFrom !== undefined) {
|
|
315
|
-
const firstServed = window.barOpens.find((open) => wrunHostGridFetchTo(open, window.intervalMs) > servedFrom);
|
|
316
|
-
asks =
|
|
317
|
-
firstServed === undefined
|
|
318
|
-
? []
|
|
319
|
-
: plan.asks.flatMap((gridAsk) => {
|
|
320
|
-
const fromMs = Math.max(gridAsk.fromMs, firstServed);
|
|
321
|
-
return fromMs < gridAsk.toMs ? [{ ...gridAsk, fromMs }] : [];
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
return { asks, partialBars: [...partial].sort((a, b) => a - b) };
|
|
323
|
+
export function wrunRowLaneAsksWithinHorizon(plan, window, horizon, sessionGrid) {
|
|
324
|
+
return wrunHostGridAsksWithinHorizon(plan, window, horizon, sessionGrid);
|
|
325
|
+
}
|
|
326
|
+
/** A row budget's cap in rows: the source answer budget (kscript-source-answer-budget.leaf) in rows of the lane's
|
|
327
|
+
* answered width. One number for every lane, the row cache and the worker's cap; a lane never picks its own. */
|
|
328
|
+
export function wrunRowLaneMaxRows(budget) {
|
|
329
|
+
return kScriptSourceAnswerRows(budget.cellsPerRow);
|
|
325
330
|
}
|
|
326
331
|
/**
|
|
327
332
|
* A host-grid ask plan cut to a lane's row budget (`WrunRowLaneRowBudget`), before any fetch: walking the asked bars
|
|
328
|
-
* from the newest, each at its ask's tier
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
333
|
+
* from the newest, each at its ask's tier and projected for the instance's own `acquisition` (its payload: a chain
|
|
334
|
+
* lane's plane names its projection), it keeps one run of bars whose projected rows fit `maxRows` (the source answer
|
|
335
|
+
* budget in the lane's rows); every asked bar outside it joins the partial bars and the asks are cut to it (a bar is
|
|
336
|
+
* read whole or not at all).
|
|
337
|
+
* - The NEWEST bars that cannot fit even alone (a daily chart's forming day read from minutes, 262,000 SPY rows at the
|
|
338
|
+
* close) are left partial and the walk goes on to the older bars, so one heavy bar never leaves the whole window
|
|
339
|
+
* unread.
|
|
340
|
+
* - From the first bar that fits, a bar whose projection would pass the cap stops the walk there.
|
|
341
|
+
* A bar is projected, kept and cut over its span (`wrunHostBarSpanOf`: its session under the plan's session grid, a
|
|
342
|
+
* flow's) and marked partial by its stamp. No budget, or every bar fitting: the plan as it came.
|
|
332
343
|
*/
|
|
333
|
-
export function wrunRowLaneAsksWithinRowBudget(plan, window, budget) {
|
|
344
|
+
export function wrunRowLaneAsksWithinRowBudget(plan, window, budget, acquisition = {}, sessionGrid) {
|
|
334
345
|
if (budget === undefined || plan.asks.length === 0)
|
|
335
346
|
return plan;
|
|
347
|
+
const maxRows = wrunRowLaneMaxRows(budget);
|
|
336
348
|
const asked = [];
|
|
337
349
|
for (const ask of plan.asks) {
|
|
338
|
-
for (const
|
|
339
|
-
|
|
350
|
+
for (const stampMs of window.barOpens) {
|
|
351
|
+
const span = wrunHostBarSpanOf(stampMs, window.intervalMs, sessionGrid);
|
|
352
|
+
if (span.fromMs < ask.fromMs || span.fromMs >= ask.toMs)
|
|
340
353
|
continue;
|
|
341
|
-
asked.push({
|
|
354
|
+
asked.push({ stampMs, bar: { openMs: span.fromMs, endMs: span.toMs, tier: ask.tier } });
|
|
342
355
|
}
|
|
343
356
|
}
|
|
344
|
-
asked.sort((a, b) => b.openMs - a.openMs);
|
|
357
|
+
asked.sort((a, b) => b.bar.openMs - a.bar.openMs);
|
|
345
358
|
let rows = 0;
|
|
346
359
|
let keptFrom = Number.POSITIVE_INFINITY;
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
360
|
+
let keptEnd = Number.NEGATIVE_INFINITY;
|
|
361
|
+
for (const { bar } of asked) {
|
|
362
|
+
const projected = budget.barRows(bar, window.nowMs, acquisition);
|
|
363
|
+
const barRows = Number.isFinite(projected) && projected > 0 ? projected : 0;
|
|
364
|
+
if (keptEnd === Number.NEGATIVE_INFINITY && barRows > maxRows)
|
|
365
|
+
continue;
|
|
366
|
+
if (rows + barRows > maxRows)
|
|
351
367
|
break;
|
|
368
|
+
rows += barRows;
|
|
352
369
|
keptFrom = bar.openMs;
|
|
370
|
+
if (keptEnd === Number.NEGATIVE_INFINITY)
|
|
371
|
+
keptEnd = bar.endMs;
|
|
353
372
|
}
|
|
354
|
-
const cut = asked.filter((bar) => bar.openMs < keptFrom).map((
|
|
373
|
+
const cut = asked.filter(({ bar }) => bar.openMs < keptFrom || bar.endMs > keptEnd).map(({ stampMs }) => stampMs);
|
|
355
374
|
if (cut.length === 0)
|
|
356
375
|
return plan;
|
|
357
376
|
return {
|
|
358
377
|
asks: plan.asks.flatMap((ask) => {
|
|
359
378
|
const fromMs = Math.max(ask.fromMs, keptFrom);
|
|
360
|
-
|
|
379
|
+
const toMs = Math.min(ask.toMs, keptEnd);
|
|
380
|
+
return fromMs < toMs ? [{ ...ask, fromMs, toMs }] : [];
|
|
361
381
|
}),
|
|
362
382
|
partialBars: [...new Set([...plan.partialBars, ...cut])].sort((a, b) => a - b),
|
|
363
383
|
};
|
|
@@ -365,6 +385,50 @@ export function wrunRowLaneAsksWithinRowBudget(plan, window, budget) {
|
|
|
365
385
|
function finiteOrUndefined(value) {
|
|
366
386
|
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
367
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* How far back one row lane's source holds rows for an acquisition at the clock: the later of its horizon's served
|
|
390
|
+
* start and the oldest bar its longest-kept tier still holds; null when it names neither, or a tier keeps its rows for
|
|
391
|
+
* good (it may answer any window). A `latest` lane reads one snapshot on the live row, no history: undefined.
|
|
392
|
+
*/
|
|
393
|
+
export function wrunRowLaneReachFromMs(lane, extras, nowMs) {
|
|
394
|
+
if (lane.landing.kind === 'latest')
|
|
395
|
+
return undefined;
|
|
396
|
+
const horizonFrom = finiteOrUndefined(lane.horizon?.(extras, nowMs)?.servedFromMs);
|
|
397
|
+
const tiers = lane.landing.tiers ?? [];
|
|
398
|
+
const kept = tiers.map((tier) => tier.retentionMs);
|
|
399
|
+
const tierFrom = kept.length > 0 && kept.every((ms) => ms !== undefined)
|
|
400
|
+
? finiteOrUndefined(nowMs - Math.max(...kept))
|
|
401
|
+
: undefined;
|
|
402
|
+
if (horizonFrom === undefined && tierFrom === undefined)
|
|
403
|
+
return null;
|
|
404
|
+
return Math.max(horizonFrom ?? Number.NEGATIVE_INFINITY, tierFrom ?? Number.NEGATIVE_INFINITY);
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Where the rows of a run's history sources begin at the clock: the warm-up decider's `sourceReachFromTs`
|
|
408
|
+
* (local-kscript-warmup-depth.util), the earliest reach among the row lane instances that read a history
|
|
409
|
+
* (`wrunRowLaneReachFromMs`). A visible first value at or after it, with it at or after the loaded start, is a
|
|
410
|
+
* source's history beginning, never a warm-up a page of older candles could fill. Null when no instance reads a
|
|
411
|
+
* history, when one names no reach, or when the run reads any other source beside the chart's candles (a poll lane, a
|
|
412
|
+
* pinned leg, a trades lane: none names its reach yet), since older candles may then still bring that source rows.
|
|
413
|
+
*/
|
|
414
|
+
export function wrunRunSourceReachFromMs(args) {
|
|
415
|
+
if (args.readsOtherSources)
|
|
416
|
+
return null;
|
|
417
|
+
let earliest = null;
|
|
418
|
+
for (const instance of args.rowLanes) {
|
|
419
|
+
const lane = wrunRowLaneByKey(instance.laneKey);
|
|
420
|
+
if (lane === undefined)
|
|
421
|
+
return null;
|
|
422
|
+
const reach = wrunRowLaneReachFromMs(lane, instance.extras, args.nowMs);
|
|
423
|
+
if (reach === undefined)
|
|
424
|
+
continue;
|
|
425
|
+
if (reach === null)
|
|
426
|
+
return null;
|
|
427
|
+
if (earliest === null || reach < earliest)
|
|
428
|
+
earliest = reach;
|
|
429
|
+
}
|
|
430
|
+
return earliest;
|
|
431
|
+
}
|
|
368
432
|
/** The ask shape a lane's own `fetch` takes, over a window. */
|
|
369
433
|
export function wrunRowLaneOwnAsk(extras, fromTs, toTs, intervalMs) {
|
|
370
434
|
return { extras, fromTs, toTs, intervalMs };
|
|
@@ -17,6 +17,16 @@
|
|
|
17
17
|
* served class may still refuse by name at run on its own terms (an odds starter's placeholder
|
|
18
18
|
* market, `funding` serving `rate_close` alone): those limits stay with the row builder. */
|
|
19
19
|
export declare const WRUN_BROWSER_BUILTIN_SOURCE_CLASSES: readonly string[];
|
|
20
|
+
/**
|
|
21
|
+
* The kit classes the browser lane refuses by the kit's own refusal code of the class, before it reads anything of
|
|
22
|
+
* them: classes the kit's chart-browser profile serves whose reads the chart cannot make yet, so no lane serves them
|
|
23
|
+
* and the picker counts them unserved. `option_prints_v2` (kit 0.88.0, the option prints with their block and RFQ
|
|
24
|
+
* identity): the prints the chart reads carry no block or RFQ id until the protocol package names OptionPrint's
|
|
25
|
+
* `block_trade_id` and `rfq_id` (kiyotaka-go fields 32 and 33; pb-common 12.71.0 ends at field 31), and no field
|
|
26
|
+
* carries the leg count, so its lane lands with that protocol release. The record is the protocol gate's
|
|
27
|
+
* (`feed-missing` / `protocol-pending`: the app itself lacks the feed, the way out a reload).
|
|
28
|
+
*/
|
|
29
|
+
export declare const WRUN_BROWSER_REFUSED_CLASS_CODES: Readonly<Record<string, string>>;
|
|
20
30
|
/** The source class a poll-lane file serves: its base name (`lanes/volatility_index.ts` serves
|
|
21
31
|
* `volatility_index`). Undefined for anything that is not a lane file (another extension, a
|
|
22
32
|
* declaration file, a name outside the class spelling), which both readers skip. */
|
|
@@ -44,6 +44,18 @@ export const WRUN_BROWSER_BUILTIN_SOURCE_CLASSES = [
|
|
|
44
44
|
// the raw TRADE channel (wrun-tape-source.util).
|
|
45
45
|
'tape',
|
|
46
46
|
];
|
|
47
|
+
/**
|
|
48
|
+
* The kit classes the browser lane refuses by the kit's own refusal code of the class, before it reads anything of
|
|
49
|
+
* them: classes the kit's chart-browser profile serves whose reads the chart cannot make yet, so no lane serves them
|
|
50
|
+
* and the picker counts them unserved. `option_prints_v2` (kit 0.88.0, the option prints with their block and RFQ
|
|
51
|
+
* identity): the prints the chart reads carry no block or RFQ id until the protocol package names OptionPrint's
|
|
52
|
+
* `block_trade_id` and `rfq_id` (kiyotaka-go fields 32 and 33; pb-common 12.71.0 ends at field 31), and no field
|
|
53
|
+
* carries the leg count, so its lane lands with that protocol release. The record is the protocol gate's
|
|
54
|
+
* (`feed-missing` / `protocol-pending`: the app itself lacks the feed, the way out a reload).
|
|
55
|
+
*/
|
|
56
|
+
export const WRUN_BROWSER_REFUSED_CLASS_CODES = Object.freeze({
|
|
57
|
+
option_prints_v2: 'wrun_option_prints_v2_unsupported',
|
|
58
|
+
});
|
|
47
59
|
/** The source class a poll-lane file serves: its base name (`lanes/volatility_index.ts` serves
|
|
48
60
|
* `volatility_index`). Undefined for anything that is not a lane file (another extension, a
|
|
49
61
|
* declaration file, a name outside the class spelling), which both readers skip. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type WrunRowLaneInstance } from './sources/wrun-row-lane.types.js';
|
|
2
2
|
/** One coin channel to subscribe: the script source (its K control), the exchange and the coin. */
|
|
3
3
|
export interface WrunCoinLaneChannel {
|
|
4
4
|
sourceType: string;
|
|
@@ -9,8 +9,8 @@ export interface WrunCoinLaneChannel {
|
|
|
9
9
|
export declare function wrunCoinLaneSourceTypes(): ReadonlySet<string>;
|
|
10
10
|
/**
|
|
11
11
|
* The coin channels a live session's row lanes subscribe, one per (source, exchange, coin): each instance of a lane
|
|
12
|
-
* fed by coin, its acquisition the run recorded (the instance's extras when it recorded none),
|
|
13
|
-
*
|
|
12
|
+
* fed by coin, its acquisition the run recorded (the instance's extras when it recorded none), on the exchange
|
|
13
|
+
* `coinChannelExchange` names. `chartExchange` stands for a lane that reads no governed plane and no chain.
|
|
14
14
|
*/
|
|
15
15
|
export declare function wrunRowLaneCoinChannels(context: {
|
|
16
16
|
rowLanes?: ReadonlyArray<WrunRowLaneInstance>;
|
|
@@ -1,28 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The live channels of the row lanes fed by COIN (`WrunRowLaneDescriptor.liveByCoin`, UW-PARITY: the
|
|
3
|
-
*
|
|
4
|
-
* names the control, `K_<SOURCE>`, which builds the channel with `formatCoinSubChannel`),
|
|
5
|
-
* technical-script control's wrun branch already subscribes.
|
|
2
|
+
* The live channels of the row lanes fed by COIN (`WrunRowLaneDescriptor.liveByCoin`, UW-PARITY: the print class, on
|
|
3
|
+
* every chain since OPTIONS-PORT P7): one coin-scoped channel per live instance, subscribed through the lane's own K
|
|
4
|
+
* control (its script source names the control, `K_<SOURCE>`, which builds the channel with `formatCoinSubChannel`),
|
|
5
|
+
* beside the push lanes the technical-script control's wrun branch already subscribes.
|
|
6
6
|
*
|
|
7
|
-
* -
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* - The exchange the channel names: a `chain` lane's is the exchange its instance's chain lists on (the acquisition's
|
|
8
|
+
* chain field, wrun-row-lanes.util `wrunRowLaneChainExchange`: a crypto venue, OPRA, a CME Group exchange); a governed
|
|
9
|
+
* lane's is its plane's (the governed set's exchange, never a literal); any other lane's the chart's own.
|
|
10
|
+
* - A lane reading a governed exchange (a governed lane, a chain instance on OPRA or a CME Group exchange:
|
|
11
|
+
* `wrunRowLaneChainGovernedExchange`) subscribes only when its read is routed REAL-TIME (the acquisition's
|
|
12
|
+
* `servedTier`, re-read by the run before its first ask): a delayed read serves history only, the reconcile re-asks
|
|
13
|
+
* it past the embargo. A crypto chain rides no gate, so it subscribes at once.
|
|
14
|
+
* - A chain instance subscribes only on a plane where a live producer of its type streams (the lane's
|
|
15
|
+
* `liveByCoin.chainPlanes`; absent: every plane): `option_prints` names OPRA and CME, whose OPTION_PRINT producers
|
|
16
|
+
* stream, while the gateway derives a crypto venue's prints from stored trades each minute and serves them from
|
|
17
|
+
* history alone, so a crypto chain's instance subscribes nothing and the live tick's reconcile refreshes it (its
|
|
18
|
+
* answer merged by the lane's `reconcile`, by print key).
|
|
19
|
+
* - The coin is the instance's (its acquisition's `coin`, the chain's underlying); an instance naming no coin, or a
|
|
20
|
+
* chain instance naming no exchange, subscribes nothing.
|
|
11
21
|
*
|
|
12
|
-
* Pure and light: reads the row-lane registry and the OPRA lane rules only.
|
|
22
|
+
* Pure and light: reads the row-lane registry, the chain plane rules and the OPRA lane rules only.
|
|
13
23
|
*/
|
|
24
|
+
import { OPRA_GOVERNED_EXCHANGES } from '../../interfaces/opra-realtime.interface.js';
|
|
14
25
|
import { wrunRowLaneByKey, wrunRowLanes } from './sources/row-lane-registry.js';
|
|
26
|
+
import { wrunLaneChainPlaneOf, } from './sources/wrun-row-lane.types.js';
|
|
27
|
+
import { wrunRowLaneChainExchange, wrunRowLaneChainGovernedExchange } from './sources/wrun-row-lanes.util.js';
|
|
15
28
|
import { isWrunOpraLaneAcquisition, wrunOpraLaneServedTier } from './wrun-opra-lane.util.js';
|
|
16
|
-
/** The exchange a governed plane's coin channel names. */
|
|
17
|
-
const PLANE_EXCHANGE = Object.freeze({ opra:
|
|
29
|
+
/** The exchange a governed plane's coin channel names (the governed set's own, never a literal). */
|
|
30
|
+
const PLANE_EXCHANGE = Object.freeze({ opra: OPRA_GOVERNED_EXCHANGES[0] });
|
|
18
31
|
/** The script sources (upper case) every row lane fed by coin rides: the live map admits them. */
|
|
19
32
|
export function wrunCoinLaneSourceTypes() {
|
|
20
33
|
return new Set(wrunRowLanes().flatMap((lane) => (lane.liveByCoin ? [lane.liveByCoin.scriptSource.toUpperCase()] : [])));
|
|
21
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* The exchange one instance's coin channel names, or undefined when it may not subscribe now: a chain instance its
|
|
37
|
+
* chain's exchange (none named: nothing) on a plane the lane's live producer streams on (`liveByCoin.chainPlanes`), at
|
|
38
|
+
* a real-time routed tier on a governed exchange; a governed lane its plane's, at a real-time routed tier; any other
|
|
39
|
+
* lane the chart's own.
|
|
40
|
+
*/
|
|
41
|
+
function coinChannelExchange(lane, acquisition, chartExchange) {
|
|
42
|
+
if (lane.chain !== undefined) {
|
|
43
|
+
const exchange = wrunRowLaneChainExchange(lane, acquisition).trim().toUpperCase();
|
|
44
|
+
if (exchange === '')
|
|
45
|
+
return undefined;
|
|
46
|
+
const planes = lane.liveByCoin?.chainPlanes;
|
|
47
|
+
if (planes !== undefined && !planes.includes(wrunLaneChainPlaneOf(exchange)))
|
|
48
|
+
return undefined;
|
|
49
|
+
const governed = wrunRowLaneChainGovernedExchange(lane, acquisition) !== null;
|
|
50
|
+
return governed && wrunOpraLaneServedTier(acquisition) !== 'realtime' ? undefined : exchange;
|
|
51
|
+
}
|
|
52
|
+
if (lane.governed !== undefined) {
|
|
53
|
+
if (!isWrunOpraLaneAcquisition(acquisition) || wrunOpraLaneServedTier(acquisition) !== 'realtime')
|
|
54
|
+
return undefined;
|
|
55
|
+
return PLANE_EXCHANGE[lane.governed];
|
|
56
|
+
}
|
|
57
|
+
return chartExchange;
|
|
58
|
+
}
|
|
22
59
|
/**
|
|
23
60
|
* The coin channels a live session's row lanes subscribe, one per (source, exchange, coin): each instance of a lane
|
|
24
|
-
* fed by coin, its acquisition the run recorded (the instance's extras when it recorded none),
|
|
25
|
-
*
|
|
61
|
+
* fed by coin, its acquisition the run recorded (the instance's extras when it recorded none), on the exchange
|
|
62
|
+
* `coinChannelExchange` names. `chartExchange` stands for a lane that reads no governed plane and no chain.
|
|
26
63
|
*/
|
|
27
64
|
export function wrunRowLaneCoinChannels(context, chartExchange) {
|
|
28
65
|
const channels = new Map();
|
|
@@ -32,14 +69,12 @@ export function wrunRowLaneCoinChannels(context, chartExchange) {
|
|
|
32
69
|
if (lane === undefined || live === undefined)
|
|
33
70
|
continue;
|
|
34
71
|
const acquisition = context.acquisition[instance.key] ?? instance.extras;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
72
|
+
const exchange = coinChannelExchange(lane, acquisition, chartExchange);
|
|
73
|
+
if (exchange === undefined)
|
|
74
|
+
continue;
|
|
39
75
|
const coin = typeof acquisition.coin === 'string' ? acquisition.coin.trim().toUpperCase() : '';
|
|
40
76
|
if (coin === '')
|
|
41
77
|
continue;
|
|
42
|
-
const exchange = lane.governed !== undefined ? PLANE_EXCHANGE[lane.governed] : chartExchange;
|
|
43
78
|
const channel = { sourceType: live.scriptSource, exchange, coin };
|
|
44
79
|
channels.set(`${channel.sourceType}|${exchange}|${coin}`, channel);
|
|
45
80
|
}
|