@orangecharts/wrun-chart-host 0.17.0 → 0.19.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 -0
- package/dist/constants/feature-flags.constants.d.ts +1 -6
- package/dist/constants/feature-flags.constants.js +17 -87
- package/dist/host-env.d.ts +2 -0
- package/dist/host-ports.types.d.ts +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/market-data/venues/index.d.ts +128 -143
- package/dist/market-data/venues/index.js +2 -2
- package/dist/market-data/venues/stocks.d.ts +1 -1
- package/dist/market-data/venues/stocks.js +2 -4
- package/dist/settings-templates/frvp-fields.js +28 -19
- package/dist/settings-templates/index.d.ts +25 -0
- package/dist/settings-templates/index.js +62 -2
- package/dist/settings-templates/indicator-fields.d.ts +35 -0
- package/dist/settings-templates/indicator-fields.js +261 -114
- package/dist/settings-templates/market-bound.d.ts +214 -0
- package/dist/settings-templates/market-bound.js +369 -0
- package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +8 -8
- package/dist/utility/chart/cme-user-scripts-gate.util.js +8 -8
- package/dist/utility/chart/governed-lanes-gate.util.d.ts +6 -6
- package/dist/utility/chart/governed-lanes-gate.util.js +6 -6
- package/dist/utility/chart/index-otc.leaf.d.ts +13 -0
- package/dist/utility/chart/index-otc.leaf.js +18 -0
- package/dist/utility/chart/server-built-bars.util.d.ts +4 -0
- package/dist/utility/chart/server-built-bars.util.js +18 -0
- package/dist/utility/v2/gate-plane.util.d.ts +7 -0
- package/dist/utility/v2/gate-plane.util.js +6 -0
- package/dist/utility/wrun/wrun-dark-pool.util.js +1 -1
- package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.js +32 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-live-intake.util.js +6 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +5 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +1 -1
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +3 -1
- package/dist/utility/wrun/wrun-overlay-run.util.js +128 -21
- package/dist/utility/wrun/wrun-replay-lane.util.js +3 -1
- package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.js +17 -0
- package/package.json +7 -7
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
* stays worker-safe and store-free, so the main thread hands it readers instead.
|
|
6
6
|
*
|
|
7
7
|
* The gate is open only while BOTH of its facts answer `true`, each read live on every call:
|
|
8
|
-
* - The flag. The flags store registers
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* it reaches every surface that reads `isOn`: the walls and the surfaces never disagree.
|
|
8
|
+
* - The flag. The flags store registers `licenceFlagOn` as the fallback when it is created, read live: an explicit
|
|
9
|
+
* override answers, so the dev and internal `kiyo.flag-overrides` lens reaches the walls before the map lands, and
|
|
10
|
+
* once the map has answered an absent or archived record reads on. A published reader (a spec's) answers over it.
|
|
12
11
|
* - The viewer's CME entitlement. The web hands its `viewerMayReadCme()` reader: signed in, not a guest, the CME data
|
|
13
12
|
* terms not blocked. Delayed and real-time access both count: the tier a read rides is the gate plane's, decided per
|
|
14
13
|
* socket, never this answer's.
|
|
@@ -26,8 +25,8 @@
|
|
|
26
25
|
* its answer (titan-charts' dataFetch result, the script engine's result, the wrun run's `isCurrent`) compares the
|
|
27
26
|
* token and drops an answer from a previous authorisation context, so a late answer never lands after access changed.
|
|
28
27
|
* A missing token is never current. The epoch is main-thread state: a worker's copy of this module never sees a bump,
|
|
29
|
-
* so a worker carries the captured token back and never judges it. Publishing a reader never moves the epoch
|
|
30
|
-
*
|
|
28
|
+
* so a worker carries the captured token back and never judges it. Publishing a reader never moves the epoch: only the
|
|
29
|
+
* watcher bumps it, on a move it saw.
|
|
31
30
|
*
|
|
32
31
|
* The stopped-study register (`markCmeStudyStopped`, `clearCmeStudyStopped`, `cmeStudyStopReason`,
|
|
33
32
|
* `isCmeStudyStopped`): the studies the lifecycle watcher stopped in place when the gate closed (the viewer's access
|
|
@@ -87,11 +86,12 @@ export function cmeStudyStopReason(chartIndex, overlayId) {
|
|
|
87
86
|
export function isCmeStudyStopped(chartIndex, overlayId) {
|
|
88
87
|
return stopped.has(stoppedKey(chartIndex, overlayId));
|
|
89
88
|
}
|
|
90
|
-
/** Called by
|
|
89
|
+
/** Called by specs (and a host that hands its own reader); null unpublishes. */
|
|
91
90
|
export function publishCmeUserScriptsFlag(next) {
|
|
92
91
|
published = next;
|
|
93
92
|
}
|
|
94
|
-
/** Called by the flags store when it is created:
|
|
93
|
+
/** Called by the flags store when it is created: `licenceFlagOn`, which reads an absent or archived record as on once
|
|
94
|
+
* the map has answered; read whenever nothing is published. */
|
|
95
95
|
export function setCmeUserScriptsFlagFallback(next) {
|
|
96
96
|
fallback = next;
|
|
97
97
|
}
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Store-free on purpose, the shape of the `cme-user-scripts` gate leaf (cme-user-scripts-gate.util): the venue policy
|
|
8
8
|
* stays worker-safe, so the main thread hands it a reader instead. Its one import is the fallback reader's seat
|
|
9
|
-
* (governed-lanes-reader-seat, itself dependency-free), which the flags store fills with
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* (governed-lanes-reader-seat, itself dependency-free), which the flags store fills with `licenceFlagOn` when it is
|
|
10
|
+
* evaluated: an explicit override answers, and once the map has answered an absent or archived record reads on. A
|
|
11
|
+
* published reader (a spec's, or a host that hands one) answers over the seat's.
|
|
12
12
|
*
|
|
13
13
|
* Fail closed everywhere: no reader (a worker, a spec without a store), a reader that throws, a reader that answers
|
|
14
|
-
* anything but `true`, an
|
|
15
|
-
* not name all read dark. The flags never open a lane on their own: each plane's own decision still holds
|
|
16
|
-
* plane keeps the `cme-user-scripts` gate: the flag, sign-in and the CME data terms).
|
|
14
|
+
* anything but `true`, an unanswered or failed map or a guest (`licenceFlagOn` reads those off) and a plane this
|
|
15
|
+
* module does not name all read dark. The flags never open a lane on their own: each plane's own decision still holds
|
|
16
|
+
* (the CME plane keeps the `cme-user-scripts` gate: the flag, sign-in and the CME data terms).
|
|
17
17
|
*/
|
|
18
18
|
/** A licensed plane the cutover opens to the server lanes. */
|
|
19
19
|
export type GovernedLanePlane = 'cme' | 'opra' | 'stocks';
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Store-free on purpose, the shape of the `cme-user-scripts` gate leaf (cme-user-scripts-gate.util): the venue policy
|
|
8
8
|
* stays worker-safe, so the main thread hands it a reader instead. Its one import is the fallback reader's seat
|
|
9
|
-
* (governed-lanes-reader-seat, itself dependency-free), which the flags store fills with
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* (governed-lanes-reader-seat, itself dependency-free), which the flags store fills with `licenceFlagOn` when it is
|
|
10
|
+
* evaluated: an explicit override answers, and once the map has answered an absent or archived record reads on. A
|
|
11
|
+
* published reader (a spec's, or a host that hands one) answers over the seat's.
|
|
12
12
|
*
|
|
13
13
|
* Fail closed everywhere: no reader (a worker, a spec without a store), a reader that throws, a reader that answers
|
|
14
|
-
* anything but `true`, an
|
|
15
|
-
* not name all read dark. The flags never open a lane on their own: each plane's own decision still holds
|
|
16
|
-
* plane keeps the `cme-user-scripts` gate: the flag, sign-in and the CME data terms).
|
|
14
|
+
* anything but `true`, an unanswered or failed map or a guest (`licenceFlagOn` reads those off) and a plane this
|
|
15
|
+
* module does not name all read dark. The flags never open a lane on their own: each plane's own decision still holds
|
|
16
|
+
* (the CME plane keeps the `cme-user-scripts` gate: the flag, sign-in and the CME data terms).
|
|
17
17
|
*/
|
|
18
18
|
import { governedLanesFallbackSeat } from './governed-lanes-reader-seat.js';
|
|
19
19
|
/** Every governed lane plane, in the order the planes shipped. */
|
|
@@ -35,3 +35,16 @@ export declare function isIndexOtcSymbol(symbol: string | undefined | null): boo
|
|
|
35
35
|
* unknown symbol never gains a percent sign.
|
|
36
36
|
*/
|
|
37
37
|
export declare function indexOtcUnit(symbol: string | undefined | null): IndexOtcUnit;
|
|
38
|
+
/**
|
|
39
|
+
* From this bar width up (one day), the venue's bars are the server's official bars: a day keyed at 00:00 UTC of its
|
|
40
|
+
* trade date, weeks and months rolled up from official days, today's bar rewritten by the server about every 15
|
|
41
|
+
* minutes. Live prints run around the clock on most of the instruments, so a bar built from them would hold
|
|
42
|
+
* overnight prices the official bar never has.
|
|
43
|
+
*/
|
|
44
|
+
export declare const INDEX_OTC_SERVER_BUILT_BARS_FROM_MS = 86400000;
|
|
45
|
+
/**
|
|
46
|
+
* Whether bars of `exchange` at this bar width are the server's alone: no live print may create or change one, and
|
|
47
|
+
* the newest bar is read again from the server. True only for the index and yield venue at one day and wider; a
|
|
48
|
+
* missing or non-finite width is false, so an unknown interval keeps today's behaviour.
|
|
49
|
+
*/
|
|
50
|
+
export declare function barsAreServerBuilt(exchange: string | undefined | null, intervalMs: number | undefined | null): boolean;
|
|
@@ -66,3 +66,21 @@ export function isIndexOtcSymbol(symbol) {
|
|
|
66
66
|
export function indexOtcUnit(symbol) {
|
|
67
67
|
return typeof symbol === 'string' && INDEX_OTC_PERCENT_SYMBOLS_SET.has(symbol.toUpperCase()) ? 'percent' : 'points';
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* From this bar width up (one day), the venue's bars are the server's official bars: a day keyed at 00:00 UTC of its
|
|
71
|
+
* trade date, weeks and months rolled up from official days, today's bar rewritten by the server about every 15
|
|
72
|
+
* minutes. Live prints run around the clock on most of the instruments, so a bar built from them would hold
|
|
73
|
+
* overnight prices the official bar never has.
|
|
74
|
+
*/
|
|
75
|
+
export const INDEX_OTC_SERVER_BUILT_BARS_FROM_MS = 86_400_000;
|
|
76
|
+
/**
|
|
77
|
+
* Whether bars of `exchange` at this bar width are the server's alone: no live print may create or change one, and
|
|
78
|
+
* the newest bar is read again from the server. True only for the index and yield venue at one day and wider; a
|
|
79
|
+
* missing or non-finite width is false, so an unknown interval keeps today's behaviour.
|
|
80
|
+
*/
|
|
81
|
+
export function barsAreServerBuilt(exchange, intervalMs) {
|
|
82
|
+
return (checkIsIndexOtc(exchange) &&
|
|
83
|
+
typeof intervalMs === 'number' &&
|
|
84
|
+
Number.isFinite(intervalMs) &&
|
|
85
|
+
intervalMs >= INDEX_OTC_SERVER_BUILT_BARS_FROM_MS);
|
|
86
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chart-level reading of "these bars are the server's" (`barsAreServerBuilt` in index-otc.leaf): a chart's bars
|
|
3
|
+
* are server-built when its own venue is, or when any leg of its series formula is. A formula chart names only its
|
|
4
|
+
* first leg in `exchange`, and one leg with overnight prints is enough to put overnight prices into the formula's
|
|
5
|
+
* daily bar, so every door that decides for a whole chart (the main live fold, the poll, replay) asks here.
|
|
6
|
+
*
|
|
7
|
+
* The legs are walked by `transformationsTouchVenue`, the same walk the fetch path and the licence doors use, so a
|
|
8
|
+
* leg the chart loads is a leg this sees.
|
|
9
|
+
*/
|
|
10
|
+
import { transformationsTouchVenue } from '../common/transformations.util.js';
|
|
11
|
+
import { barsAreServerBuilt } from './index-otc.leaf.js';
|
|
12
|
+
export function chartBarsAreServerBuilt(market, intervalMs) {
|
|
13
|
+
if (!market)
|
|
14
|
+
return false;
|
|
15
|
+
if (barsAreServerBuilt(market.exchange, intervalMs))
|
|
16
|
+
return true;
|
|
17
|
+
return transformationsTouchVenue(market.transformations, (exchange) => barsAreServerBuilt(exchange, intervalMs));
|
|
18
|
+
}
|
|
@@ -26,6 +26,13 @@ export interface GatePlane {
|
|
|
26
26
|
* (OPRA rows live on the CME cluster only, so a fallback would answer silently empty).
|
|
27
27
|
*/
|
|
28
28
|
mixedWithPublic: 'ungoverned' | 'refuse';
|
|
29
|
+
/**
|
|
30
|
+
* Where a delayed chart's forming bar takes the trades it opened too late to see (its history ends at the reader's
|
|
31
|
+
* cut, so the forming bar has no served row): `feedWindows`, the feed's own candle windows replayed on subscribe
|
|
32
|
+
* (tape-window-true-up.util); `printsOnly`, the prints after the subscribe alone. Required, so a new delayed plane
|
|
33
|
+
* names its answer before it compiles.
|
|
34
|
+
*/
|
|
35
|
+
delayedFormingBar: 'feedWindows' | 'printsOnly';
|
|
29
36
|
}
|
|
30
37
|
export declare const GATE_PLANES: Readonly<Record<GateProvider, GatePlane>>;
|
|
31
38
|
export { isOpraGoverned, isStocksTapeGoverned };
|
|
@@ -26,6 +26,8 @@ export const GATE_PLANES = {
|
|
|
26
26
|
servesMarketStats: false,
|
|
27
27
|
hasV3Tiers: true,
|
|
28
28
|
mixedWithPublic: 'ungoverned',
|
|
29
|
+
// The CME feed keeps trade replay off: a forming bar takes the trades after its subscribe only (a server ask).
|
|
30
|
+
delayedFormingBar: 'printsOnly',
|
|
29
31
|
},
|
|
30
32
|
opra: {
|
|
31
33
|
provider: 'opra',
|
|
@@ -36,6 +38,8 @@ export const GATE_PLANES = {
|
|
|
36
38
|
servesMarketStats: false,
|
|
37
39
|
hasV3Tiers: false,
|
|
38
40
|
mixedWithPublic: 'refuse',
|
|
41
|
+
// The OPRA feed keeps trade replay off: a forming bar takes the trades after its subscribe only (a server ask).
|
|
42
|
+
delayedFormingBar: 'printsOnly',
|
|
39
43
|
},
|
|
40
44
|
// The US stocks tape: trades only (no books), no /v3 mount, 15 min + 5 s behind for everyone without the add-on, a
|
|
41
45
|
// guest dials the delayed tiers with the guest token. Tape rows live on the cme cluster only, so a request mixing a
|
|
@@ -49,6 +53,8 @@ export const GATE_PLANES = {
|
|
|
49
53
|
servesMarketStats: false,
|
|
50
54
|
hasV3Tiers: false,
|
|
51
55
|
mixedWithPublic: 'refuse',
|
|
56
|
+
// The delayed stock feed replays its last five minutes as candle windows to an unbatched no-side TRADE_AGG.
|
|
57
|
+
delayedFormingBar: 'feedWindows',
|
|
52
58
|
},
|
|
53
59
|
};
|
|
54
60
|
// The OPRA and stocks checks are the pure leaves' (opra-governed.util, stocks-governed.util); their importers keep
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `dark_pool` row lane's identity and fetch (sources/row-lanes/dark_pool.ts loads this module inside them, so the
|
|
3
3
|
* lane file on the boot path stays light). Both read the chart port (web: titan-charts):
|
|
4
|
-
* - `wrunDarkPoolMarket(chart, { official })`: the Tape's market resolver under
|
|
4
|
+
* - `wrunDarkPoolMarket(chart, { official })`: the Tape's market resolver under the venue policy:
|
|
5
5
|
* the tape market on a US stock Trades chart, the venue policy's stop (a user run on a tape closed to scripting, on
|
|
6
6
|
* either feed), the Price only stop, or null for a chart that reads no US stock tape;
|
|
7
7
|
* - `wrunDarkPoolPrints(market, window, { signal })`: the window read (stock-tape-dark-pool-read.util
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* alone (the browser compile pipeline's stamp writer, which never writes a converging value), W is the same
|
|
40
40
|
* arithmetic for both (`wrunHistoryWarmupBars`), and `wrunHistoryStampExactColumns` names the selector columns the
|
|
41
41
|
* overlap proof compares exactly whatever the tolerance. Whether a chart honors a converging stamp is the overlay
|
|
42
|
-
* run's question (`
|
|
42
|
+
* run's question (`wrunConvergingPrefixOn`, signed-in sessions), never this reader's.
|
|
43
43
|
*/
|
|
44
44
|
import type { WrunHistoryWarmup, WrunHistoryWarmupExact, WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
|
|
45
45
|
/**
|
|
@@ -16,3 +16,13 @@ export declare function wrunLaneWarmupBars(sheet: Pick<WrunIndicatorMetadata, 'p
|
|
|
16
16
|
* cloud counts it: a venue's closed hours inside the span hold no candle, so a session market evaluates fewer rows.
|
|
17
17
|
*/
|
|
18
18
|
export declare function wrunLaneWarmupFromMs(fromMs: number, bars: number, intervalMs: number): number;
|
|
19
|
+
/** A 24-hour day of one-minute bars (1,440) with slack: the lanes' asks widen by the head, so its reach is bounded. */
|
|
20
|
+
export declare const WRUN_TRADE_DATE_HEAD_CAP_BARS = 1500;
|
|
21
|
+
/** The open of the trade date holding `firstBarMs`, to the minute; undefined past the cap, where a head short of the open leaves the total partial. */
|
|
22
|
+
export declare function wrunTradeDateHeadFromMs(firstBarMs: number, intervalMs: number, tradeDateOf: (atMs: number) => number, capBars?: number): number | undefined;
|
|
23
|
+
/** False under any other option of the select (Continuous): that total depends on the first evaluated bar by definition. */
|
|
24
|
+
export declare function wrunTradeDateAnchorActive(anchor: {
|
|
25
|
+
param: string;
|
|
26
|
+
value: number;
|
|
27
|
+
rows: readonly string[];
|
|
28
|
+
}, paramValues: Readonly<Record<string, number>>): boolean;
|
|
@@ -128,3 +128,35 @@ export function wrunLaneWarmupFromMs(fromMs, bars, intervalMs) {
|
|
|
128
128
|
const month = at.getUTCMonth();
|
|
129
129
|
return Date.UTC(at.getUTCFullYear(), month - (month % months) - bars * months, 1);
|
|
130
130
|
}
|
|
131
|
+
/** A 24-hour day of one-minute bars (1,440) with slack: the lanes' asks widen by the head, so its reach is bounded. */
|
|
132
|
+
export const WRUN_TRADE_DATE_HEAD_CAP_BARS = 1500;
|
|
133
|
+
const TRADE_DATE_HEAD_STEP_MS = 60_000;
|
|
134
|
+
/** The open of the trade date holding `firstBarMs`, to the minute; undefined past the cap, where a head short of the open leaves the total partial. */
|
|
135
|
+
export function wrunTradeDateHeadFromMs(firstBarMs, intervalMs, tradeDateOf, capBars = WRUN_TRADE_DATE_HEAD_CAP_BARS) {
|
|
136
|
+
if (!Number.isFinite(firstBarMs) || !(intervalMs > 0) || !(capBars > 0))
|
|
137
|
+
return undefined;
|
|
138
|
+
const date = tradeDateOf(firstBarMs);
|
|
139
|
+
if (!Number.isFinite(date))
|
|
140
|
+
return undefined;
|
|
141
|
+
const steps = Math.floor((capBars * intervalMs) / TRADE_DATE_HEAD_STEP_MS);
|
|
142
|
+
// Stepped on the minute grid: a seconds bar opening off the minute finds the date's first minute too.
|
|
143
|
+
const firstMinuteMs = Math.floor(firstBarMs / TRADE_DATE_HEAD_STEP_MS) * TRADE_DATE_HEAD_STEP_MS;
|
|
144
|
+
const at = (step) => firstMinuteMs - step * TRADE_DATE_HEAD_STEP_MS;
|
|
145
|
+
if (steps < 1 || tradeDateOf(at(steps)) === date)
|
|
146
|
+
return undefined;
|
|
147
|
+
// The trade date never decreases with time, so the furthest step back that reads the same date is its open.
|
|
148
|
+
let inside = 0;
|
|
149
|
+
let outside = steps;
|
|
150
|
+
while (outside - inside > 1) {
|
|
151
|
+
const mid = (inside + outside) >>> 1;
|
|
152
|
+
if (tradeDateOf(at(mid)) === date)
|
|
153
|
+
inside = mid;
|
|
154
|
+
else
|
|
155
|
+
outside = mid;
|
|
156
|
+
}
|
|
157
|
+
return at(inside);
|
|
158
|
+
}
|
|
159
|
+
/** False under any other option of the select (Continuous): that total depends on the first evaluated bar by definition. */
|
|
160
|
+
export function wrunTradeDateAnchorActive(anchor, paramValues) {
|
|
161
|
+
return paramValues[anchor.param] === anchor.value && anchor.rows.some((name) => paramValues[name] === 1);
|
|
162
|
+
}
|
|
@@ -217,6 +217,9 @@ export declare function wrunLiveOhlcvPoint(point: unknown): {
|
|
|
217
217
|
* widen high/low, replace the close and ADD volume), bucketed by the chart
|
|
218
218
|
* rule on the leg's own `market` (a WEEK bucket on its Monday, a CME Group
|
|
219
219
|
* leg on the session lattice). Never mutates its inputs.
|
|
220
|
+
*
|
|
221
|
+
* Bars the server alone builds (`barsAreServerBuilt`: the index venue at one day and wider) are never folded: no live
|
|
222
|
+
* print may create or change one. A script on such a leg reads its newest bars again on every lane reconcile.
|
|
220
223
|
*/
|
|
221
224
|
export declare function foldWrunLegCandleRows(base: ReadonlyArray<ArrayLike<number>>, points: readonly unknown[], intervalMs: number, market?: WrunLiveBucketMarket | null): FoldResult | null;
|
|
222
225
|
/**
|
|
@@ -95,6 +95,7 @@ import { serverNowMs } from '../auth/server-clock.util.js';
|
|
|
95
95
|
import { wrunRowLaneByKey } from './sources/row-lane-registry.js';
|
|
96
96
|
import { wrunHostBarOf } from './wrun-tier-grid.util.js';
|
|
97
97
|
import { barStartMs } from '../chart/calendar-interval.util.js';
|
|
98
|
+
import { barsAreServerBuilt } from '../chart/index-otc.leaf.js';
|
|
98
99
|
import { getWrunOverlayLiveContext, onWrunOverlayLiveTeardown, } from './wrun-overlay-drivers.util.js';
|
|
99
100
|
import { WRUN_TYPED_PINNED_SOURCES, wrunDeclaredSourceLanes, wrunLegRowHostBar, wrunLaneAcquisitionIntervalMs, wrunPinnedIntervalOf, } from './wrun-source-rows.util.js';
|
|
100
101
|
import { getProfileBucketHeight, normalizeTicksPerBar } from '../../workers/utils/volume-profile.worker.util.js';
|
|
@@ -598,10 +599,15 @@ export function wrunLiveOhlcvPoint(point) {
|
|
|
598
599
|
* widen high/low, replace the close and ADD volume), bucketed by the chart
|
|
599
600
|
* rule on the leg's own `market` (a WEEK bucket on its Monday, a CME Group
|
|
600
601
|
* leg on the session lattice). Never mutates its inputs.
|
|
602
|
+
*
|
|
603
|
+
* Bars the server alone builds (`barsAreServerBuilt`: the index venue at one day and wider) are never folded: no live
|
|
604
|
+
* print may create or change one. A script on such a leg reads its newest bars again on every lane reconcile.
|
|
601
605
|
*/
|
|
602
606
|
export function foldWrunLegCandleRows(base, points, intervalMs, market) {
|
|
603
607
|
if (!Number.isFinite(intervalMs) || intervalMs <= 0)
|
|
604
608
|
return null;
|
|
609
|
+
if (barsAreServerBuilt(market?.exchange, intervalMs))
|
|
610
|
+
return null;
|
|
605
611
|
const indexByTs = new Map();
|
|
606
612
|
for (let at = 0; at < base.length; at += 1)
|
|
607
613
|
indexByTs.set(Number(base[at][0]), at);
|
|
@@ -4915,6 +4915,11 @@ async function reseedWrunOverlay(context, ledger, reason, mainClock) {
|
|
|
4915
4915
|
}
|
|
4916
4916
|
return;
|
|
4917
4917
|
}
|
|
4918
|
+
if (result === 'head-owed' && !context.liveSuspended) {
|
|
4919
|
+
// The reseed would evaluate a trade-date total from the first loaded bar: the full run takes the head first.
|
|
4920
|
+
noteWrunLiveRebuild(ledger, indicatorId);
|
|
4921
|
+
return;
|
|
4922
|
+
}
|
|
4918
4923
|
if (result === 'skipped' && (reason === 'session-lost' || reason === 'order-error') && !context.liveSuspended) {
|
|
4919
4924
|
// The session is gone or wedged and the reseed could not reopen it: the
|
|
4920
4925
|
// full-run driver re-opens it over the current window. A reopen the
|
|
@@ -531,6 +531,8 @@ export interface WrunLaneWarmupHead {
|
|
|
531
531
|
fromTs: number;
|
|
532
532
|
rows: ReadonlyArray<ReadonlyArray<number>>;
|
|
533
533
|
dataGen: number;
|
|
534
|
+
/** Opens at its trade date's open. */
|
|
535
|
+
tradeDate?: true;
|
|
534
536
|
}
|
|
535
537
|
/** The live guest's warmth record (round A). */
|
|
536
538
|
export interface WrunWarmRun {
|
|
@@ -953,7 +953,7 @@ async function reseedWrunCasualty(casualty) {
|
|
|
953
953
|
]);
|
|
954
954
|
const result = await reseedWrunOverlayFromBuffers(indicatorId, 'session-lost');
|
|
955
955
|
ring('wrun-casualty-reseed', { chartIndex, indicatorId, result });
|
|
956
|
-
if (result !== 'skipped' || !hasWrunOverlayDriver(indicatorId))
|
|
956
|
+
if ((result !== 'skipped' && result !== 'head-owed') || !hasWrunOverlayDriver(indicatorId))
|
|
957
957
|
return;
|
|
958
958
|
// The buffers could not reopen the session: the full-run driver rebuilds
|
|
959
959
|
// it over the current window, unless a hold says nothing may run now.
|
|
@@ -703,7 +703,7 @@ export declare function reseedWrunOverlayFromBuffers(indicatorId: string, reason
|
|
|
703
703
|
* cutoff with the window's head, or the run bars as of it; the session rebuilds over them
|
|
704
704
|
* instead of the chart's current candles. */
|
|
705
705
|
ohlcvRows?: ReadonlyArray<ArrayLike<number>>;
|
|
706
|
-
}): Promise<'reseeded' | 'refused' | 'skipped'>;
|
|
706
|
+
}): Promise<'reseeded' | 'refused' | 'skipped' | 'head-owed'>;
|
|
707
707
|
type WrunLaneRows = ArrayLike<number>[];
|
|
708
708
|
/** The row builder's own lanes, one optional thunk each. */
|
|
709
709
|
type WrunBuiltinLaneThunks = {
|
|
@@ -1250,6 +1250,8 @@ export declare function integrateWrunOutputRows(options: WrunIntegrateOptions):
|
|
|
1250
1250
|
* refuses.
|
|
1251
1251
|
*/
|
|
1252
1252
|
export declare function integrateWrunRunThroughRoute(options: WrunIntegrateOptions): WrunIntegrateOutcome;
|
|
1253
|
+
/** The longest a first paint waits for a trade-date head: past it the run paints from the loaded bars and reruns when the head lands. */
|
|
1254
|
+
export declare const WRUN_TRADE_DATE_HEAD_FIRST_PAINT_WAIT_MS = 2000;
|
|
1253
1255
|
/** Why a pan wave runs whole instead of as a prefix run (C1 v3's skip reasons). */
|
|
1254
1256
|
export type WrunPrefixSkipReason = 'no-context' | 'not-backward-extension' | 'not-audited' | 'version-outside-audit' | `unsupported-outputs:${string}` | 'replay' | 'clamped' | 'htf' | `lanes:${WrunPrefixFeedClause}` | 'whole-range-script' | 'prefix-unsafe' | 'no-closed-book-observation' | WrunWarmupMiss | 'warmup-cold' | 'warmup-gaps' | 'prefix-costlier' | 'candle-revised';
|
|
1255
1257
|
/**
|