@orangecharts/wrun-chart-host 0.6.0 → 0.7.1
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 +14 -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/index.d.ts +2 -0
- package/dist/settings-templates/index.js +19 -5
- package/dist/settings-templates/indicator-fields.d.ts +2 -0
- package/dist/settings-templates/indicator-fields.js +10 -0
- package/dist/settings-templates/tool-rules.d.ts +12 -2
- package/dist/settings-templates/tool-rules.js +9 -2
- package/dist/settings-templates/tool-tables.generated.js +9 -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
|
@@ -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
|
}
|
|
@@ -48,6 +48,12 @@
|
|
|
48
48
|
* change follow it, the way a timeframe or symbol param rewrites its pins.
|
|
49
49
|
* A value equal to the baked `ticks_per_bar` writes nothing; the lane util
|
|
50
50
|
* clamps it to 1..500 (`wrunVolumeProfileLaneExtras`).
|
|
51
|
+
* - A chain view's params (OPTLOAD G5, wrun-option-views.util,
|
|
52
|
+
* `optionViewParamWrites`): on an `options_chain` or `option_contract_state`
|
|
53
|
+
* input that declares views, each view param knob bound to a declared param
|
|
54
|
+
* (`"@<param>"`, or `<knob>_param` beside a literal default) takes the
|
|
55
|
+
* param's current value, the `ticks_per_bar` rule, so a settings change
|
|
56
|
+
* asks the gateway with the new values.
|
|
51
57
|
* - The lane words (kit 0.77.0, `laneWordWrites`): `currency_param` and `when`.
|
|
52
58
|
* - A Style page row (`__style__<output>__<property>`, an FE-only declared
|
|
53
59
|
* input that never reaches any host) writes the output's `width`,
|
|
@@ -48,6 +48,12 @@
|
|
|
48
48
|
* change follow it, the way a timeframe or symbol param rewrites its pins.
|
|
49
49
|
* A value equal to the baked `ticks_per_bar` writes nothing; the lane util
|
|
50
50
|
* clamps it to 1..500 (`wrunVolumeProfileLaneExtras`).
|
|
51
|
+
* - A chain view's params (OPTLOAD G5, wrun-option-views.util,
|
|
52
|
+
* `optionViewParamWrites`): on an `options_chain` or `option_contract_state`
|
|
53
|
+
* input that declares views, each view param knob bound to a declared param
|
|
54
|
+
* (`"@<param>"`, or `<knob>_param` beside a literal default) takes the
|
|
55
|
+
* param's current value, the `ticks_per_bar` rule, so a settings change
|
|
56
|
+
* asks the gateway with the new values.
|
|
51
57
|
* - The lane words (kit 0.77.0, `laneWordWrites`): `currency_param` and `when`.
|
|
52
58
|
* - A Style page row (`__style__<output>__<property>`, an FE-only declared
|
|
53
59
|
* input that never reaches any host) writes the output's `width`,
|
|
@@ -85,6 +91,7 @@ import { WRUN_SOURCE_FIELD_WORDS, wrunInputGateOn } from './wrun-market-facts.ut
|
|
|
85
91
|
import { wrunParamValuesFromSettings } from './wrun-param-values.util.js';
|
|
86
92
|
import { bindWrunColorSettings } from './wrun-color-settings.lazy.js';
|
|
87
93
|
import { WRUN_LEVELS_COLOR_PICKED_KEY } from './wrun-style-flags.util.js';
|
|
94
|
+
import { wrunOptionViewParamKnobs } from './wrun-option-views.util.js';
|
|
88
95
|
import { findWrunVisibilityTarget, wrunVisibilitySectionOfPrefix, wrunVisibilityTargetAt, } from './wrun-visibility-table.js';
|
|
89
96
|
import { isWrunHudViewerRowKey, packWrunColor, parseWrunColor, WRUN_HEATMAP_SENSITIVITY_ROW_RE, WRUN_HUD_LOOK_ROW_PREFIX, WRUN_HUD_LOOK_ROW_RE, } from './wrun-color-facts.util.js';
|
|
90
97
|
// The key predicates and the colour parse are thin facts boot-path readers take without this
|
|
@@ -1075,6 +1082,43 @@ function ticksPerBarWrites(metadata, settings) {
|
|
|
1075
1082
|
}
|
|
1076
1083
|
return writes;
|
|
1077
1084
|
}
|
|
1085
|
+
/** The param a chain view's param knob is bound to (OPTLOAD G5), in either sheet spelling, the `ticks_per_bar` ones:
|
|
1086
|
+
* `<knob>_param` beside a literal default, or the in-source reference verbatim, `<knob>: "@<param>"`. */
|
|
1087
|
+
function viewParamBinding(source, knob) {
|
|
1088
|
+
const named = source[`${knob}_param`];
|
|
1089
|
+
if (typeof named === 'string' && named !== '')
|
|
1090
|
+
return named;
|
|
1091
|
+
const reference = source[knob];
|
|
1092
|
+
return typeof reference === 'string' && reference.startsWith('@') && reference.length > 1
|
|
1093
|
+
? reference.slice(1)
|
|
1094
|
+
: undefined;
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* The chain view param bindings (OPTLOAD G5, wrun-option-views.util): on an `options_chain` or `option_contract_state`
|
|
1098
|
+
* input that declares views (`page_view` or `page_views`), every param knob of its views bound to a declared param
|
|
1099
|
+
* takes that param's current value (`wrunValueParamSetting`: the setting, else the declared default), so the lane's
|
|
1100
|
+
* ask, and a settings change's ask, carries the value the run computes with. A value equal to the knob's writes
|
|
1101
|
+
* nothing; an unknown param or a value that is not a finite number writes nothing either, so the handle reaches the
|
|
1102
|
+
* lane, which refuses it by name.
|
|
1103
|
+
*/
|
|
1104
|
+
function optionViewParamWrites(metadata, settings) {
|
|
1105
|
+
const sources = isRecord(metadata.inputSources) ? metadata.inputSources : {};
|
|
1106
|
+
const params = Array.isArray(metadata.params) ? metadata.params : [];
|
|
1107
|
+
const writes = [];
|
|
1108
|
+
for (const [name, source] of Object.entries(sources)) {
|
|
1109
|
+
if (!isRecord(source) || (source.source !== 'options_chain' && source.source !== 'option_contract_state'))
|
|
1110
|
+
continue;
|
|
1111
|
+
for (const knob of wrunOptionViewParamKnobs(source)) {
|
|
1112
|
+
const bound = viewParamBinding(source, knob);
|
|
1113
|
+
const param = bound === undefined ? undefined : params.find((candidate) => candidate.name === bound);
|
|
1114
|
+
const value = param === undefined ? undefined : wrunValueParamSetting(param, settings);
|
|
1115
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value === source[knob])
|
|
1116
|
+
continue;
|
|
1117
|
+
writes.push({ path: ['inputSources', name, knob], kind: 'value', value, create: true });
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
return writes;
|
|
1121
|
+
}
|
|
1078
1122
|
/** The lane words a setting rides (kit 0.77.0), off the param's run value (the init() number):
|
|
1079
1123
|
* `currency_param` writes the picked label ("USD" or "Coin") into `currency`; a `when` gate that
|
|
1080
1124
|
* is off marks the input `undemanded`. The browser's one authority: its plan reads neither. */
|
|
@@ -1310,6 +1354,7 @@ export function wrunSheetWithSettings(metadata, settings) {
|
|
|
1310
1354
|
...params.flatMap((param) => paramWrites(param, settings, members)),
|
|
1311
1355
|
...params.flatMap((param) => hostWrites(metadata, param, settings)),
|
|
1312
1356
|
...ticksPerBarWrites(metadata, settings),
|
|
1357
|
+
...optionViewParamWrites(metadata, settings),
|
|
1313
1358
|
...laneWordWrites(metadata, settings),
|
|
1314
1359
|
...styleRowWrites(metadata, settings),
|
|
1315
1360
|
];
|
|
@@ -158,15 +158,21 @@ export const WRUN_KSCRIPT_SOURCE_CLASSES = Object.freeze({
|
|
|
158
158
|
option_contract_state: { type: null, payload: ['market', 'chain_venue', 'book'] },
|
|
159
159
|
option_surface: { type: null, payload: ['market', 'chain_venue', 'book'] },
|
|
160
160
|
token_supply: { type: null, payload: ['token'] },
|
|
161
|
-
//
|
|
162
|
-
// (wrun_option_prints_one_acquisition), so one fetch.
|
|
163
|
-
option_prints: { type: null, payload: [] },
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
|
|
161
|
+
// The prints of the chart's chain (sources/row-lanes/option_prints, a chain lane): the package's ONE acquisition
|
|
162
|
+
// (wrun_option_prints_one_acquisition), so one fetch per venue word and book.
|
|
163
|
+
option_prints: { type: null, payload: ['chain_venue', 'book'] },
|
|
164
|
+
// The prints with their block and RFQ identity (kit 0.88.0): the same one acquisition a package, of its own class,
|
|
165
|
+
// keyed by venue word and book (`structure` filters that one read). The browser lane refuses the class by its code
|
|
166
|
+
// until the identity reaches the chart (wrun-browser-sources.leaf WRUN_BROWSER_REFUSED_CLASS_CODES).
|
|
167
|
+
option_prints_v2: { type: null, payload: ['chain_venue', 'book'] },
|
|
168
|
+
// The per-contract flow of the chart's chain (sources/row-lanes/option_contract_flow, a chain lane): one read per
|
|
169
|
+
// chart market, venue word and book at the bars' tier; only `0dte` narrows it (nearest expiries, the strike window
|
|
170
|
+
// and the volume floor fold on the chart).
|
|
171
|
+
option_contract_flow: { type: null, payload: ['market', 'expiries', 'chain_venue', 'book'] },
|
|
167
172
|
series: { type: null, payload: ['ref'] },
|
|
168
|
-
// The
|
|
169
|
-
|
|
173
|
+
// The flow scope rows of the chart's chain (sources/lanes/options_flow, a chain lane read by `auto`, its `venue` a
|
|
174
|
+
// scope's venue): one fetch per scope, dte, moneyness, venue and a ticker's book.
|
|
175
|
+
options_flow: { type: null, payload: ['scope', 'dte', 'moneyness', 'venue', 'book'] },
|
|
170
176
|
// The statistics of the chart's options chain (sources/lanes/option_daily, a chain lane): one fetch per venue word
|
|
171
177
|
// and book, as the lane plans its instances.
|
|
172
178
|
option_daily: { type: null, payload: ['chain_venue', 'book'] },
|