@orangecharts/wrun-chart-host 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/constants/feature-flags.constants.d.ts +4 -0
- package/dist/constants/feature-flags.constants.js +27 -0
- package/dist/constants/marketCapabilities.constants.d.ts +14 -9
- package/dist/constants/marketCapabilities.constants.js +36 -13
- package/dist/constants/opra-compliance.constants.d.ts +14 -0
- package/dist/constants/opra-compliance.constants.js +14 -0
- package/dist/constants/option-venues.constants.d.ts +11 -6
- package/dist/constants/option-venues.constants.js +5 -2
- package/dist/host-env.d.ts +10 -4
- package/dist/host-ports.types.d.ts +39 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
- package/dist/interfaces/opra-realtime.interface.js +10 -10
- package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +53 -10
- package/dist/kscript-data/controls/live-trades-merge.util.js +81 -16
- package/dist/market-data/billing.interface.d.ts +138 -17
- package/dist/market-data/billing.interface.js +25 -8
- package/dist/market-data/venues/index.d.ts +3 -3
- package/dist/market-data/venues/opra.contract.copy.json +5 -3
- package/dist/market-data/venues/opra.d.ts +3 -3
- package/dist/market-data/venues/opra.js +5 -4
- package/dist/replay/replayLadder.js +3 -1
- package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
- package/dist/utility/chart/crypto-index.leaf.js +2 -2
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +5 -2
- package/dist/utility/chart/index-mode.util.js +23 -13
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
- package/dist/utility/chart/kscript-venue-policy.util.js +30 -24
- package/dist/utility/chart/marketKind.util.d.ts +12 -10
- package/dist/utility/chart/marketKind.util.js +17 -7
- package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
- package/dist/utility/chart/om-panel-push-style.util.js +17 -15
- package/dist/utility/chart/om-panel.util.js +6 -6
- package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
- package/dist/utility/chart/profile-block-size.util.js +7 -0
- package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
- package/dist/utility/chart/quote-perp.leaf.js +20 -0
- package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
- package/dist/utility/chart/wrun-run-result.util.js +4 -1
- package/dist/utility/common/transformations.util.d.ts +7 -0
- package/dist/utility/common/transformations.util.js +11 -0
- package/dist/utility/options/option-venue.util.d.ts +3 -3
- package/dist/utility/options/option-venue.util.js +3 -3
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +11 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +63 -9
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +8 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +5 -2
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +11 -5
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +31 -10
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +33 -1
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +95 -6
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +55 -18
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +146 -40
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
- package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
- package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
- package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
- package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
- package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
- package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
- package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
- package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
- package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
- package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
- package/dist/utility/wrun/wrun-frames.js +5 -5
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
- package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
- package/dist/utility/wrun/wrun-live-tick.util.js +91 -38
- package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
- package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +166 -48
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +216 -33
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +314 -56
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
- package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +3 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +55 -0
- package/dist/utility/wrun/wrun-option-views.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-option-views.util.js +151 -28
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
- package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
- package/dist/utility/wrun/wrun-overlay-run.util.js +416 -171
- package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
- package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
- package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-pack.util.js +20 -9
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +27 -15
- package/dist/utility/wrun/wrun-panel-style.util.js +42 -20
- package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
- package/dist/utility/wrun/wrun-param-map.util.js +8 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
- package/dist/utility/wrun/wrun-param-values.util.js +2 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
- package/dist/utility/wrun/wrun-refusal.util.js +10 -1
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
- package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
- package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
- package/dist/workers/utils/volume-profile.worker.util.js +5 -2
- package/dist/workers/wrun/wrun-abi-host.js +3 -2
- package/package.json +11 -11
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* written once over the descriptor, so no consumer names a lane.
|
|
5
5
|
*
|
|
6
6
|
* - `planWrunRowLaneInputs`: the STATIC plan, from the sheet alone: each input of a row-lane class, which must be
|
|
7
|
-
* celled with a `max_cells` (refused by name otherwise)
|
|
7
|
+
* celled with a `max_cells` (refused by name otherwise), and the tuples its module holds a bar's block in (the
|
|
8
|
+
* sheet's `capacity ?? max_cells`, a capacity no build writes refused by name). The run pass runs it before any
|
|
9
|
+
* fetch and the row builder before any row.
|
|
8
10
|
* - `planWrunRowLanes`: the run's plan against the chart, before any fetch, of every input the market demands (an
|
|
9
11
|
* undemanded one is planned nowhere): the OPRA wall, the chart's admission, the lane's identity (once per lane) and
|
|
10
12
|
* each input's facets, grouped into instances (equal facets share one fetch and one buffer; an
|
|
@@ -17,14 +19,17 @@
|
|
|
17
19
|
* `missing: "empty"`).
|
|
18
20
|
* - `fetchWrunRowLaneRows`: a lane's rows over a chart window: its asks under the tier rule, landed on the host
|
|
19
21
|
* bars, the partial bars marked (a `latest` lane asked once, its rows as they come), a row-budget lane's newest bars
|
|
20
|
-
* first (wrun-row-lane-first-paint.util
|
|
22
|
+
* first, cut on a trade date's first bar where the chart reads one (wrun-row-lane-first-paint.util; a full run's
|
|
23
|
+
* first paint draws them before the older bars land, `onFirstSlice`), and so an instance's whose facets ask a
|
|
24
|
+
* per-bar word (OPTLOAD G5); every
|
|
21
25
|
* packed block a worker transferred split into plain tuples of the instance's width as it lands
|
|
22
26
|
* (`wrunRowLanePlainRow`).
|
|
23
27
|
* - an option knob naming a setting read as its value before a lane's facets judge it (`resolveWrunOptionSettingKnobs`).
|
|
24
28
|
* - `wrunRowLaneCellRows`: the row builder's read of one input: the lane's host-bar rows as cell blocks on the
|
|
25
29
|
* chart's grid (exact width, finite values or NaN outside a lane's `finiteColumns`, the lane's per-input
|
|
26
|
-
* projection
|
|
27
|
-
*
|
|
30
|
+
* projection, after its window-level pass over every held bar where it declares one, with a partial bar kept partial
|
|
31
|
+
* unless the class carries no `present` mask; a view block, the block of an input whose words name a fold, as it
|
|
32
|
+
* is, `wrunRowLaneAtWidth`; a `latest` lane on the live row).
|
|
28
33
|
* - `wrunRowLaneReachFromMs` / `wrunRunSourceReachFromMs`: how far back a lane's source holds rows (its horizon, its
|
|
29
34
|
* longest-kept tier), and where a run's history sources begin, which the warm-up decider reads so a first value a
|
|
30
35
|
* source's history explains never buys a page of older candles.
|
|
@@ -44,13 +49,19 @@ export interface WrunRowLaneInput {
|
|
|
44
49
|
source: WrunInputSource;
|
|
45
50
|
lane: WrunRowLaneDescriptor;
|
|
46
51
|
maxCells: number;
|
|
52
|
+
/** The tuples a bar's block may hold in the run's module (wrun-cell-capacity.leaf `wrunSheetCellBlockTuples`: the
|
|
53
|
+
* sheet's `capacity ?? max_cells`, a print union's whole only where the capacity holds it), the bound the packer
|
|
54
|
+
* refuses past: the row builder hands it to the input's projection. */
|
|
55
|
+
capacity: number;
|
|
47
56
|
}
|
|
48
57
|
/**
|
|
49
|
-
* The static plan: every input whose class a row lane serves, in declaration order, with its lane
|
|
50
|
-
* name: a scalar input (a row lane serves cell blocks)
|
|
51
|
-
*
|
|
52
|
-
* (
|
|
53
|
-
*
|
|
58
|
+
* The static plan: every input whose class a row lane serves, in declaration order, with its lane and its module's
|
|
59
|
+
* bound (`capacity`, `wrunSheetCellBlockTuples`). Refused by name: a scalar input (a row lane serves cell blocks), a
|
|
60
|
+
* celled one with no `max_cells` (the bound its blocks are packed under) and a capacity no build writes
|
|
61
|
+
* (`wrun_cell_capacity_invalid`). Empty when the sheet reads no row-lane class. The lane's width follows the input's
|
|
62
|
+
* own words (wrun-option-views.util `wrunOptionInputTupleWidth`, the SDK's one rule: a page view fold's view block,
|
|
63
|
+
* the strike kit fold's 14-value rows), so the row builder reads and hands on the block each input's words make; a
|
|
64
|
+
* block of another width than its class's is read as it is (`wrunRowLaneAtWidth`).
|
|
54
65
|
*/
|
|
55
66
|
export declare function planWrunRowLaneInputs(metadata: WrunIndicatorMetadata): WrunRowLaneInput[];
|
|
56
67
|
/** The id of the instance `extras` names: `row:<laneKey>` when the ask carries no extras, else the extras'
|
|
@@ -184,6 +195,19 @@ export interface WrunRowLaneWindow {
|
|
|
184
195
|
intervalMs: number;
|
|
185
196
|
barGrid?: LiveBucketVenue | null;
|
|
186
197
|
nowMs: number;
|
|
198
|
+
/** The chart's trade date of a bar (its `time.trade_date`, epoch seconds), on which every run cuts a row-budget
|
|
199
|
+
* lane's slice so the slice holds whole sessions (wrun-row-lane-first-paint.util `wrunRowLaneFirstPaintSplit`): a
|
|
200
|
+
* first paint's asks and a later run's are the same windows. Absent: the plain cut, and no early answer. */
|
|
201
|
+
tradeDateOf?: (barOpenMs: number) => number;
|
|
202
|
+
}
|
|
203
|
+
/** What a row lane's fetch hands its caller beside the whole answer (`fetchWrunRowLaneRows`). */
|
|
204
|
+
export interface WrunRowLaneFetchOptions {
|
|
205
|
+
/**
|
|
206
|
+
* The first-paint slice's own answer, before the older asks land: called at most once, with the slice's rows, every
|
|
207
|
+
* bar it holds back read partial (bit 14), and the slice's first bar (`sliceFromTs`: every bar before it is held).
|
|
208
|
+
* Only a full run's first paint asks for it (wrun-overlay-run.util `runWrunSourceLanes`, the lane's early rows).
|
|
209
|
+
*/
|
|
210
|
+
onFirstSlice?: (rows: unknown[][], sliceFromTs: number) => void;
|
|
187
211
|
}
|
|
188
212
|
/**
|
|
189
213
|
* A row lane's rows over a chart window `[barOpens[0], last bar's end)`: a flow or snapshot lane's asks under the
|
|
@@ -191,17 +215,28 @@ export interface WrunRowLaneWindow {
|
|
|
191
215
|
* extras), cut to its horizon and its row budget, each answer landed on the host bars (`wrunLandCellRowsOnHostBars`,
|
|
192
216
|
* the lane's own `fold` when it has one), a snapshot's bar its tier answered nothing for asked again one tier coarser
|
|
193
217
|
* where one fits and retains it when the lane's `coarserWhenEmpty` says so of the acquisition (D12), and the bars no
|
|
194
|
-
* tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
218
|
+
* tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty; never on an instance its
|
|
219
|
+
* facets widen, whose rows carry no mask: `wrunRowLaneAtWidth`); a `latest` lane asked once over `fallback`, its rows
|
|
220
|
+
* as they come. A flow sums every bucket inside its bar, so its plan reads the window's bar grid as its session grid
|
|
221
|
+
* (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME session bar of a day or longer is fit, budgeted and asked over
|
|
222
|
+
* its Globex session, from the 17:00 Chicago open before its 00:00Z stamp, never from a UTC day bucket; a snapshot
|
|
223
|
+
* keeps its stamps (D12's settlement DAY rows). `ask` is the caller's fetch (the full run's, a reconcile's).
|
|
224
|
+
* Ascending, one row per host bar.
|
|
225
|
+
*
|
|
226
|
+
* A row-budget lane's first-paint slice is cut on a trade date's first bar wherever the chart reads trade dates
|
|
227
|
+
* (`window.tradeDateOf`), on every run, so it holds whole sessions and every run asks the same windows.
|
|
228
|
+
* `opts.onFirstSlice` (a full run's first paint): every ask still leaves at once and the promise still answers the
|
|
229
|
+
* whole window, but the slice's own answer is handed over first, once, if it lands with rows while an older ask is
|
|
230
|
+
* still out a macrotask later: the slice's rows, every older bar the projection reads rows for read partial
|
|
231
|
+
* (wrun-row-lane-first-paint.util `wrunRowLaneFirstSliceHeldBars`), and the slice's first bar. Never when no cut falls
|
|
232
|
+
* on a session's first bar (a session longer than the slice: the plain split, asked as today), for a block with no
|
|
233
|
+
* `present` mask (it cannot read a bar as partial), a kit fold carrying the next bar (its pages ask one at a time), or
|
|
234
|
+
* a snapshot whose empty bars ask a coarser tier (that pass would ask the slice's bars again).
|
|
200
235
|
*/
|
|
201
236
|
export declare function fetchWrunRowLaneRows(lane: WrunRowLaneDescriptor, extras: Readonly<Record<string, unknown>>, window: WrunRowLaneWindow, fallback: {
|
|
202
237
|
fromTs: number;
|
|
203
238
|
toTs: number;
|
|
204
|
-
}, ask: (extras: Readonly<Record<string, unknown>>, fromTs: number, toTs: number) => Promise<ReadonlyArray<ReadonlyArray<unknown
|
|
239
|
+
}, ask: (extras: Readonly<Record<string, unknown>>, fromTs: number, toTs: number) => Promise<ReadonlyArray<ReadonlyArray<unknown>>>, opts?: WrunRowLaneFetchOptions): Promise<unknown[][]>;
|
|
205
240
|
/**
|
|
206
241
|
* A landed row with every packed block (a Float64Array a worker handed the page by transfer, `count x width` values back
|
|
207
242
|
* to back: OPTLOAD G5 O6) split into plain tuples of `width` values, every other cell as it is; a new array. The one
|
|
@@ -290,9 +325,11 @@ export declare function wrunRowLaneOwnAsk(extras: Readonly<Record<string, unknow
|
|
|
290
325
|
* bar the lane holds no row for reads a present EMPTY block). A PARTIAL bar stays partial through the projection
|
|
291
326
|
* (`wrunProjectedBlock`). A `latest` lane's newest row lands on the LIVE row alone (`liveTs`, the chart's last row;
|
|
292
327
|
* the options chain's rule) whatever its stamp, every other row reading an empty block. `afterTs` (a tail build's
|
|
293
|
-
* carry) keeps the rows stamped after it, except a `latest` lane's newest.
|
|
328
|
+
* carry) keeps the rows stamped after it, except a `latest` lane's newest. An input reading a window-level pass
|
|
329
|
+
* (`cellsWindow`) reads every row the lane holds first, whatever `afterTs` keeps, and each bar's projection reads the
|
|
330
|
+
* answer.
|
|
294
331
|
*/
|
|
295
|
-
export declare function wrunRowLaneCellRows(lane: Pick<WrunRowLaneDescriptor, 'width' | 'landing' | 'cells' | 'finiteColumns' | 'presentMask'>, rows: ReadonlyArray<ReadonlyArray<unknown>>, input: WrunRowLaneCellInput, opts?: {
|
|
332
|
+
export declare function wrunRowLaneCellRows(lane: Pick<WrunRowLaneDescriptor, 'width' | 'landing' | 'cells' | 'cellsWindow' | 'finiteColumns' | 'presentMask'>, rows: ReadonlyArray<ReadonlyArray<unknown>>, input: WrunRowLaneCellInput, opts?: {
|
|
296
333
|
liveTs?: number;
|
|
297
334
|
afterTs?: number;
|
|
298
335
|
}): Array<{
|
|
@@ -3,16 +3,33 @@ import { wrunRowLaneByKey, wrunRowLaneOfClass, wrunRowLanes } from './row-lane-r
|
|
|
3
3
|
import { assertWrunLaneChainPlaneReadable, stableJson, wrunChainLaneStop, wrunChartOpraPlane, wrunHostGridAsksWithinHorizon, wrunLaneNoChainRefusal, wrunOpraPlaneStopDetail, wrunPollLaneChainAsk, wrunPollLaneChainExchange, wrunPollLaneChainGovernedExchange, wrunPollLaneChainPlane, resolveWrunOptionSettingKnobs, wrunUnservedLaneInput, } from './wrun-poll-lanes.util.js';
|
|
4
4
|
import { WRUN_ROW_LANE_ID_PREFIX, } from './wrun-row-lane.types.js';
|
|
5
5
|
import { assertWrunOpraLaneReadable } from '../wrun-opra-lane.util.js';
|
|
6
|
+
import { wrunSheetCellBlockTuples } from '../wrun-cell-capacity.leaf.js';
|
|
6
7
|
import { WRUN_OPTION_FLOW_TODAY_FIELD, wrunOptionFlowTodayFromOf } from '../wrun-option-contract-flow.util.js';
|
|
7
8
|
import { wrunOptionInputTupleWidth, wrunOptionKitBarHasRows, wrunOptionLaneCarriesNext, wrunOptionLaneFirstPaintBudget, wrunOptionLaneTupleWidth, } from '../wrun-option-views.util.js';
|
|
8
9
|
import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../wrun-present-bits.util.js';
|
|
9
10
|
import { wrunCellRowsWithPartialBars, wrunHostBarSpanOf, wrunHostGridAsks, wrunHostGridFallbackAsks, wrunLandCellRowsOnHostBars, } from '../wrun-tier-grid.util.js';
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* the
|
|
12
|
+
* A row lane at the width an input's words or an instance's facets make its block (wrun-option-views.util
|
|
13
|
+
* `wrunOptionInputTupleWidth`, `wrunOptionLaneTupleWidth`): the lane itself at its class's tuple width; at any other
|
|
14
|
+
* width a VIEW BLOCK (a page view fold's rows, the strike kit fold's: column 0 each row's layout, the widest layout's
|
|
15
|
+
* fields after it), read as the SDK's adapter reads one (kit `wrunCellBlockIsViewRows`, `kscriptViewRows`): every row
|
|
16
|
+
* of the width whole, a member that is no finite number NaN (`finiteColumns: []`), and no `present` mask
|
|
17
|
+
* (`presentMask: false`), so nothing reads or writes bit 14 in its last column, a fold's field or padding. Under the
|
|
18
|
+
* class tuple's rules Top Contracts' totals row (ending with `put_change`) marked every other row of the block partial
|
|
19
|
+
* at a change of 20,000 (bit 14 set), and was dropped whole on a block its knobs keep empty (no strike: `low_strike`
|
|
20
|
+
* and `high_strike` NaN).
|
|
21
|
+
*/
|
|
22
|
+
function wrunRowLaneAtWidth(lane, width) {
|
|
23
|
+
return width === lane.width ? lane : { ...lane, width, finiteColumns: [], presentMask: false };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The static plan: every input whose class a row lane serves, in declaration order, with its lane and its module's
|
|
27
|
+
* bound (`capacity`, `wrunSheetCellBlockTuples`). Refused by name: a scalar input (a row lane serves cell blocks), a
|
|
28
|
+
* celled one with no `max_cells` (the bound its blocks are packed under) and a capacity no build writes
|
|
29
|
+
* (`wrun_cell_capacity_invalid`). Empty when the sheet reads no row-lane class. The lane's width follows the input's
|
|
30
|
+
* own words (wrun-option-views.util `wrunOptionInputTupleWidth`, the SDK's one rule: a page view fold's view block,
|
|
31
|
+
* the strike kit fold's 14-value rows), so the row builder reads and hands on the block each input's words make; a
|
|
32
|
+
* block of another width than its class's is read as it is (`wrunRowLaneAtWidth`).
|
|
16
33
|
*/
|
|
17
34
|
export function planWrunRowLaneInputs(metadata) {
|
|
18
35
|
const planned = [];
|
|
@@ -38,8 +55,9 @@ export function planWrunRowLaneInputs(metadata) {
|
|
|
38
55
|
inputIndex: input.index,
|
|
39
56
|
inputName: input.name,
|
|
40
57
|
source,
|
|
41
|
-
lane:
|
|
58
|
+
lane: wrunRowLaneAtWidth(lane, width),
|
|
42
59
|
maxCells,
|
|
60
|
+
capacity: wrunSheetCellBlockTuples(metadata, input),
|
|
43
61
|
});
|
|
44
62
|
}
|
|
45
63
|
return planned;
|
|
@@ -283,17 +301,30 @@ export const WRUN_ROW_LANE_TIER_FIELD = 'tier';
|
|
|
283
301
|
* extras), cut to its horizon and its row budget, each answer landed on the host bars (`wrunLandCellRowsOnHostBars`,
|
|
284
302
|
* the lane's own `fold` when it has one), a snapshot's bar its tier answered nothing for asked again one tier coarser
|
|
285
303
|
* where one fits and retains it when the lane's `coarserWhenEmpty` says so of the acquisition (D12), and the bars no
|
|
286
|
-
* tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
304
|
+
* tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty; never on an instance its
|
|
305
|
+
* facets widen, whose rows carry no mask: `wrunRowLaneAtWidth`); a `latest` lane asked once over `fallback`, its rows
|
|
306
|
+
* as they come. A flow sums every bucket inside its bar, so its plan reads the window's bar grid as its session grid
|
|
307
|
+
* (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME session bar of a day or longer is fit, budgeted and asked over
|
|
308
|
+
* its Globex session, from the 17:00 Chicago open before its 00:00Z stamp, never from a UTC day bucket; a snapshot
|
|
309
|
+
* keeps its stamps (D12's settlement DAY rows). `ask` is the caller's fetch (the full run's, a reconcile's).
|
|
310
|
+
* Ascending, one row per host bar.
|
|
311
|
+
*
|
|
312
|
+
* A row-budget lane's first-paint slice is cut on a trade date's first bar wherever the chart reads trade dates
|
|
313
|
+
* (`window.tradeDateOf`), on every run, so it holds whole sessions and every run asks the same windows.
|
|
314
|
+
* `opts.onFirstSlice` (a full run's first paint): every ask still leaves at once and the promise still answers the
|
|
315
|
+
* whole window, but the slice's own answer is handed over first, once, if it lands with rows while an older ask is
|
|
316
|
+
* still out a macrotask later: the slice's rows, every older bar the projection reads rows for read partial
|
|
317
|
+
* (wrun-row-lane-first-paint.util `wrunRowLaneFirstSliceHeldBars`), and the slice's first bar. Never when no cut falls
|
|
318
|
+
* on a session's first bar (a session longer than the slice: the plain split, asked as today), for a block with no
|
|
319
|
+
* `present` mask (it cannot read a bar as partial), a kit fold carrying the next bar (its pages ask one at a time), or
|
|
320
|
+
* a snapshot whose empty bars ask a coarser tier (that pass would ask the slice's bars again).
|
|
292
321
|
*/
|
|
293
|
-
export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask) {
|
|
322
|
+
export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask, opts = {}) {
|
|
294
323
|
const landing = lane.landing;
|
|
295
|
-
// The instance's rows are its facets' (a strike kit fold's 14-value rows), read as plain tuples once landed
|
|
296
|
-
|
|
324
|
+
// The instance's rows are its facets' (a strike kit fold's 14-value rows), read as plain tuples once landed; at
|
|
325
|
+
// another width than the class's they carry no `present` mask (`wrunRowLaneAtWidth`).
|
|
326
|
+
const sized = wrunRowLaneAtWidth(lane, wrunOptionLaneTupleWidth(lane.sourceClass, extras, lane.width));
|
|
327
|
+
const width = sized.width;
|
|
297
328
|
if (landing.kind === 'latest') {
|
|
298
329
|
return (await ask(extras, fallback.fromTs, fallback.toTs)).map((row) => wrunRowLanePlainRow(row, width));
|
|
299
330
|
}
|
|
@@ -313,9 +344,24 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
|
|
|
313
344
|
// and so are an instance's whose facets ask a per-bar word of the gateway (OPTLOAD G5: a surface pick, the strike kit
|
|
314
345
|
// fold), sized by the rows its answer holds; every other instance asks as the tier rule made it.
|
|
315
346
|
const sliceBudget = lane.rowBudget ?? wrunOptionLaneFirstPaintBudget(lane.sourceClass, extras, lane.width);
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
347
|
+
const firstPaint = sliceBudget === undefined ? undefined : await import('./wrun-row-lane-first-paint.util.js');
|
|
348
|
+
// The slice is cut on a trade date's first bar wherever the chart reads trade dates (`window.tradeDateOf`), so it
|
|
349
|
+
// holds whole sessions, on every run alike: a first paint asks the windows a later run asks (one cache entry each).
|
|
350
|
+
const split = firstPaint === undefined || sliceBudget === undefined
|
|
351
|
+
? undefined
|
|
352
|
+
: firstPaint.wrunRowLaneFirstPaintSplit(asks, window, sliceBudget, budgetAcquisition, sessionGrid, window.tradeDateOf);
|
|
353
|
+
const ordered = split === undefined ? asks : [...split.first, ...split.older];
|
|
354
|
+
// The bars the slice's early answer holds back (`opts.onFirstSlice`), or undefined when it has none.
|
|
355
|
+
const coarserPass = landing.kind === 'snapshot' && landing.tiers !== undefined && landing.coarserWhenEmpty?.(extras) === true;
|
|
356
|
+
const heldBack = opts.onFirstSlice === undefined ||
|
|
357
|
+
firstPaint === undefined ||
|
|
358
|
+
split === undefined ||
|
|
359
|
+
sliceBudget === undefined ||
|
|
360
|
+
sized.presentMask === false ||
|
|
361
|
+
coarserPass ||
|
|
362
|
+
wrunOptionLaneCarriesNext(lane.sourceClass, extras)
|
|
363
|
+
? undefined
|
|
364
|
+
: firstPaint.wrunRowLaneFirstSliceHeldBars(split, window, sliceBudget, budgetAcquisition, sessionGrid);
|
|
319
365
|
const fold = landing.fold;
|
|
320
366
|
// `askToMs` reads past the ask's own end (a kit fold's seam, below); only the ask's own bars ever land.
|
|
321
367
|
const askAndLand = async (gridAsk, askToMs = gridAsk.toMs) => {
|
|
@@ -326,8 +372,50 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
|
|
|
326
372
|
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)).map((row) => wrunRowLanePlainRow(row, width));
|
|
327
373
|
};
|
|
328
374
|
const byBar = new Map();
|
|
329
|
-
|
|
330
|
-
|
|
375
|
+
const landAll = (gridAsks) => Promise.all(gridAsks.map((gridAsk) => askAndLand(gridAsk)));
|
|
376
|
+
if (heldBack !== undefined && split !== undefined && opts.onFirstSlice !== undefined) {
|
|
377
|
+
// Every ask leaves at once, as below; the slice's answer is handed over first while an older ask is still out.
|
|
378
|
+
const onFirstSlice = opts.onFirstSlice;
|
|
379
|
+
// The slice's first bar: the first bar the cut keeps (every bar before it is held).
|
|
380
|
+
const cutMs = split.sliceFromMs ?? Number.POSITIVE_INFINITY;
|
|
381
|
+
const sliceFromTs = window.barOpens.find((stampMs) => wrunHostBarSpanOf(stampMs, window.intervalMs, sessionGrid).fromMs >= cutMs);
|
|
382
|
+
const firstLanded = landAll(split.first);
|
|
383
|
+
const olderLanded = landAll(split.older);
|
|
384
|
+
let olderSettled = false;
|
|
385
|
+
void olderLanded.then(() => {
|
|
386
|
+
olderSettled = true;
|
|
387
|
+
}, () => {
|
|
388
|
+
olderSettled = true;
|
|
389
|
+
});
|
|
390
|
+
void firstLanded
|
|
391
|
+
.then(async (answers) => {
|
|
392
|
+
// One macrotask before the handover is judged: older asks that answered in the same turn (a cache) settle
|
|
393
|
+
// first, so a window already whole never draws half of itself and a rung to adopt the rest.
|
|
394
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
395
|
+
if (olderSettled || sliceFromTs === undefined)
|
|
396
|
+
return;
|
|
397
|
+
const held = new Set(heldBack);
|
|
398
|
+
const slice = new Map();
|
|
399
|
+
for (const landed of answers) {
|
|
400
|
+
for (const row of landed)
|
|
401
|
+
if (!held.has(Number(row[0])))
|
|
402
|
+
slice.set(Number(row[0]), row);
|
|
403
|
+
}
|
|
404
|
+
if (slice.size === 0)
|
|
405
|
+
return;
|
|
406
|
+
const rows = [...slice.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
|
|
407
|
+
onFirstSlice(wrunCellRowsWithPartialBars(rows, [...new Set([...partialBars, ...heldBack])], width), sliceFromTs);
|
|
408
|
+
}, () => undefined)
|
|
409
|
+
// A failed handover only costs the early picture: the whole answer still comes.
|
|
410
|
+
.catch(() => undefined);
|
|
411
|
+
const [firstAnswers, olderAnswers] = await Promise.all([firstLanded, olderLanded]);
|
|
412
|
+
for (const landed of [...firstAnswers, ...olderAnswers]) {
|
|
413
|
+
for (const row of landed)
|
|
414
|
+
byBar.set(Number(row[0]), row);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
else if (!wrunOptionLaneCarriesNext(lane.sourceClass, extras)) {
|
|
418
|
+
for (const landed of await landAll(ordered)) {
|
|
331
419
|
for (const row of landed)
|
|
332
420
|
byBar.set(Number(row[0]), row);
|
|
333
421
|
}
|
|
@@ -366,8 +454,9 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
|
|
|
366
454
|
}
|
|
367
455
|
}
|
|
368
456
|
const landed = [...byBar.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
|
|
369
|
-
// A
|
|
370
|
-
|
|
457
|
+
// A block with no `present` mask (its class's, or an instance's its facets widen) marks nothing: a partial bar asked
|
|
458
|
+
// nothing and reads an empty block.
|
|
459
|
+
return sized.presentMask === false ? landed : wrunCellRowsWithPartialBars(landed, partialBars, width);
|
|
371
460
|
}
|
|
372
461
|
/**
|
|
373
462
|
* Where a kit fold page carrying the next bar's strikes is read to (the paging seam, OPTLOAD G5): through the end of the
|
|
@@ -570,9 +659,10 @@ function wrunCellMember(member) {
|
|
|
570
659
|
/** A row's tuples as the host's exact adapter reads them: arrays of exactly `width` numbers, finite in every column
|
|
571
660
|
* (the kit's rule for an exact class: any other tuple is dropped whole), or, for a lane naming its `finiteColumns`,
|
|
572
661
|
* finite in those columns while any other column that is not a finite number reads NaN (om's adapter for such a
|
|
573
|
-
* class: a null, a missing member or an infinity is NaN, never 0
|
|
574
|
-
*
|
|
575
|
-
*
|
|
662
|
+
* class: a null, a missing member or an infinity is NaN, never 0; a view block names none, so every row of its width
|
|
663
|
+
* is read, `wrunRowLaneAtWidth`). A packed block (a Float64Array of `count x width` values, a worker's transfer)
|
|
664
|
+
* reads as its tuples back to back, each under the same rule; a block that is no whole number of tuples is skipped
|
|
665
|
+
* like any cell of another shape. */
|
|
576
666
|
function exactTuples(row, lane) {
|
|
577
667
|
const { width, finiteColumns } = lane;
|
|
578
668
|
const tuples = [];
|
|
@@ -608,10 +698,11 @@ function exactTuples(row, lane) {
|
|
|
608
698
|
* (bit 14 of the `present` mask, the last column): when any of the bar's tuples says partial (a bar no fitting tier
|
|
609
699
|
* retains, or the marker tuple of one that holds none), every tuple the projection keeps or rebuilds carries bit 14,
|
|
610
700
|
* and a block the projection empties reads the marker tuple, so a package never reads missing history as a quiet bar.
|
|
611
|
-
* A
|
|
701
|
+
* A block with no `present` mask (`presentMask: false`: its class's, or a view block's, `wrunRowLaneAtWidth`) is
|
|
702
|
+
* projected as it is: its last column is a value.
|
|
612
703
|
*/
|
|
613
|
-
function wrunProjectedBlock(lane, tuples, input) {
|
|
614
|
-
const projected = lane.cells ? lane.cells(tuples, input) : tuples;
|
|
704
|
+
function wrunProjectedBlock(lane, tuples, input, bar) {
|
|
705
|
+
const projected = lane.cells ? lane.cells(tuples, input, bar) : tuples;
|
|
615
706
|
if (lane.presentMask === false)
|
|
616
707
|
return projected;
|
|
617
708
|
if (!tuples.some((tuple) => wrunPresentIsPartial(tuple[tuple.length - 1])))
|
|
@@ -625,27 +716,42 @@ function wrunProjectedBlock(lane, tuples, input) {
|
|
|
625
716
|
* bar the lane holds no row for reads a present EMPTY block). A PARTIAL bar stays partial through the projection
|
|
626
717
|
* (`wrunProjectedBlock`). A `latest` lane's newest row lands on the LIVE row alone (`liveTs`, the chart's last row;
|
|
627
718
|
* the options chain's rule) whatever its stamp, every other row reading an empty block. `afterTs` (a tail build's
|
|
628
|
-
* carry) keeps the rows stamped after it, except a `latest` lane's newest.
|
|
719
|
+
* carry) keeps the rows stamped after it, except a `latest` lane's newest. An input reading a window-level pass
|
|
720
|
+
* (`cellsWindow`) reads every row the lane holds first, whatever `afterTs` keeps, and each bar's projection reads the
|
|
721
|
+
* answer.
|
|
629
722
|
*/
|
|
630
723
|
export function wrunRowLaneCellRows(lane, rows, input, opts = {}) {
|
|
631
|
-
|
|
724
|
+
// The input's window-level pass, if it reads one: every held bar's exact tuples, read once, then each bar's
|
|
725
|
+
// projection reads its answer.
|
|
726
|
+
const windowPass = lane.cellsWindow?.(input);
|
|
727
|
+
const bars = windowPass === undefined
|
|
728
|
+
? undefined
|
|
729
|
+
: rows.map((row) => ({ openMs: Number(row[0]), tuples: exactTuples(row, lane) }));
|
|
730
|
+
const window = windowPass === undefined || bars === undefined
|
|
731
|
+
? undefined
|
|
732
|
+
: windowPass(bars.filter((bar) => Number.isFinite(bar.openMs)));
|
|
733
|
+
const project = (at) => {
|
|
734
|
+
const tuples = bars?.[at].tuples ?? exactTuples(rows[at], lane);
|
|
735
|
+
const bar = bars === undefined ? undefined : { openMs: Number(rows[at][0]), window };
|
|
736
|
+
return wrunProjectedBlock(lane, tuples, input, bar).flatMap((tuple) => [...tuple]);
|
|
737
|
+
};
|
|
632
738
|
if (lane.landing.kind === 'latest') {
|
|
633
739
|
if (opts.liveTs === undefined || !Number.isFinite(opts.liveTs))
|
|
634
740
|
return [];
|
|
635
|
-
let newest;
|
|
636
|
-
|
|
741
|
+
let newest = -1;
|
|
742
|
+
rows.forEach((row, at) => {
|
|
637
743
|
const ts = Number(row[0]);
|
|
638
|
-
if (Number.isFinite(ts) && (newest
|
|
639
|
-
newest =
|
|
640
|
-
}
|
|
641
|
-
return newest
|
|
744
|
+
if (Number.isFinite(ts) && (newest < 0 || ts > Number(rows[newest][0])))
|
|
745
|
+
newest = at;
|
|
746
|
+
});
|
|
747
|
+
return newest < 0 ? [] : [{ ts: opts.liveTs, cells: project(newest) }];
|
|
642
748
|
}
|
|
643
749
|
const out = [];
|
|
644
|
-
|
|
750
|
+
rows.forEach((row, at) => {
|
|
645
751
|
const ts = Number(row[0]);
|
|
646
752
|
if (!Number.isFinite(ts) || (opts.afterTs !== undefined && ts <= opts.afterTs))
|
|
647
|
-
|
|
648
|
-
out.push({ ts, cells: project(
|
|
649
|
-
}
|
|
753
|
+
return;
|
|
754
|
+
out.push({ ts, cells: project(at) });
|
|
755
|
+
});
|
|
650
756
|
return out;
|
|
651
757
|
}
|
|
@@ -51,13 +51,19 @@
|
|
|
51
51
|
* it keeps the hover text (the mount door's, and the mount's re-registration after a pass that
|
|
52
52
|
* failed part way); the boot-path hover inspector calls it through the thin registry and never
|
|
53
53
|
* imports this module.
|
|
54
|
+
* - The caption's and the hover's number words (r11, Big Trades 0.7.0 "Size shown as"): THE one format list,
|
|
55
|
+
* WRUN_BATCHED_NUMBER_FORMATS (wrun-batched-readout.util), which the gate's vocabulary and the engine settings read
|
|
56
|
+
* here. `usd` prints dollars, `units` a mark's quantity in the market's own unit: its dollar value over the record's
|
|
57
|
+
* price times the market's dollar unit, which every build hands in (`valuePerUnit`, the run's
|
|
58
|
+
* `wrunMarketDollarUnit`) and a marks child carries on its settings (the engine's caption) and its readout (the
|
|
59
|
+
* hover). Where no unit is proven the engine is handed `usd` in place of `units`, never a wrong number.
|
|
54
60
|
*/
|
|
55
61
|
import type { WrunBatchedMarksKind, WrunBatchedSection, WrunIndicatorMetadata, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
|
|
56
62
|
import { type WrunCellsCapSummary } from './wrun-cap-notice.util.js';
|
|
57
63
|
import { type WrunCanvasReadout } from './wrun-canvas-readout.util.js';
|
|
58
64
|
import { wrunCanvasMergeLive } from './wrun-canvases.util.js';
|
|
59
65
|
import { type WrunColorTheme } from './wrun-style-words.util.js';
|
|
60
|
-
export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, wrunBatchedReadoutText, WRUN_MARK_META_MAX_OFFSET_MS, type WrunBatchedNumberFormat, type WrunMarkMeta, type WrunSpanMeta, } from './wrun-batched-readout.util.js';
|
|
66
|
+
export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkQtyInUnits, WRUN_MARK_META_MAX_OFFSET_MS, type WrunBatchedNumberFormat, type WrunMarkMeta, type WrunSpanMeta, } from './wrun-batched-readout.util.js';
|
|
61
67
|
export type { WrunBatchedHoverRecord } from './wrun-canvas-readout.util.js';
|
|
62
68
|
/** The three kinds, in mount order: each a sheet key, a child id kind and the engine plot type. */
|
|
63
69
|
export declare const WRUN_BATCHED_MARKS_KINDS: ReadonlyArray<WrunBatchedMarksKind>;
|
|
@@ -194,14 +200,21 @@ export interface WrunBatchedChildOverlay {
|
|
|
194
200
|
export declare function wrunBatchedLayoutVerdict(kind: WrunBatchedMarksKind, section: Record<string, unknown>): string | null;
|
|
195
201
|
/** The engine settings of a section's child: the geometry (`slots`, `stride`; `first_output` stays
|
|
196
202
|
* here, the child rows start at field 0), the look of its kind, and `hoverReadout` when a tooltip is
|
|
197
|
-
* declared (the engine registers its drawn records for hover then). Colours stay as declared.
|
|
198
|
-
|
|
203
|
+
* declared (the engine registers its drawn records for hover then). Colours stay as declared. A marks
|
|
204
|
+
* child also carries the market's dollar unit (`valuePerUnit`) when the build hands a proven one; spans
|
|
205
|
+
* and rays never do (their records hold no quantity). */
|
|
206
|
+
export declare function wrunBatchedSettingsOf(spec: WrunBatchedSectionSpec, context?: Pick<WrunBatchedChildrenOptions, 'valuePerUnit'>): Record<string, unknown>;
|
|
199
207
|
/** What a build of the batched children takes beside the sheet and the rows. */
|
|
200
208
|
export interface WrunBatchedChildrenOptions {
|
|
201
209
|
/** A live tick's changed tail: the timestamp the tick re-evaluated from (the previous forming bar's,
|
|
202
210
|
* the session's watermark). Each child is built from the parent rows at or after it only (walked
|
|
203
211
|
* back from the newest), charges nothing and is marked `tailOnly`. */
|
|
204
212
|
tailFromTs?: number;
|
|
213
|
+
/** The chart market's dollar unit (US dollars per price unit and size unit: the run's `wrunMarketDollarUnit`,
|
|
214
|
+
* handed in beside its size unit by every result build): a marks child's caption (`settings.valuePerUnit`, the
|
|
215
|
+
* engine's `units`) and hover (`readout.valuePerUnit`) divide a record's dollar value by it. Absent, or no number
|
|
216
|
+
* above zero: none is proven, and `units` prints dollars. A tail takes the one its full build took. */
|
|
217
|
+
valuePerUnit?: number;
|
|
205
218
|
}
|
|
206
219
|
/**
|
|
207
220
|
* One child per batched section the Style rows leave visible, in mount order. A full build charges
|
|
@@ -6,8 +6,8 @@ import { wrunCanvasMergeLive } from './wrun-canvases.util.js';
|
|
|
6
6
|
import { decodeWrunPackedColor, isWrunStyleTargetHidden, wrunPaintedDeclarationOf } from './wrun-color-settings.util.js';
|
|
7
7
|
import { WRUN_HEATMAP_TRIM_WATERMARK, wrunHeatmapCellShares, wrunHeatmapTrimTarget, } from './wrun-heatmap-cell-budget.util.js';
|
|
8
8
|
import { resolveWrunColorWord, wrunThemeTokenOfPacked, wrunThemeTokenWord, } from './wrun-style-words.util.js';
|
|
9
|
-
import { decodeWrunMarkMeta, decodeWrunSpanMeta, wrunBatchedReadoutText } from './wrun-batched-readout.util.js';
|
|
10
|
-
export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, wrunBatchedReadoutText, WRUN_MARK_META_MAX_OFFSET_MS, } from './wrun-batched-readout.util.js';
|
|
9
|
+
import { decodeWrunMarkMeta, decodeWrunSpanMeta, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkUnitValue, } from './wrun-batched-readout.util.js';
|
|
10
|
+
export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkQtyInUnits, WRUN_MARK_META_MAX_OFFSET_MS, } from './wrun-batched-readout.util.js';
|
|
11
11
|
// ── The vocabulary ──────────────────────────────────────────────────────────
|
|
12
12
|
/** The three kinds, in mount order: each a sheet key, a child id kind and the engine plot type. */
|
|
13
13
|
export const WRUN_BATCHED_MARKS_KINDS = Object.freeze(['marks', 'spans', 'rays']);
|
|
@@ -312,7 +312,6 @@ function wordIndex(value, words, fallback) {
|
|
|
312
312
|
const MARK_LOOKS = ['circle', 'dot', 'ring', 'square'];
|
|
313
313
|
const MARK_TEXT_MODES = ['off', 'largest', 'all'];
|
|
314
314
|
const MARK_X_WORDS = ['bar', 'offset'];
|
|
315
|
-
const MARK_TEXT_FORMATS = new Set(['compact', 'price', 'int']);
|
|
316
315
|
const LINE_STYLES = new Set(['solid', 'dashed', 'dotted']);
|
|
317
316
|
// ── The gate: layouts newer than this chart ─────────────────────────────────
|
|
318
317
|
/** A key's rule in the gate's vocabulary: `ANY` (the reader takes any value, clamping or defaulting
|
|
@@ -346,7 +345,7 @@ const SECTION_VOCABULARY = {
|
|
|
346
345
|
size: { law: ['sqrt', 'linear'], unit: ANY, scale: ANY },
|
|
347
346
|
opacity_pct: ANY,
|
|
348
347
|
look: MARK_LOOK_VALUES,
|
|
349
|
-
text: { mode: MARK_TEXT_MODE_VALUES, field: ['qty'], format:
|
|
348
|
+
text: { mode: MARK_TEXT_MODE_VALUES, field: ['qty'], format: WRUN_BATCHED_NUMBER_FORMATS, min_px: ANY },
|
|
350
349
|
x: MARK_X_VALUES,
|
|
351
350
|
colors: ANY,
|
|
352
351
|
tooltip: ANY,
|
|
@@ -466,14 +465,20 @@ function wordsOf(value) {
|
|
|
466
465
|
/** The marks look the engine draws (r6 parity): `look` 0..3 (Bubble, Soft dot, Ring, Square), the
|
|
467
466
|
* size law over the quantity (`unit` the Min size, `scale` the Bubble size 1..10), `x` 0..1
|
|
468
467
|
* (Candle center, Trade time), `opacity_pct` 10..80, the caption (`text.mode` 0 Off, 1 Big
|
|
469
|
-
* bubbles, 2 All; its format and the smallest bubble that holds one). A key
|
|
470
|
-
* that is none of its values (look, x, law, the caption's mode and format),
|
|
471
|
-
* (LOOK_DEFAULTS.marks); a number past its range is clamped.
|
|
472
|
-
|
|
468
|
+
* bubbles, 2 All; its format, a word of the one list, and the smallest bubble that holds one). A key
|
|
469
|
+
* left out, or an option that is none of its values (look, x, law, the caption's mode and format),
|
|
470
|
+
* takes the kit's default (LOOK_DEFAULTS.marks); a number past its range is clamped. The market's
|
|
471
|
+
* dollar unit (`valuePerUnit`, proven: finite and above zero) rides at the top for the `units`
|
|
472
|
+
* caption; without one, `units` is handed to the engine as `usd`. */
|
|
473
|
+
function marksSettings(section, valuePerUnit) {
|
|
473
474
|
const defaults = LOOK_DEFAULTS.marks;
|
|
474
475
|
const size = isRecord(section.size) ? section.size : {};
|
|
475
476
|
const text = isRecord(section.text) ? section.text : {};
|
|
476
477
|
const legacyShape = section.shape;
|
|
478
|
+
const written = isWrunBatchedNumberFormat(text.format) ? text.format : defaults.text.format;
|
|
479
|
+
// `units` divides by the market's dollar unit: with none proven it would caption a wrong number, so the engine reads
|
|
480
|
+
// the same amount in dollars (the hover's rule, wrun-batched-readout.util `wrunMarkQtyInUnits`).
|
|
481
|
+
const format = written === 'units' && valuePerUnit === undefined ? 'usd' : written;
|
|
477
482
|
return {
|
|
478
483
|
look: wordIndex(section.look ?? legacyShape, MARK_LOOKS, defaults.look),
|
|
479
484
|
size: {
|
|
@@ -487,9 +492,10 @@ function marksSettings(section) {
|
|
|
487
492
|
text: {
|
|
488
493
|
mode: wordIndex(text.mode, MARK_TEXT_MODES, defaults.text.mode),
|
|
489
494
|
field: defaults.text.field,
|
|
490
|
-
format
|
|
495
|
+
format,
|
|
491
496
|
min_px: clampTo(text.min_px, 0, 64, defaults.text.min_px),
|
|
492
497
|
},
|
|
498
|
+
...(valuePerUnit !== undefined ? { valuePerUnit } : {}),
|
|
493
499
|
};
|
|
494
500
|
}
|
|
495
501
|
/** A span's edge: a `null` the sheet holds draws none; a declared edge takes each key it leaves out
|
|
@@ -531,10 +537,12 @@ function tooltipOf(section) {
|
|
|
531
537
|
}
|
|
532
538
|
/** The engine settings of a section's child: the geometry (`slots`, `stride`; `first_output` stays
|
|
533
539
|
* here, the child rows start at field 0), the look of its kind, and `hoverReadout` when a tooltip is
|
|
534
|
-
* declared (the engine registers its drawn records for hover then). Colours stay as declared.
|
|
535
|
-
|
|
540
|
+
* declared (the engine registers its drawn records for hover then). Colours stay as declared. A marks
|
|
541
|
+
* child also carries the market's dollar unit (`valuePerUnit`) when the build hands a proven one; spans
|
|
542
|
+
* and rays never do (their records hold no quantity). */
|
|
543
|
+
export function wrunBatchedSettingsOf(spec, context = {}) {
|
|
536
544
|
const look = spec.kind === 'marks'
|
|
537
|
-
? marksSettings(spec.declaration)
|
|
545
|
+
? marksSettings(spec.declaration, wrunMarkUnitValue(context.valuePerUnit))
|
|
538
546
|
: spec.kind === 'spans'
|
|
539
547
|
? spansSettings(spec.declaration)
|
|
540
548
|
: raysSettings(spec.declaration);
|
|
@@ -543,8 +551,9 @@ export function wrunBatchedSettingsOf(spec) {
|
|
|
543
551
|
/** The readout a section with a tooltip registers at its mount, with the record's text (the template
|
|
544
552
|
* printed by wrun-batched-readout.util) on it: the child carries the readout it registers, so a
|
|
545
553
|
* registration from the child alone (the mount's `syncCanvasReadouts` after a pass that failed part
|
|
546
|
-
* way) keeps the hover text.
|
|
547
|
-
|
|
554
|
+
* way) keeps the hover text. A marks readout carries the market's dollar unit its `{{qty:units}}`
|
|
555
|
+
* divides by (proven only). */
|
|
556
|
+
function readoutOf(spec, valuePerUnit) {
|
|
548
557
|
const tooltip = tooltipOf(spec.declaration);
|
|
549
558
|
if (tooltip === null)
|
|
550
559
|
return undefined;
|
|
@@ -559,17 +568,18 @@ function readoutOf(spec) {
|
|
|
559
568
|
...(words.length > 0 ? { words } : {}),
|
|
560
569
|
// A timed record's `{{start}}` and `{{end}}` (their display offset is the mount door's to stamp).
|
|
561
570
|
...(timed ? { timed: true } : {}),
|
|
571
|
+
...(spec.kind === 'marks' && valuePerUnit !== undefined ? { valuePerUnit } : {}),
|
|
562
572
|
};
|
|
563
573
|
readout.text = (record, formatters) => wrunBatchedReadoutText(readout, record, formatters);
|
|
564
574
|
return readout;
|
|
565
575
|
}
|
|
566
|
-
function childOf(spec, data, extra) {
|
|
567
|
-
const readout = readoutOf(spec);
|
|
576
|
+
function childOf(spec, data, extra, valuePerUnit) {
|
|
577
|
+
const readout = readoutOf(spec, valuePerUnit);
|
|
568
578
|
return {
|
|
569
579
|
kind: spec.kind,
|
|
570
580
|
name: spec.name,
|
|
571
581
|
data,
|
|
572
|
-
settings: wrunBatchedSettingsOf(spec),
|
|
582
|
+
settings: wrunBatchedSettingsOf(spec, { valuePerUnit }),
|
|
573
583
|
...(readout !== undefined ? { readout } : {}),
|
|
574
584
|
...extra,
|
|
575
585
|
};
|
|
@@ -602,6 +612,7 @@ export function wrunBatchedMarksChildren(sheet, outputRows, options = {}) {
|
|
|
602
612
|
const specs = readWrunBatchedSections(sheet).filter((spec) => !isWrunStyleTargetHidden(spec.declaration));
|
|
603
613
|
if (specs.length === 0)
|
|
604
614
|
return [];
|
|
615
|
+
const valuePerUnit = wrunMarkUnitValue(options.valuePerUnit);
|
|
605
616
|
if (options.tailFromTs !== undefined) {
|
|
606
617
|
const from = wrunBatchedTailStart(outputRows, options.tailFromTs);
|
|
607
618
|
return specs.map((spec) => {
|
|
@@ -611,7 +622,7 @@ export function wrunBatchedMarksChildren(sheet, outputRows, options = {}) {
|
|
|
611
622
|
const data = wrunBatchedRowsOf(spec, outputRows, from, audit);
|
|
612
623
|
return audit.newer !== undefined
|
|
613
624
|
? refusedChildOf(spec, audit.newer, { tailOnly: true })
|
|
614
|
-
: childOf(spec, data, { tailOnly: true });
|
|
625
|
+
: childOf(spec, data, { tailOnly: true }, valuePerUnit);
|
|
615
626
|
});
|
|
616
627
|
}
|
|
617
628
|
const bars = outputRows.length;
|
|
@@ -661,7 +672,7 @@ export function wrunBatchedMarksChildren(sheet, outputRows, options = {}) {
|
|
|
661
672
|
cells: data[at].length * perBar,
|
|
662
673
|
bars: data[at].length,
|
|
663
674
|
},
|
|
664
|
-
});
|
|
675
|
+
}, valuePerUnit);
|
|
665
676
|
});
|
|
666
677
|
}
|
|
667
678
|
// ── The mount door ──────────────────────────────────────────────────────────
|