@orangecharts/wrun-chart-host 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/constants/feature-flags.constants.d.ts +6 -1
- package/dist/constants/feature-flags.constants.js +67 -24
- package/dist/constants/opra-compliance.constants.d.ts +3 -2
- package/dist/constants/opra-compliance.constants.js +3 -2
- package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +20 -20
- package/dist/constants/venue-presets.constants.js +24 -26
- package/dist/host-env.d.ts +29 -5
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +69 -15
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
- package/dist/interfaces/replay.interface.d.ts +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +41 -4
- package/dist/kscript-data/controls/live-trades-merge.util.js +52 -7
- package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
- package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
- package/dist/market-data/billing.interface.d.ts +95 -31
- package/dist/market-data/billing.interface.js +36 -5
- package/dist/market-data/venue.d.ts +88 -6
- package/dist/market-data/venues/cme.contract.copy.json +66 -0
- package/dist/market-data/venues/cme.d.ts +126 -0
- package/dist/market-data/venues/cme.js +133 -0
- package/dist/market-data/venues/index.d.ts +162 -5
- package/dist/market-data/venues/index.js +48 -6
- package/dist/settings-templates/index.js +7 -3
- package/dist/settings-templates/indicator-fields.d.ts +5 -4
- package/dist/settings-templates/indicator-fields.js +45 -6
- package/dist/settings-templates/tool-rules.d.ts +27 -17
- package/dist/settings-templates/tool-rules.js +27 -11
- package/dist/settings-templates/tool-tables.generated.js +91 -31
- package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
- package/dist/utility/chart/book-live-bucket.util.js +47 -0
- package/dist/utility/chart/index-mode-admission.util.js +15 -2
- package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +7 -2
- package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
- package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +54 -35
- package/dist/utility/chart/kscript-venue-policy.util.js +78 -42
- package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
- package/dist/utility/chart/market-session-schedule.util.js +16 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
- package/dist/utility/chart/opra-read-access.leaf.js +5 -3
- package/dist/utility/chart/rth-session.util.d.ts +3 -2
- package/dist/utility/chart/rth-session.util.js +2 -1
- package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
- package/dist/utility/chart/window-geometry.leaf.js +22 -6
- package/dist/utility/chart/wrun-run-result.util.d.ts +12 -0
- package/dist/utility/chart/wrun-run-result.util.js +141 -6
- package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
- package/dist/utility/options/option-bar-anchor.util.js +340 -0
- package/dist/utility/options/option-venue.util.d.ts +18 -0
- package/dist/utility/options/option-venue.util.js +27 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
- package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
- package/dist/utility/wrun/derived-roots.util.js +471 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -2
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -2
- package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
- package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +2 -1
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +3 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +19 -4
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +52 -13
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +88 -19
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +2 -1
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +24 -9
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +39 -10
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -0
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +15 -3
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +22 -3
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +174 -13
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +685 -27
- package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +53 -12
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +101 -53
- package/dist/utility/wrun/wrun-download-meter.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +14 -2
- package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
- package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
- package/dist/utility/wrun/wrun-frames.d.ts +27 -6
- package/dist/utility/wrun/wrun-frames.js +73 -10
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +18 -4
- package/dist/utility/wrun/wrun-hud-looks.util.js +45 -13
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +13 -7
- package/dist/utility/wrun/wrun-live-intake.util.js +82 -29
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +158 -14
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +49 -10
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +65 -5
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +31 -5
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
- package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
- package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
- package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +23 -6
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +47 -11
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +86 -19
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +168 -62
- package/dist/utility/wrun/wrun-option-views.util.d.ts +47 -13
- package/dist/utility/wrun/wrun-option-views.util.js +98 -26
- package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-output-style.util.js +20 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +17 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +100 -31
- package/dist/utility/wrun/wrun-overlay-run.util.js +733 -114
- package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +63 -13
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +10 -9
- package/dist/utility/wrun/wrun-panel-style.util.js +58 -9
- package/dist/utility/wrun/wrun-param-map.util.d.ts +14 -11
- package/dist/utility/wrun/wrun-param-map.util.js +10 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +14 -4
- package/dist/utility/wrun/wrun-param-values.util.js +4 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +12 -11
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
- package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
- package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +45 -1
- package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
- package/dist/utility/wrun/wrun-socket-row-source.js +113 -8
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +5 -1
- package/dist/utility/wrun/wrun-source-rows.util.js +16 -3
- package/dist/utility/wrun/wrun-style-words.util.js +6 -4
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
- package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-tape-per-order.util.js +26 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
- package/dist/utils/replay/replay-buffer-math.js +227 -20
- package/package.json +11 -11
|
@@ -428,13 +428,24 @@ async function wrunSocketRunLevelOf(output, kind) {
|
|
|
428
428
|
level.opra = true;
|
|
429
429
|
else if (kind === 'result')
|
|
430
430
|
level.opra = false;
|
|
431
|
+
// The receipt of the rows the answer was computed from rides the mark: a tier the reply named, never a guess.
|
|
432
|
+
if (raw.wrunOpra === true && raw.wrunOpraTier !== undefined) {
|
|
433
|
+
level.opraServed = {
|
|
434
|
+
tier: raw.wrunOpraTier,
|
|
435
|
+
...(raw.wrunOpraDelaySeconds !== undefined ? { delaySeconds: raw.wrunOpraDelaySeconds } : {}),
|
|
436
|
+
};
|
|
437
|
+
}
|
|
431
438
|
const rows = Array.isArray(raw.diagnostics) ? raw.diagnostics : undefined;
|
|
432
439
|
if (rows !== undefined && rows.length > 0) {
|
|
433
440
|
const [{ normalizeRuntimeDiagnostics }, { envelopeWorkerTransportDiagnostics }] = await Promise.all([
|
|
434
441
|
import('../scriptEditor/wrun-runtime-diagnostics.leaf.js'),
|
|
435
442
|
wrunChartHostEnv().transport.loadKScriptErrorEnvelope(),
|
|
436
443
|
]);
|
|
437
|
-
|
|
444
|
+
const diagnostics = envelopeWorkerTransportDiagnostics(normalizeRuntimeDiagnostics(rows), { editorRun: false });
|
|
445
|
+
// The cloud computed these rows over OPRA data when the reply carries the mark (its execution errors can carry
|
|
446
|
+
// what the run computed): each row carries the row mark, so every console export strips it (contract K7).
|
|
447
|
+
level.diagnostics =
|
|
448
|
+
raw.wrunOpra === true ? diagnostics.map((row) => ({ ...row, opra: true })) : diagnostics;
|
|
438
449
|
}
|
|
439
450
|
else if (rows !== undefined || kind === 'result') {
|
|
440
451
|
level.diagnostics = [];
|
|
@@ -493,6 +504,7 @@ function runLevelFields(level) {
|
|
|
493
504
|
: {}),
|
|
494
505
|
...(level.skipped !== undefined ? level.skipped : {}),
|
|
495
506
|
...(level.opra !== undefined ? { opra: level.opra } : {}),
|
|
507
|
+
...(level.opraServed !== undefined ? { opraServed: { ...level.opraServed } } : {}),
|
|
496
508
|
};
|
|
497
509
|
}
|
|
498
510
|
/** A session of the store seeded with the record's sheet, so a reply without one still merges. */
|
|
@@ -667,11 +679,22 @@ export class SocketWrunRowSource {
|
|
|
667
679
|
merges = Promise.resolve();
|
|
668
680
|
/** The cells memo: the last cell rows answered and each celled entry's lane rows (`cellRows`). */
|
|
669
681
|
cells;
|
|
682
|
+
/** The served tier of the OPRA rows the session holds (contract opra-server-lanes C4: the newest receipt that named a
|
|
683
|
+
* tier since the session opened), the one every merge is held to (`servedTierMoved`). */
|
|
684
|
+
retainedTier;
|
|
685
|
+
/** A served-tier move no listener took yet (`dropSessionAtServedTier`): the next subscriber is told first. */
|
|
686
|
+
servedTierMoveOwed;
|
|
670
687
|
constructor(deps = {}) {
|
|
671
688
|
this.deps = deps;
|
|
672
689
|
this.frames = {
|
|
673
690
|
subscribe: (listener) => {
|
|
674
691
|
this.listener = listener;
|
|
692
|
+
// A move that landed before anyone listened (a frame between the create's answer and the install's
|
|
693
|
+
// subscribe) reaches the session that installs: it reseeds over the rows that install drew.
|
|
694
|
+
const owed = this.servedTierMoveOwed;
|
|
695
|
+
this.servedTierMoveOwed = undefined;
|
|
696
|
+
if (owed !== undefined)
|
|
697
|
+
this.deliver(owed);
|
|
675
698
|
return () => {
|
|
676
699
|
if (this.listener === listener)
|
|
677
700
|
this.listener = undefined;
|
|
@@ -684,7 +707,8 @@ export class SocketWrunRowSource {
|
|
|
684
707
|
return this.current;
|
|
685
708
|
}
|
|
686
709
|
/** The session's run-level keys as a batch carries them (copies): the newest strategy output and diagnostics a
|
|
687
|
-
* result or a live frame carried, whichever merged last, the served legs' warning rows after the diagnostics
|
|
710
|
+
* result or a live frame carried, whichever merged last, the served legs' warning rows after the diagnostics, the
|
|
711
|
+
* newest result's OPRA word and the receipt of the newest OPRA rows (a result's or a marked live frame's). */
|
|
688
712
|
get sessionRunLevel() {
|
|
689
713
|
return runLevelFields(this.runLevel);
|
|
690
714
|
}
|
|
@@ -725,6 +749,8 @@ export class SocketWrunRowSource {
|
|
|
725
749
|
this.answered = [];
|
|
726
750
|
this.runLevel = {};
|
|
727
751
|
this.lossesAtOpen = undefined;
|
|
752
|
+
this.retainedTier = undefined;
|
|
753
|
+
this.servedTierMoveOwed = undefined;
|
|
728
754
|
this.followLive();
|
|
729
755
|
return this.withLoading(async () => {
|
|
730
756
|
const page = newestWrunSocketPage(window, this.intervalMs(), this.pageBars());
|
|
@@ -855,6 +881,8 @@ export class SocketWrunRowSource {
|
|
|
855
881
|
this.answered = [];
|
|
856
882
|
this.runLevel = {};
|
|
857
883
|
this.flight = undefined;
|
|
884
|
+
this.retainedTier = undefined;
|
|
885
|
+
this.servedTierMoveOwed = undefined;
|
|
858
886
|
}
|
|
859
887
|
/**
|
|
860
888
|
* A facts-needed note for the overlay this source follows (`routeWrunSocketFactsNeeded`): the ask waiting on the
|
|
@@ -1070,6 +1098,12 @@ export class SocketWrunRowSource {
|
|
|
1070
1098
|
throw new WrunSocketReplyUnreadable(read.reason);
|
|
1071
1099
|
const level = await wrunSocketRunLevelOf(output, 'result');
|
|
1072
1100
|
this.assertCurrent(generation);
|
|
1101
|
+
// A page (or the paging after a patch) the cloud served at another tier than the rows the session holds: none
|
|
1102
|
+
// of them may stand beside it, so the session is dropped and the overlay reseeds; the ask settles superseded.
|
|
1103
|
+
if (freshSheet === undefined && this.servedTierMoved(level)) {
|
|
1104
|
+
this.dropSessionAtServedTier(read.wire.window);
|
|
1105
|
+
throw new WrunSocketRowSourceStopped('superseded');
|
|
1106
|
+
}
|
|
1073
1107
|
const identity = this.storeIdentity(generation);
|
|
1074
1108
|
const base = freshSheet !== undefined
|
|
1075
1109
|
? seededSession(identity, freshSheet)
|
|
@@ -1099,9 +1133,72 @@ export class SocketWrunRowSource {
|
|
|
1099
1133
|
...(skipped !== undefined ? { skipped } : {}),
|
|
1100
1134
|
// The newest result's OPRA word (every result answers one): a re-plan off OPRA names false.
|
|
1101
1135
|
...(level.opra !== undefined ? { opra: level.opra } : {}),
|
|
1136
|
+
// And the receipt of its rows: a result without the mark (or naming no tier) leaves none.
|
|
1137
|
+
...(level.opraServed !== undefined ? { opraServed: level.opraServed } : {}),
|
|
1102
1138
|
};
|
|
1139
|
+
if (freshSheet !== undefined)
|
|
1140
|
+
this.retainedTier = undefined;
|
|
1141
|
+
this.retainTier(level);
|
|
1103
1142
|
});
|
|
1104
1143
|
}
|
|
1144
|
+
// ── The served tier ──────────────────────────────────────────────────────────────────────────
|
|
1145
|
+
/** A merge's tier joins the session's: the tier the receipt of a marked answer named, when it named one. */
|
|
1146
|
+
retainTier(level) {
|
|
1147
|
+
if (level.opra === true && level.opraServed !== undefined)
|
|
1148
|
+
this.retainedTier = level.opraServed.tier;
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Whether an answer moves the session's served tier: it carries the OPRA mark and names a tier, and the rows the
|
|
1152
|
+
* session holds were served at the other one (contract opra-server-lanes C4: the gate re-resolved the owner's tier,
|
|
1153
|
+
* a downgrade or an upgrade). An answer that names no tier moves nothing (its rows read no OPRA yet), nor does a
|
|
1154
|
+
* session whose rows never named one.
|
|
1155
|
+
*/
|
|
1156
|
+
servedTierMoved(level) {
|
|
1157
|
+
const tier = level.opra === true ? level.opraServed?.tier : undefined;
|
|
1158
|
+
return tier !== undefined && this.retainedTier !== undefined && tier !== this.retainedTier;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* The served tier moved under the session: nothing it holds may stand beside rows served at the new tier (a
|
|
1162
|
+
* real-time prefix under a delayed receipt, or the reverse). Its rows, coverage, owed window, cells and run-level
|
|
1163
|
+
* keys go, the generation moves (an ask on its way settles superseded, a frame merged behind this one is dropped), and
|
|
1164
|
+
* the overlay is told (`WrunRowBatch.servedTierMoved`): it takes what it drew off the chart, ends its live session
|
|
1165
|
+
* and reruns, which creates a fresh session at the tier the cloud serves now. The source never extends a session
|
|
1166
|
+
* across the move.
|
|
1167
|
+
*/
|
|
1168
|
+
dropSessionAtServedTier(window) {
|
|
1169
|
+
this.nextGeneration();
|
|
1170
|
+
this.current = undefined;
|
|
1171
|
+
this.answered = [];
|
|
1172
|
+
this.runLevel = {};
|
|
1173
|
+
this.owed = undefined;
|
|
1174
|
+
this.cells = undefined;
|
|
1175
|
+
this.retainedTier = undefined;
|
|
1176
|
+
const frame = {
|
|
1177
|
+
window: { ...window },
|
|
1178
|
+
asOfMs: Number.NaN,
|
|
1179
|
+
rows: [],
|
|
1180
|
+
grids: [],
|
|
1181
|
+
frames: undefined,
|
|
1182
|
+
handles: undefined,
|
|
1183
|
+
refusals: [],
|
|
1184
|
+
servedTierMoved: true,
|
|
1185
|
+
};
|
|
1186
|
+
if (this.listener === undefined)
|
|
1187
|
+
this.servedTierMoveOwed = frame;
|
|
1188
|
+
else
|
|
1189
|
+
this.deliver(frame);
|
|
1190
|
+
}
|
|
1191
|
+
deliver(frame) {
|
|
1192
|
+
const listener = this.listener;
|
|
1193
|
+
if (listener === undefined)
|
|
1194
|
+
return;
|
|
1195
|
+
try {
|
|
1196
|
+
listener(frame);
|
|
1197
|
+
}
|
|
1198
|
+
catch (error) {
|
|
1199
|
+
console.warn('[wrun] socket row source frame listener failed:', error);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1105
1202
|
/**
|
|
1106
1203
|
* Page a window until the planner's coverage says done: each round runs the pages still missing,
|
|
1107
1204
|
* newest first and planned again after each one, through the in-flight registry (or around it, for a
|
|
@@ -1308,6 +1405,12 @@ export class SocketWrunRowSource {
|
|
|
1308
1405
|
// A frame before the session's first answer (or of a patch not yet answered) has nothing to extend.
|
|
1309
1406
|
if (this.current?.identity !== identity)
|
|
1310
1407
|
return;
|
|
1408
|
+
// A frame served at another tier than the rows the session holds never extends them: the session is dropped
|
|
1409
|
+
// and the overlay reseeds (`dropSessionAtServedTier`).
|
|
1410
|
+
if (this.servedTierMoved(level)) {
|
|
1411
|
+
this.dropSessionAtServedTier(read.wire.window);
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1311
1414
|
const merge = mergeWrunHostedReply(this.current, read.wire, { identity, kind: 'live' }, WRUN_SOCKET_ROW_STORE_UNCAPPED);
|
|
1312
1415
|
if ('refused' in merge)
|
|
1313
1416
|
return;
|
|
@@ -1319,6 +1422,13 @@ export class SocketWrunRowSource {
|
|
|
1319
1422
|
this.runLevel = { ...this.runLevel, diagnostics: level.diagnostics };
|
|
1320
1423
|
if (level.skipped !== undefined)
|
|
1321
1424
|
this.runLevel = { ...this.runLevel, skipped: level.skipped };
|
|
1425
|
+
// A frame with the OPRA mark names the receipt of its own rows, the session's newest: its tier, or none (a
|
|
1426
|
+
// frame computed before any OPRA read answered names no tier, and the legend then names none).
|
|
1427
|
+
if (level.opra === true) {
|
|
1428
|
+
const { opraServed: _replaced, ...rest } = this.runLevel;
|
|
1429
|
+
this.runLevel = { ...rest, ...(level.opraServed !== undefined ? { opraServed: level.opraServed } : {}) };
|
|
1430
|
+
}
|
|
1431
|
+
this.retainTier(level);
|
|
1322
1432
|
this.emitFrame(read.wire, merge, level);
|
|
1323
1433
|
}).catch((error) => {
|
|
1324
1434
|
console.warn('[wrun] socket row source live frame skipped:', error);
|
|
@@ -1344,12 +1454,7 @@ export class SocketWrunRowSource {
|
|
|
1344
1454
|
refusals: session.refusals.map((refusal) => ({ ...refusal })),
|
|
1345
1455
|
...runLevelFields({ ...level, servedLegs: this.runLevel.servedLegs }),
|
|
1346
1456
|
};
|
|
1347
|
-
|
|
1348
|
-
listener(frame);
|
|
1349
|
-
}
|
|
1350
|
-
catch (error) {
|
|
1351
|
-
console.warn('[wrun] socket row source frame listener failed:', error);
|
|
1352
|
-
}
|
|
1457
|
+
this.deliver(frame);
|
|
1353
1458
|
}
|
|
1354
1459
|
}
|
|
1355
1460
|
// ── The one extra ask after a refusal for absent facts ───────────────────────────────────────────
|
|
@@ -126,7 +126,11 @@
|
|
|
126
126
|
* shared host's cell adapter, side +1 for a buy and -1 for a sell, in the
|
|
127
127
|
* row's own order, the plan's floor kept (the host plans the tape ask with
|
|
128
128
|
* `min_size` resolved from the run's settings, `sources.settings`, the floor
|
|
129
|
-
* the lane's acquisition was asked at)
|
|
129
|
+
* the lane's acquisition was asked at), except where the per-order switch
|
|
130
|
+
* holds (`wrunTapePerOrder`: a CME Group venue, the build flag on), where the
|
|
131
|
+
* lane served every fill of each order that reached the floor and the cells
|
|
132
|
+
* are read whole (the host's per-cell check would drop the small fills of a
|
|
133
|
+
* big order before the package combines them). A primary bar with no row (before the
|
|
130
134
|
* served history, a quiet bar, a live-edge tape) is a PRESENT EMPTY block; a
|
|
131
135
|
* bar over the input's `max_cells` refuses by name where the rows are packed
|
|
132
136
|
* (`wrun_cell_block_too_large`, never truncated). The facets (`min_size`,
|
|
@@ -126,7 +126,11 @@
|
|
|
126
126
|
* shared host's cell adapter, side +1 for a buy and -1 for a sell, in the
|
|
127
127
|
* row's own order, the plan's floor kept (the host plans the tape ask with
|
|
128
128
|
* `min_size` resolved from the run's settings, `sources.settings`, the floor
|
|
129
|
-
* the lane's acquisition was asked at)
|
|
129
|
+
* the lane's acquisition was asked at), except where the per-order switch
|
|
130
|
+
* holds (`wrunTapePerOrder`: a CME Group venue, the build flag on), where the
|
|
131
|
+
* lane served every fill of each order that reached the floor and the cells
|
|
132
|
+
* are read whole (the host's per-cell check would drop the small fills of a
|
|
133
|
+
* big order before the package combines them). A primary bar with no row (before the
|
|
130
134
|
* served history, a quiet bar, a live-edge tape) is a PRESENT EMPTY block; a
|
|
131
135
|
* bar over the input's `max_cells` refuses by name where the rows are packed
|
|
132
136
|
* (`wrun_cell_block_too_large`, never truncated). The facets (`min_size`,
|
|
@@ -353,6 +357,7 @@ import { wrunBarSessionFactsResolver, } from '../chart/wrun-bar-session-facts.ut
|
|
|
353
357
|
import { wrunSettingRefusedMessage } from '../scriptEditor/wrun-runtime-diagnostics.leaf.js';
|
|
354
358
|
import { attachWrunRefusal, wrunPinFinerSeed } from './wrun-refusal.util.js';
|
|
355
359
|
import { isWrunAskedTapeSource, wrunTapeFloorParamOf } from './wrun-tape-source.util.js';
|
|
360
|
+
import { wrunTapePerOrder } from './wrun-tape-per-order.util.js';
|
|
356
361
|
import { WRUN_BROWSER_REFUSED_CLASS_CODES } from './wrun-browser-sources.leaf.js';
|
|
357
362
|
import { wrunProtocolPendingSeed } from './wrun-protocol-pending.util.js';
|
|
358
363
|
import { planWrunRowLaneInputs, wrunRowLaneCellRows } from './sources/wrun-row-lanes.util.js';
|
|
@@ -2675,8 +2680,16 @@ function wrunHostRunOf(metadata, sources, clock, cellsAfterTs) {
|
|
|
2675
2680
|
? sources.tapeRows
|
|
2676
2681
|
: sources.optionsChainRows;
|
|
2677
2682
|
// The browser's book lane is asked at the sheet's depth already: its rows are read whole. The
|
|
2678
|
-
// tape keeps the plan's floor (the one its lane was asked at, from the run's settings)
|
|
2679
|
-
|
|
2683
|
+
// tape keeps the plan's floor (the one its lane was asked at, from the run's settings), except where
|
|
2684
|
+
// the per-order switch holds (wrunTapePerOrder: a CME Group venue, the build flag on): its lane served
|
|
2685
|
+
// every fill of each order that reached the floor (the history read's per-order floor, the per-order
|
|
2686
|
+
// live fold), so its rows are read whole too. The host's per-cell check there drew a 147-contract NQZ6
|
|
2687
|
+
// buy of 45 fills as its two 17-lot fills, the fills dropped one by one before "Combine fills" saw them.
|
|
2688
|
+
const adapted = ask.class === 'book'
|
|
2689
|
+
? { ...ask, max_depth: undefined }
|
|
2690
|
+
: ask.class === 'tape' && wrunTapePerOrder(gridMarket?.exchange)
|
|
2691
|
+
? { ...ask, min_size: undefined, min_value: undefined }
|
|
2692
|
+
: ask;
|
|
2680
2693
|
// Past the carry only (`cellsAfterTs`), except the options chain: the live row reads its newest poll, however old.
|
|
2681
2694
|
const rows = wrunPlainLaneRows(cellsAfterTs === undefined || source.source === 'options_chain'
|
|
2682
2695
|
? (lane ?? [])
|
|
@@ -326,9 +326,11 @@ function wrunAuto(abs, decimals) {
|
|
|
326
326
|
return wrunGrouped(fixed.indexOf(".") < 0 ? fixed : fixed.replace(/\.?0+$/, ""));
|
|
327
327
|
}
|
|
328
328
|
// prettier-ignore
|
|
329
|
-
function wrunScaled(abs, decimals) {
|
|
329
|
+
function wrunScaled(abs, decimals, trimZeros) {
|
|
330
330
|
const small = abs.toFixed(decimals ?? 2);
|
|
331
|
-
|
|
331
|
+
if (Number(small) >= 1000)
|
|
332
|
+
return wrunCompact(Math.max(abs, 1000), decimals ?? 1);
|
|
333
|
+
return trimZeros && decimals === undefined ? small.replace(/\.?0+$/, "") : small;
|
|
332
334
|
}
|
|
333
335
|
/** Prints one number the way its surface declared (format, decimals,
|
|
334
336
|
* signed, unit, priceDigits). Without a format: today's card text
|
|
@@ -370,11 +372,11 @@ export function formatWrunNumber(value, spec = {}) {
|
|
|
370
372
|
suffix = "%";
|
|
371
373
|
break;
|
|
372
374
|
case "si":
|
|
373
|
-
body = wrunScaled(abs, decimals);
|
|
375
|
+
body = wrunScaled(abs, decimals, true);
|
|
374
376
|
break;
|
|
375
377
|
case "usd":
|
|
376
378
|
prefix = "$";
|
|
377
|
-
body = wrunScaled(abs, decimals);
|
|
379
|
+
body = wrunScaled(abs, decimals, false);
|
|
378
380
|
break;
|
|
379
381
|
case "auto":
|
|
380
382
|
body = wrunAuto(abs, decimals);
|
|
@@ -56,8 +56,9 @@
|
|
|
56
56
|
* kscript-drawing-safe-area.util), the tags from titan's own main settings
|
|
57
57
|
* (`showHighLowLabel`, which every axis toggle and tape mode write). One
|
|
58
58
|
* tracker per chart caches the boxes, so a live tick never forces a layout,
|
|
59
|
-
* and follows them: rows resizing, coming and going,
|
|
60
|
-
*
|
|
59
|
+
* and follows them: rows resizing, coming and going, a host row mounting or
|
|
60
|
+
* moving (the quick-trade pill), the legend section's padding and size, the
|
|
61
|
+
* bar. When that moves a mounted table, the
|
|
61
62
|
* overlay's last result is placed again and handed back to its lane's
|
|
62
63
|
* re-apply (the adapter's mounted-row refresh), so a table follows the legend
|
|
63
64
|
* on a chart without ticks too; the legend edge follows the plot's width.
|
|
@@ -56,13 +56,14 @@
|
|
|
56
56
|
* kscript-drawing-safe-area.util), the tags from titan's own main settings
|
|
57
57
|
* (`showHighLowLabel`, which every axis toggle and tape mode write). One
|
|
58
58
|
* tracker per chart caches the boxes, so a live tick never forces a layout,
|
|
59
|
-
* and follows them: rows resizing, coming and going,
|
|
60
|
-
*
|
|
59
|
+
* and follows them: rows resizing, coming and going, a host row mounting or
|
|
60
|
+
* moving (the quick-trade pill), the legend section's padding and size, the
|
|
61
|
+
* bar. When that moves a mounted table, the
|
|
61
62
|
* overlay's last result is placed again and handed back to its lane's
|
|
62
63
|
* re-apply (the adapter's mounted-row refresh), so a table follows the legend
|
|
63
64
|
* on a chart without ticks too; the legend edge follows the plot's width.
|
|
64
65
|
*/
|
|
65
|
-
import { legendPaneOf, legendRowsOf, measureLegendBox } from '../chart/kscript-drawing-safe-area.util.js';
|
|
66
|
+
import { legendPaneOf, legendRowsOf, measureLegendBox, observeLegendHostRows, } from '../chart/kscript-drawing-safe-area.util.js';
|
|
66
67
|
/** Air between the chrome and the table. */
|
|
67
68
|
export const WRUN_TABLE_CHROME_GAP_PX = 8;
|
|
68
69
|
/** The engine's own inset from the anchored corner (TextPlot `Table`). */
|
|
@@ -468,8 +469,13 @@ function startTracker(tc) {
|
|
|
468
469
|
return tracker;
|
|
469
470
|
const refresh = () => followChrome(tc, tracker);
|
|
470
471
|
const sizes = new ResizeObserver(refresh);
|
|
472
|
+
let rows = null;
|
|
471
473
|
// The section itself (its padding follows the host rows and the compare
|
|
472
|
-
// strip), every legend row, the host rows and the action bar.
|
|
474
|
+
// strip), every legend row, the host rows and the action bar. Rows come and
|
|
475
|
+
// go with the indicators (direct children of the legend section), and a host
|
|
476
|
+
// row comes, goes and moves without resizing (the quick-trade pill, a child
|
|
477
|
+
// of the cell riding its inline `top`): re-watch, re-measure, so a top_left
|
|
478
|
+
// table re-seats under the pill when it mounts or moves.
|
|
473
479
|
const watch = () => {
|
|
474
480
|
sizes.disconnect();
|
|
475
481
|
sizes.observe(pane.plot);
|
|
@@ -478,18 +484,20 @@ function startTracker(tc) {
|
|
|
478
484
|
const bar = pane.root.querySelector(ACTION_BAR_SELECTOR);
|
|
479
485
|
if (bar)
|
|
480
486
|
sizes.observe(bar);
|
|
487
|
+
if (!rows)
|
|
488
|
+
return;
|
|
489
|
+
rows.disconnect();
|
|
490
|
+
rows.observe(pane.plot, { childList: true });
|
|
491
|
+
observeLegendHostRows(rows, pane);
|
|
481
492
|
};
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
const rows = typeof MutationObserver === 'function'
|
|
485
|
-
? new MutationObserver(() => {
|
|
493
|
+
if (typeof MutationObserver === 'function')
|
|
494
|
+
rows = new MutationObserver(() => {
|
|
486
495
|
if (trackers.get(tc) !== tracker)
|
|
487
496
|
return;
|
|
488
497
|
watch();
|
|
489
498
|
refresh();
|
|
490
|
-
})
|
|
491
|
-
|
|
492
|
-
rows?.observe(pane.plot, { childList: true });
|
|
499
|
+
});
|
|
500
|
+
watch();
|
|
493
501
|
tracker.stop = () => {
|
|
494
502
|
sizes.disconnect();
|
|
495
503
|
rows?.disconnect();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE switch of the per-order floor (BT-ORDER-FLOOR): whether a tape on a venue is judged per aggressor ORDER. One
|
|
3
|
+
* aggressor order on a CME Group venue fills as many small fills on one exchange stamp and side; Big Trades' "Combine
|
|
4
|
+
* fills: One order" and the kScript trades template add them back into one trade, so a floor applied to each fill
|
|
5
|
+
* before they arrive drops the fills of a big order one by one (the 147-contract NQZ6 buy of 2026-10-23 14:31:54Z, 45
|
|
6
|
+
* fills of 1 to 17 lots, drew as its two 17-lot fills).
|
|
7
|
+
*
|
|
8
|
+
* True, everything moves together: the K_TRADES control asks the history read's per-order floor (the payload's
|
|
9
|
+
* `perOrder`: the worker sends `minAmountPerOrder` on both lanes and keeps every row), the live raw TRADE prints pass
|
|
10
|
+
* the order gate (live-trades-order-gate.util) at the wrun intake's enqueue and the kScript fan-out instead of a floor
|
|
11
|
+
* per fill, the fold judges no single fill, the row builder hands the cell adapter the tape ask without its floor, and
|
|
12
|
+
* Big Trades' contracts floor defaults by the product root (wrun-market-size-defaults.leaf). False: every one of them
|
|
13
|
+
* exactly as before (the per-fill floors, the floored ask, the package's 10 and 100). The switch flips in the same roll
|
|
14
|
+
* as the gateway cutover, so a user never sees half of it (history per order beside live per fill).
|
|
15
|
+
*
|
|
16
|
+
* It holds when the venue is one the gateway judges per order (live-trades-merge.util `tradesFloorPerOrder`: the CME
|
|
17
|
+
* Group venues) and the host says the switch is on (`WrunChartHostEnv.tapePerOrder`: web's build flag
|
|
18
|
+
* VITE_WRUN_TAPE_PER_ORDER, off by default). When the instrument registry names the plane (`largeTradePerOrder` beside
|
|
19
|
+
* `largeTradeMinContracts`), its answer replaces the host flag here, and nowhere else.
|
|
20
|
+
*/
|
|
21
|
+
import { wrunHostTapePerOrder } from '../../host-env.js';
|
|
22
|
+
import { tradesFloorPerOrder } from '../../kscript-data/controls/live-trades-merge.util.js';
|
|
23
|
+
/** Whether a tape on `exchange` is judged per aggressor order (above). */
|
|
24
|
+
export function wrunTapePerOrder(exchange) {
|
|
25
|
+
return tradesFloorPerOrder(exchange) && wrunHostTapePerOrder();
|
|
26
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReplayBuffer, ReplayFollowRange, ReplayResolution } from '../../interfaces/replay.interface.js';
|
|
2
|
+
import { type LiveBucketVenue } from '../../utility/chart/live-bucket.util.js';
|
|
2
3
|
type ReplayFollowRangeTarget = {
|
|
3
4
|
resetRange?: (startKey: number, endKey: number) => void;
|
|
4
5
|
resetRangeByTs?: (startTs: number, endTs: number) => void;
|
|
@@ -131,13 +132,63 @@ export declare function supportedReplaySourceInterval(intervalLabel: string): st
|
|
|
131
132
|
export declare function replayCandleSourceInterval(chartIntervalMs: number): string;
|
|
132
133
|
export declare function alignProbeCursorMs(cursorMs: number, stepMs: number): number;
|
|
133
134
|
export declare function chartBucketOriginMs(chartIntervalMs: number): number;
|
|
134
|
-
|
|
135
|
+
/**
|
|
136
|
+
* The market a replay's chart bars are keyed for: the buffer's `barVenue` (the chart's own, its
|
|
137
|
+
* session included), or null for the plain grid. Every chart-bar read below takes it as a required
|
|
138
|
+
* argument, so no replay reader buckets an instant without naming the market whose history it reveals.
|
|
139
|
+
*/
|
|
140
|
+
export type ReplayBarVenue = LiveBucketVenue | null;
|
|
141
|
+
/**
|
|
142
|
+
* The KEY of the chart bar holding `timestampMs` on the chart's own grid: the bucket function its live
|
|
143
|
+
* candles key on (`liveBucketStartMs` over the chart market, its session included: the RTH-anchored
|
|
144
|
+
* bars of a CME chart in RTH, ES 4h at 13:30Z and a 17:30Z stub; the 09:30 New York bars of a
|
|
145
|
+
* regular-session stock; the CME session lattice in ETH, GC 4h in CDT at 22/02/06/10/14/18Z and a
|
|
146
|
+
* trade date keyed 00:00Z; the plain grid elsewhere). Between sessions an instant belongs to the bar
|
|
147
|
+
* still running across them (a stock's three-trade-date 3d bar overnight), else to none: null.
|
|
148
|
+
*/
|
|
149
|
+
export declare function replayBarKeyMs(timestampMs: number, chartIntervalMs: number, venue: ReplayBarVenue): number | null;
|
|
150
|
+
/**
|
|
151
|
+
* The OPEN of the bar keyed `barKeyMs`: its key, except a CME trade-date bar (1d, 3d, 1w) keyed
|
|
152
|
+
* 00:00Z, which opens at the 17:00 Chicago open the evening before (`cmeSessionBarOpenMs`).
|
|
153
|
+
*/
|
|
154
|
+
export declare function replayBarOpenMs(barKeyMs: number, chartIntervalMs: number, venue: ReplayBarVenue): number;
|
|
155
|
+
/**
|
|
156
|
+
* The END of the bar keyed `barKeyMs`, the instant it stops taking rows: its key plus the interval
|
|
157
|
+
* on the plain grid; the CME lattice's own end (`cmeSessionBarEndMs`: a 1d bar runs to the next
|
|
158
|
+
* 17:00 Chicago open, a fall-back Sunday's 4h bar an hour longer); a calendar bar's calendar end;
|
|
159
|
+
* and on a session grid the end of its last session (an RTH stub at the 20:15Z close, a stock's 3d
|
|
160
|
+
* bar at its third session's 16:00 close), walked once per bar on the quarter-hour probe.
|
|
161
|
+
*/
|
|
162
|
+
export declare function replayBarEndMs(barKeyMs: number, chartIntervalMs: number, venue: ReplayBarVenue): number;
|
|
163
|
+
/**
|
|
164
|
+
* A reader of the bar each row belongs to (`replayBarKeyMs`), for rows read in ascending order: the
|
|
165
|
+
* rows inside one probe step share their bar, so the bucket function runs once per step, never once
|
|
166
|
+
* per row (a 4h bar of 1s tick rows).
|
|
167
|
+
*/
|
|
168
|
+
export declare function replayBarKeyReader(chartIntervalMs: number, venue: ReplayBarVenue): (rowMs: number) => number | null;
|
|
169
|
+
/**
|
|
170
|
+
* The KEY of the chart bar holding `timestampMs` (`replayBarKeyMs`), or the instant itself where no
|
|
171
|
+
* bar holds it: every bar before it is settled and none has opened, so it cuts as a key would.
|
|
172
|
+
* Cutoffs and row keys read this; window starts read `chartBucketOpenMs`.
|
|
173
|
+
*/
|
|
174
|
+
export declare function alignChartBucketMs(timestampMs: number, chartIntervalMs: number, venue: ReplayBarVenue): number;
|
|
175
|
+
/** The OPEN of the bar holding `timestampMs` (`replayBarOpenMs`), or the instant where none holds it.
|
|
176
|
+
* Sub-row folds, fetch windows and retention floors start here. */
|
|
177
|
+
export declare function chartBucketOpenMs(timestampMs: number, chartIntervalMs: number, venue: ReplayBarVenue): number;
|
|
178
|
+
/** The END of the bar holding `timestampMs` (`replayBarEndMs`), or the instant where none holds it. */
|
|
179
|
+
export declare function chartBucketEndMs(timestampMs: number, chartIntervalMs: number, venue: ReplayBarVenue): number;
|
|
135
180
|
export declare function replayResolutionRestartAnchorMs(args: {
|
|
136
181
|
userAnchorMs: number | null;
|
|
137
182
|
rebuildAnchorMs: number;
|
|
138
183
|
}): number;
|
|
139
184
|
export declare function sourceIntervalMsForLabel(label: string): number | null;
|
|
140
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Finer source rows folded into the chart's own bars (`replayBarKeyMs`: a CME 2h chart in CST on its
|
|
187
|
+
* odd-hour lattice, an RTH chart on its anchored bars), each bar keyed and folded as
|
|
188
|
+
* `aggregateOhlcvRows` folds; a row no bar holds is dropped. Rows already at the chart interval or
|
|
189
|
+
* coarser pass through.
|
|
190
|
+
*/
|
|
191
|
+
export declare function aggregateSourceRowsToChartInterval(rows: number[][], sourceInterval: string, chartIntervalMs: number, minMs: number, maxMs: number, venue: ReplayBarVenue): number[][];
|
|
141
192
|
export declare function chartIntervalLabel(chartIntervalMs: number): string;
|
|
142
193
|
export declare function replayHeatmapResolutionLabel(tf: ReplayResolution, chartIntervalMs: number): string;
|
|
143
194
|
export declare function maxLoadedBarsForReplayResolution(tf: ReplayResolution, chartIntervalMs: number): number;
|