@orangecharts/wrun-chart-host 0.9.0 → 0.11.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 +15 -1
- package/dist/constants/feature-flags.constants.js +130 -24
- package/dist/constants/governed-exchanges.constants.d.ts +12 -0
- package/dist/constants/governed-exchanges.constants.js +16 -0
- package/dist/constants/opra-compliance.constants.d.ts +3 -2
- package/dist/constants/opra-compliance.constants.js +3 -2
- package/dist/constants/option-venues.constants.d.ts +2 -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 +21 -5
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +102 -19
- package/dist/index.d.ts +18 -0
- package/dist/index.js +18 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +1 -1
- package/dist/interfaces/cme-realtime.interface.d.ts +16 -9
- package/dist/interfaces/cme-realtime.interface.js +6 -3
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +12 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +1 -5
- package/dist/interfaces/prediction-market.interface.d.ts +7 -0
- package/dist/interfaces/replay.interface.d.ts +8 -0
- package/dist/interfaces/stocks-realtime.interface.d.ts +57 -0
- package/dist/interfaces/stocks-realtime.interface.js +32 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +62 -94
- package/dist/kscript-data/controls/live-trades-merge.util.js +106 -171
- package/dist/market-data/billing.interface.d.ts +174 -36
- package/dist/market-data/billing.interface.js +58 -8
- package/dist/market-data/venue.d.ts +152 -7
- 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 +294 -7
- package/dist/market-data/venues/index.js +49 -6
- package/dist/market-data/venues/opra.contract.copy.json +3 -2
- package/dist/market-data/venues/opra.d.ts +2 -2
- package/dist/market-data/venues/opra.js +5 -2
- package/dist/market-data/venues/stocks.contract.copy.json +64 -0
- package/dist/market-data/venues/stocks.d.ts +130 -0
- package/dist/market-data/venues/stocks.js +117 -0
- package/dist/settings-templates/footprint-rows.js +35 -2
- package/dist/settings-templates/form-rows.d.ts +2 -1
- 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 +79 -10
- package/dist/settings-templates/tool-rules.d.ts +32 -15
- package/dist/settings-templates/tool-rules.js +33 -11
- package/dist/settings-templates/tool-tables.generated.js +95 -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/cme-cache-context.util.d.ts +5 -3
- package/dist/utility/chart/cme-cache-context.util.js +10 -6
- package/dist/utility/chart/cme-realtime.util.js +10 -0
- package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +83 -0
- package/dist/utility/chart/cme-user-scripts-gate.util.js +142 -0
- package/dist/utility/chart/effective-chart-session.util.d.ts +14 -0
- package/dist/utility/chart/effective-chart-session.util.js +39 -0
- package/dist/utility/chart/host-bar-placement.util.d.ts +28 -0
- package/dist/utility/chart/host-bar-placement.util.js +170 -30
- package/dist/utility/chart/index-host-tier.util.d.ts +3 -1
- package/dist/utility/chart/index-host-tier.util.js +7 -2
- package/dist/utility/chart/index-mode-admission.util.js +30 -3
- package/dist/utility/chart/kscript-apply-fingerprint.util.js +1 -1
- 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 +9 -7
- package/dist/utility/chart/kscript-live-coalesce.util.js +13 -8
- package/dist/utility/chart/kscript-live-source-identity.util.d.ts +9 -0
- package/dist/utility/chart/kscript-live-source-identity.util.js +10 -1
- package/dist/utility/chart/kscript-provenance-keys.util.js +13 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +5 -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 +156 -43
- package/dist/utility/chart/kscript-venue-policy.util.js +249 -59
- package/dist/utility/chart/live-bucket.util.d.ts +24 -8
- package/dist/utility/chart/live-bucket.util.js +85 -27
- 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/marketKind.util.js +5 -0
- package/dist/utility/chart/mixed-mode.util.d.ts +7 -0
- package/dist/utility/chart/mixed-mode.util.js +14 -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/opra-user-scripts-gate.util.d.ts +11 -16
- package/dist/utility/chart/opra-user-scripts-gate.util.js +12 -28
- package/dist/utility/chart/rth-session.util.d.ts +12 -10
- package/dist/utility/chart/rth-session.util.js +25 -21
- package/dist/utility/chart/trading-day.util.d.ts +17 -0
- package/dist/utility/chart/trading-day.util.js +59 -0
- 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/window-owner.leaf.d.ts +23 -2
- package/dist/utility/chart/window-owner.leaf.js +45 -3
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +33 -15
- package/dist/utility/chart/wrun-bar-session-facts.util.js +70 -20
- 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/intl-locale.util.js +5 -0
- 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 +4 -0
- package/dist/utility/v2/gate-plane.util.d.ts +12 -3
- package/dist/utility/v2/gate-plane.util.js +30 -4
- package/dist/utility/v2/gate-session-latch.util.js +1 -1
- package/dist/utility/v2/stocks-governed.util.d.ts +16 -0
- package/dist/utility/v2/stocks-governed.util.js +34 -0
- package/dist/utility/wrun/derived-roots.leaf.d.ts +13 -0
- package/dist/utility/wrun/derived-roots.leaf.js +27 -0
- package/dist/utility/wrun/derived-roots.util.d.ts +205 -0
- package/dist/utility/wrun/derived-roots.util.js +451 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +43 -7
- 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/run-schedule/wrun-own-candles.util.d.ts +24 -3
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +46 -10
- 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 +41 -10
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +111 -0
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +133 -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 +197 -13
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +761 -27
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +1 -2
- 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 +60 -16
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +113 -61
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +33 -0
- 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-handles.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-handles.util.js +9 -8
- 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-input-requirements.leaf.d.ts +68 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +163 -7
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +59 -23
- package/dist/utility/wrun/wrun-leg-close.util.js +186 -28
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +35 -15
- package/dist/utility/wrun/wrun-live-intake.util.js +243 -126
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +13 -5
- package/dist/utility/wrun/wrun-live-tick.util.js +279 -99
- package/dist/utility/wrun/wrun-market-facts.util.d.ts +13 -3
- package/dist/utility/wrun/wrun-market-facts.util.js +13 -3
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +60 -11
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +70 -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-book-rows.util.d.ts +56 -0
- package/dist/utility/wrun/wrun-option-book-rows.util.js +96 -0
- 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 +323 -28
- package/dist/utility/wrun/wrun-option-views.util.js +484 -71
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-options-chain.util.js +2 -0
- 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 +32 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +13 -3
- 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-recovery.util.js +3 -1
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +160 -42
- package/dist/utility/wrun/wrun-overlay-run.util.js +1244 -209
- 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 +114 -19
- 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.d.ts +15 -2
- package/dist/utility/wrun/wrun-pin-spelling.util.js +39 -14
- 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-refusal.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-refusal.util.js +22 -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-registry-errors.util.d.ts +26 -0
- package/dist/utility/wrun/wrun-registry-errors.util.js +34 -0
- package/dist/utility/wrun/wrun-replay-lane.util.js +3 -2
- package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +20 -6
- package/dist/utility/wrun/wrun-run-interval-session.util.js +22 -7
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +43 -9
- package/dist/utility/wrun/wrun-run-interval.util.js +58 -15
- 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 +118 -8
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +29 -18
- package/dist/utility/wrun/wrun-source-rows.util.js +61 -27
- 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 +7 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +17 -9
- package/dist/utility/wrun/wrun-tape-source.util.js +20 -12
- package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
- package/dist/utils/replay/replay-buffer-math.js +227 -20
- package/dist/workers/constants/socket-slots.d.ts +91 -6
- package/dist/workers/constants/socket-slots.js +85 -6
- package/package.json +5 -5
|
@@ -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)
|
|
@@ -1092,6 +1126,12 @@ export class SocketWrunRowSource {
|
|
|
1092
1126
|
const servedLegs = mergeWrunSocketServedLegs(freshSheet !== undefined ? undefined : this.runLevel.servedLegs, level.servedLegs);
|
|
1093
1127
|
// The skipped elements the newest answer named, as it named them; a page without the keys keeps the session's.
|
|
1094
1128
|
const skipped = level.skipped ?? (freshSheet !== undefined ? undefined : this.runLevel.skipped);
|
|
1129
|
+
// The receipt of the session's OPRA rows (contract opra-server-lanes C4): a fresh session's result names its
|
|
1130
|
+
// own (none without the mark or a tier). A page carrying the mark that names no tier read no chain (the cloud's
|
|
1131
|
+
// pan-back chunk: kscript-backend `wrunOpraRowsReceipt`), and the rows it extends are the session's, served at
|
|
1132
|
+
// the tier the session holds, so the session's receipt stands and the legend's word with it. A page without the
|
|
1133
|
+
// mark (a re-plan off OPRA) drops it; a page naming another tier never reaches here (`servedTierMoved`).
|
|
1134
|
+
const opraServed = level.opraServed ?? (freshSheet === undefined && level.opra === true ? this.runLevel.opraServed : undefined);
|
|
1095
1135
|
this.runLevel = {
|
|
1096
1136
|
...(strategy !== undefined ? { strategy } : {}),
|
|
1097
1137
|
diagnostics: level.diagnostics ?? [],
|
|
@@ -1099,9 +1139,71 @@ export class SocketWrunRowSource {
|
|
|
1099
1139
|
...(skipped !== undefined ? { skipped } : {}),
|
|
1100
1140
|
// The newest result's OPRA word (every result answers one): a re-plan off OPRA names false.
|
|
1101
1141
|
...(level.opra !== undefined ? { opra: level.opra } : {}),
|
|
1142
|
+
...(opraServed !== undefined ? { opraServed } : {}),
|
|
1102
1143
|
};
|
|
1144
|
+
if (freshSheet !== undefined)
|
|
1145
|
+
this.retainedTier = undefined;
|
|
1146
|
+
this.retainTier(level);
|
|
1103
1147
|
});
|
|
1104
1148
|
}
|
|
1149
|
+
// ── The served tier ──────────────────────────────────────────────────────────────────────────
|
|
1150
|
+
/** A merge's tier joins the session's: the tier the receipt of a marked answer named, when it named one. */
|
|
1151
|
+
retainTier(level) {
|
|
1152
|
+
if (level.opra === true && level.opraServed !== undefined)
|
|
1153
|
+
this.retainedTier = level.opraServed.tier;
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Whether an answer moves the session's served tier: it carries the OPRA mark and names a tier, and the rows the
|
|
1157
|
+
* session holds were served at the other one (contract opra-server-lanes C4: the gate re-resolved the owner's tier,
|
|
1158
|
+
* a downgrade or an upgrade). An answer that names no tier moves nothing (its rows read no OPRA yet), nor does a
|
|
1159
|
+
* session whose rows never named one.
|
|
1160
|
+
*/
|
|
1161
|
+
servedTierMoved(level) {
|
|
1162
|
+
const tier = level.opra === true ? level.opraServed?.tier : undefined;
|
|
1163
|
+
return tier !== undefined && this.retainedTier !== undefined && tier !== this.retainedTier;
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* The served tier moved under the session: nothing it holds may stand beside rows served at the new tier (a
|
|
1167
|
+
* real-time prefix under a delayed receipt, or the reverse). Its rows, coverage, owed window, cells and run-level
|
|
1168
|
+
* keys go, the generation moves (an ask on its way settles superseded, a frame merged behind this one is dropped), and
|
|
1169
|
+
* the overlay is told (`WrunRowBatch.servedTierMoved`): it takes what it drew off the chart, ends its live session
|
|
1170
|
+
* and reruns, which creates a fresh session at the tier the cloud serves now. The source never extends a session
|
|
1171
|
+
* across the move.
|
|
1172
|
+
*/
|
|
1173
|
+
dropSessionAtServedTier(window) {
|
|
1174
|
+
this.nextGeneration();
|
|
1175
|
+
this.current = undefined;
|
|
1176
|
+
this.answered = [];
|
|
1177
|
+
this.runLevel = {};
|
|
1178
|
+
this.owed = undefined;
|
|
1179
|
+
this.cells = undefined;
|
|
1180
|
+
this.retainedTier = undefined;
|
|
1181
|
+
const frame = {
|
|
1182
|
+
window: { ...window },
|
|
1183
|
+
asOfMs: Number.NaN,
|
|
1184
|
+
rows: [],
|
|
1185
|
+
grids: [],
|
|
1186
|
+
frames: undefined,
|
|
1187
|
+
handles: undefined,
|
|
1188
|
+
refusals: [],
|
|
1189
|
+
servedTierMoved: true,
|
|
1190
|
+
};
|
|
1191
|
+
if (this.listener === undefined)
|
|
1192
|
+
this.servedTierMoveOwed = frame;
|
|
1193
|
+
else
|
|
1194
|
+
this.deliver(frame);
|
|
1195
|
+
}
|
|
1196
|
+
deliver(frame) {
|
|
1197
|
+
const listener = this.listener;
|
|
1198
|
+
if (listener === undefined)
|
|
1199
|
+
return;
|
|
1200
|
+
try {
|
|
1201
|
+
listener(frame);
|
|
1202
|
+
}
|
|
1203
|
+
catch (error) {
|
|
1204
|
+
console.warn('[wrun] socket row source frame listener failed:', error);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1105
1207
|
/**
|
|
1106
1208
|
* Page a window until the planner's coverage says done: each round runs the pages still missing,
|
|
1107
1209
|
* newest first and planned again after each one, through the in-flight registry (or around it, for a
|
|
@@ -1308,6 +1410,12 @@ export class SocketWrunRowSource {
|
|
|
1308
1410
|
// A frame before the session's first answer (or of a patch not yet answered) has nothing to extend.
|
|
1309
1411
|
if (this.current?.identity !== identity)
|
|
1310
1412
|
return;
|
|
1413
|
+
// A frame served at another tier than the rows the session holds never extends them: the session is dropped
|
|
1414
|
+
// and the overlay reseeds (`dropSessionAtServedTier`).
|
|
1415
|
+
if (this.servedTierMoved(level)) {
|
|
1416
|
+
this.dropSessionAtServedTier(read.wire.window);
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1311
1419
|
const merge = mergeWrunHostedReply(this.current, read.wire, { identity, kind: 'live' }, WRUN_SOCKET_ROW_STORE_UNCAPPED);
|
|
1312
1420
|
if ('refused' in merge)
|
|
1313
1421
|
return;
|
|
@@ -1319,6 +1427,13 @@ export class SocketWrunRowSource {
|
|
|
1319
1427
|
this.runLevel = { ...this.runLevel, diagnostics: level.diagnostics };
|
|
1320
1428
|
if (level.skipped !== undefined)
|
|
1321
1429
|
this.runLevel = { ...this.runLevel, skipped: level.skipped };
|
|
1430
|
+
// A frame with the OPRA mark names the receipt of its own rows, the session's newest: its tier, or none (a
|
|
1431
|
+
// frame computed before any OPRA read answered names no tier, and the legend then names none).
|
|
1432
|
+
if (level.opra === true) {
|
|
1433
|
+
const { opraServed: _replaced, ...rest } = this.runLevel;
|
|
1434
|
+
this.runLevel = { ...rest, ...(level.opraServed !== undefined ? { opraServed: level.opraServed } : {}) };
|
|
1435
|
+
}
|
|
1436
|
+
this.retainTier(level);
|
|
1322
1437
|
this.emitFrame(read.wire, merge, level);
|
|
1323
1438
|
}).catch((error) => {
|
|
1324
1439
|
console.warn('[wrun] socket row source live frame skipped:', error);
|
|
@@ -1344,12 +1459,7 @@ export class SocketWrunRowSource {
|
|
|
1344
1459
|
refusals: session.refusals.map((refusal) => ({ ...refusal })),
|
|
1345
1460
|
...runLevelFields({ ...level, servedLegs: this.runLevel.servedLegs }),
|
|
1346
1461
|
};
|
|
1347
|
-
|
|
1348
|
-
listener(frame);
|
|
1349
|
-
}
|
|
1350
|
-
catch (error) {
|
|
1351
|
-
console.warn('[wrun] socket row source frame listener failed:', error);
|
|
1352
|
-
}
|
|
1462
|
+
this.deliver(frame);
|
|
1353
1463
|
}
|
|
1354
1464
|
}
|
|
1355
1465
|
// ── The one extra ask after a refusal for absent facts ───────────────────────────────────────────
|
|
@@ -119,14 +119,7 @@
|
|
|
119
119
|
* refuses by name where the host builds the live row's block
|
|
120
120
|
* (`wrun_cell_block_too_large`, never truncated).
|
|
121
121
|
* - `tape` (celled): the K_TRADES large lane's rows (`k-trades.worker.ts`:
|
|
122
|
-
* `[barTs, [offsetMs, price, size, side], ...]`, the
|
|
123
|
-
* above the acquisition's `min_size`, history from TRADE_LARGE sorted by
|
|
124
|
-
* offset, live prints folded in arrival order by `live-trades-merge.util.ts`)
|
|
125
|
-
* become the ABI's `[offsetMs, price, size, side]` 4-tuples through the
|
|
126
|
-
* shared host's cell adapter, side +1 for a buy and -1 for a sell, in the
|
|
127
|
-
* row's own order, the plan's floor kept (the host plans the tape ask with
|
|
128
|
-
* `min_size` resolved from the run's settings, `sources.settings`, the floor
|
|
129
|
-
* the lane's acquisition was asked at). A primary bar with no row (before the
|
|
122
|
+
* `[barTs, [offsetMs, price, size, side], ...]`, one TRADE_LARGE row per order) become the ABI's 4-tuples, floored by the plan. A primary bar with no row (before the
|
|
130
123
|
* served history, a quiet bar, a live-edge tape) is a PRESENT EMPTY block; a
|
|
131
124
|
* bar over the input's `max_cells` refuses by name where the rows are packed
|
|
132
125
|
* (`wrun_cell_block_too_large`, never truncated). The facets (`min_size`,
|
|
@@ -342,7 +335,7 @@
|
|
|
342
335
|
* tail build gives the same answer.
|
|
343
336
|
*/
|
|
344
337
|
import { type WrunPinnedInterval } from './wrun-pinned-interval.util.js';
|
|
345
|
-
import type
|
|
338
|
+
import { type LiveBucketVenue } from '../chart/live-bucket.util.js';
|
|
346
339
|
import { type WrunBarVenue } from '../chart/wrun-bar-session-facts.util.js';
|
|
347
340
|
import type { WrunIndicatorMetadata, WrunInputSource, WrunInputView, WrunMetadataParam } from '../../interfaces/wrun-runtime.interface.js';
|
|
348
341
|
import type { WrunInputCarry as WrunHostInputCarry, WrunLegRowBounds } from '@orangecharts/indicator-kit/host';
|
|
@@ -592,13 +585,22 @@ export interface WrunChartSourceRows {
|
|
|
592
585
|
* either is declared. */
|
|
593
586
|
venue?: WrunBarVenue;
|
|
594
587
|
}
|
|
595
|
-
/** The chart's market as the shared host's session calendar reads it (`WrunChartSourceRows.session
|
|
588
|
+
/** The chart's market as the shared host's session calendar reads it (`WrunChartSourceRows.session`,
|
|
589
|
+
* built by `wrunChartSession`). */
|
|
596
590
|
export interface WrunChartSession {
|
|
597
591
|
/** The chart's exchange: the venue of its own rows and of every leg that names none. */
|
|
598
592
|
exchange?: string;
|
|
599
|
-
/** The
|
|
600
|
-
*
|
|
593
|
+
/** The chart's symbol: the symbol of its own rows and of every leg that names none, by which the session
|
|
594
|
+
* calendar finds a future's RTH window. */
|
|
595
|
+
symbol?: string;
|
|
596
|
+
/** The session the chart rides, always stated: on a market with an RTH window the effective word
|
|
597
|
+
* (`effectiveChartSessionType` at the chart's interval: 'regular' only while the chart rides RTH), else
|
|
598
|
+
* `wrunChartSessionType` ('extended' only while the chart runs its extended session). */
|
|
601
599
|
sessionType: 'regular' | 'extended';
|
|
600
|
+
/** The session the chart fetches a pinned US listing's candles on, present only where it differs from
|
|
601
|
+
* `sessionType` (`wrunChartSessionType` of the persisted word: a future riding its full session fetches a
|
|
602
|
+
* stock leg's regular hours). */
|
|
603
|
+
listingSessionType?: 'regular' | 'extended';
|
|
602
604
|
}
|
|
603
605
|
/** A calendar row's bounds (1M 3M 6M 1Y, on every market): from its label to its calendar end
|
|
604
606
|
* (February 2026 from Feb 1 to Mar 1, never the average month's Mar 3 10:30); undefined at a fixed
|
|
@@ -865,12 +867,20 @@ export declare const WRUN_PINNED_WIRE_ROWS: Readonly<{
|
|
|
865
867
|
readonly candles: "native";
|
|
866
868
|
readonly typed: "none";
|
|
867
869
|
}>;
|
|
868
|
-
/** A leg's rows as `wrunLegRowsOnHostBars` lands them: their own span (the leg's interval, a trades leg's tier)
|
|
869
|
-
* their row class (`WRUN_LEG_ROW_HOST_MERGE`: how one chart bar merges them)
|
|
870
|
+
/** A leg's rows as `wrunLegRowsOnHostBars` lands them: their own span (the leg's interval, a trades leg's tier),
|
|
871
|
+
* their row class (`WRUN_LEG_ROW_HOST_MERGE`: how one chart bar merges them) and their own bar grid (`rowVenue`: a
|
|
872
|
+
* session's stub row ends at its close, `rowLastInstantMs`; absent, the nominal span). */
|
|
870
873
|
export interface WrunLegRowsSpan {
|
|
871
874
|
legMs: number;
|
|
872
875
|
rowClass: WrunLegRowClass;
|
|
876
|
+
rowVenue?: LiveBucketVenue | null;
|
|
873
877
|
}
|
|
878
|
+
/** A pinned leg's own bar grid (`WrunLegRowsSpan.rowVenue`): its market, the chart's own when it names none, at the
|
|
879
|
+
* session the chart's bar grid carries (the session its rows were asked at). */
|
|
880
|
+
export declare function wrunLegRowVenue(market: {
|
|
881
|
+
exchange?: unknown;
|
|
882
|
+
symbol?: unknown;
|
|
883
|
+
} | undefined, barGrid: LiveBucketVenue | null | undefined): LiveBucketVenue;
|
|
874
884
|
/** The interval (ms) a lane's acquisition was asked at (its `interval` word, the payload field the K control asks
|
|
875
885
|
* by), undefined when it names none: a trades leg's tier (`WrunChartSourceRows.tradeLegIntervals`). */
|
|
876
886
|
export declare function wrunLaneAcquisitionIntervalMs(acquisition: Readonly<Record<string, unknown>> | undefined): number | undefined;
|
|
@@ -943,11 +953,12 @@ export interface WrunHostBarGrid {
|
|
|
943
953
|
/**
|
|
944
954
|
* The chart bar a grid leg's row stamped `rowTs` lands in, for one row and with no forming bar
|
|
945
955
|
* (`wrunLegRowsOnHostBars`'s rule for a closed row): its own stamp when that opens a chart bar, else the bar
|
|
946
|
-
* holding its last instant (by its open on a calendar span
|
|
947
|
-
*
|
|
948
|
-
*
|
|
956
|
+
* holding its last instant (by its open on a calendar span; on `rowVenue`, the leg's own grid, a session's stub row
|
|
957
|
+
* lasts to its close, `rowLastInstantMs`); null when no bar holds it (off the chart's session). `barOf` is the
|
|
958
|
+
* chart's bucket function at its own interval (`hostBucketResolverFor` over its bar grid). The live session reads it
|
|
959
|
+
* to tell which committed bar a revised leg row reaches.
|
|
949
960
|
*/
|
|
950
|
-
export declare function wrunLegRowHostBar(rowTs: number, legMs: number, barOf: (tsMs: number) => number | null): number | null;
|
|
961
|
+
export declare function wrunLegRowHostBar(rowTs: number, legMs: number, barOf: (tsMs: number) => number | null, rowVenue?: LiveBucketVenue | null): number | null;
|
|
951
962
|
/**
|
|
952
963
|
* A grid leg's rows as the shared host's exact cursor reads them (`WRUN_PINNED_WIRE_ROWS`): each row in the chart
|
|
953
964
|
* bar holding its LAST instant (`placeRowsInHostBars` over the leg's own span, merged by the leg's row shape,
|
|
@@ -119,14 +119,7 @@
|
|
|
119
119
|
* refuses by name where the host builds the live row's block
|
|
120
120
|
* (`wrun_cell_block_too_large`, never truncated).
|
|
121
121
|
* - `tape` (celled): the K_TRADES large lane's rows (`k-trades.worker.ts`:
|
|
122
|
-
* `[barTs, [offsetMs, price, size, side], ...]`, the
|
|
123
|
-
* above the acquisition's `min_size`, history from TRADE_LARGE sorted by
|
|
124
|
-
* offset, live prints folded in arrival order by `live-trades-merge.util.ts`)
|
|
125
|
-
* become the ABI's `[offsetMs, price, size, side]` 4-tuples through the
|
|
126
|
-
* shared host's cell adapter, side +1 for a buy and -1 for a sell, in the
|
|
127
|
-
* row's own order, the plan's floor kept (the host plans the tape ask with
|
|
128
|
-
* `min_size` resolved from the run's settings, `sources.settings`, the floor
|
|
129
|
-
* the lane's acquisition was asked at). A primary bar with no row (before the
|
|
122
|
+
* `[barTs, [offsetMs, price, size, side], ...]`, one TRADE_LARGE row per order) become the ABI's 4-tuples, floored by the plan. A primary bar with no row (before the
|
|
130
123
|
* served history, a quiet bar, a live-edge tape) is a PRESENT EMPTY block; a
|
|
131
124
|
* bar over the input's `max_cells` refuses by name where the rows are packed
|
|
132
125
|
* (`wrun_cell_block_too_large`, never truncated). The facets (`min_size`,
|
|
@@ -347,7 +340,8 @@ import { Intervals } from '../../constants/interval.constants.js';
|
|
|
347
340
|
import { barEndMs, calendarBarStartMs, calendarLongestBarMs, calendarMonthsOfMs, isCalendarIntervalMs, } from '../chart/calendar-interval.util.js';
|
|
348
341
|
import { WRUN_PINNED_INTERVALS, wrunPinnedIntervalOf } from './wrun-pinned-interval.util.js';
|
|
349
342
|
import { realMainRows } from '../chart/indicator-gap-detector.util.js';
|
|
350
|
-
import { placeRowsInHostBars } from '../chart/host-bar-placement.util.js';
|
|
343
|
+
import { placeRowsInHostBars, rowLastInstantMs } from '../chart/host-bar-placement.util.js';
|
|
344
|
+
import { liveBucketVenueOf } from '../chart/live-bucket.util.js';
|
|
351
345
|
import { findMonday } from '../chart/titan-constants.pin.js';
|
|
352
346
|
import { wrunBarSessionFactsResolver, } from '../chart/wrun-bar-session-facts.util.js';
|
|
353
347
|
import { wrunSettingRefusedMessage } from '../scriptEditor/wrun-runtime-diagnostics.leaf.js';
|
|
@@ -748,6 +742,15 @@ export const WRUN_PINNED_WIRE_ROWS = Object.freeze({
|
|
|
748
742
|
candles: 'native',
|
|
749
743
|
typed: 'none',
|
|
750
744
|
});
|
|
745
|
+
/** A pinned leg's own bar grid (`WrunLegRowsSpan.rowVenue`): its market, the chart's own when it names none, at the
|
|
746
|
+
* session the chart's bar grid carries (the session its rows were asked at). */
|
|
747
|
+
export function wrunLegRowVenue(market, barGrid) {
|
|
748
|
+
return liveBucketVenueOf({
|
|
749
|
+
exchange: market?.exchange ?? barGrid?.exchange,
|
|
750
|
+
symbol: market?.symbol ?? barGrid?.symbol,
|
|
751
|
+
sessionType: barGrid?.sessionType,
|
|
752
|
+
});
|
|
753
|
+
}
|
|
751
754
|
/** The interval (ms) a lane's acquisition was asked at (its `interval` word, the payload field the K control asks
|
|
752
755
|
* by), undefined when it names none: a trades leg's tier (`WrunChartSourceRows.tradeLegIntervals`). */
|
|
753
756
|
export function wrunLaneAcquisitionIntervalMs(acquisition) {
|
|
@@ -865,17 +868,18 @@ export async function wrunAskWirePieces(pieces, ask, abandoned) {
|
|
|
865
868
|
/**
|
|
866
869
|
* The chart bar a grid leg's row stamped `rowTs` lands in, for one row and with no forming bar
|
|
867
870
|
* (`wrunLegRowsOnHostBars`'s rule for a closed row): its own stamp when that opens a chart bar, else the bar
|
|
868
|
-
* holding its last instant (by its open on a calendar span
|
|
869
|
-
*
|
|
870
|
-
*
|
|
871
|
+
* holding its last instant (by its open on a calendar span; on `rowVenue`, the leg's own grid, a session's stub row
|
|
872
|
+
* lasts to its close, `rowLastInstantMs`); null when no bar holds it (off the chart's session). `barOf` is the
|
|
873
|
+
* chart's bucket function at its own interval (`hostBucketResolverFor` over its bar grid). The live session reads it
|
|
874
|
+
* to tell which committed bar a revised leg row reaches.
|
|
871
875
|
*/
|
|
872
|
-
export function wrunLegRowHostBar(rowTs, legMs, barOf) {
|
|
876
|
+
export function wrunLegRowHostBar(rowTs, legMs, barOf, rowVenue) {
|
|
873
877
|
if (!Number.isFinite(rowTs))
|
|
874
878
|
return null;
|
|
875
879
|
const open = barOf(rowTs);
|
|
876
880
|
if (open === rowTs || !(legMs > 0) || isCalendarIntervalMs(legMs))
|
|
877
881
|
return open;
|
|
878
|
-
return barOf(rowTs
|
|
882
|
+
return barOf(rowLastInstantMs(rowTs, legMs, rowVenue));
|
|
879
883
|
}
|
|
880
884
|
/** The index of the first of ascending `values` above `ms` (`values.length` when none is). */
|
|
881
885
|
function firstValueAbove(values, ms) {
|
|
@@ -925,7 +929,9 @@ export function wrunLegRowsOnHostBars(rows, host, leg, afterTs) {
|
|
|
925
929
|
const floor = Math.max(opens[from] - reach, opens[from - 1]);
|
|
926
930
|
placedFrom = Math.max(lead, wrunLastRowAtOrBefore(rows, floor) + 1);
|
|
927
931
|
}
|
|
928
|
-
const placed = placeRowsInHostBars((placedFrom === 0 ? rows : rows.slice(placedFrom)), { mainRows: (from === 0 ? opens : opens.slice(from)).map((open) => [open]), intervalMs, venue: host.barGrid }, WRUN_LEG_ROW_HOST_MERGE[leg.rowClass], undefined, spanMs === undefined
|
|
932
|
+
const placed = placeRowsInHostBars((placedFrom === 0 ? rows : rows.slice(placedFrom)), { mainRows: (from === 0 ? opens : opens.slice(from)).map((open) => [open]), intervalMs, venue: host.barGrid }, WRUN_LEG_ROW_HOST_MERGE[leg.rowClass], undefined, spanMs === undefined
|
|
933
|
+
? undefined
|
|
934
|
+
: { rowSpanMs: spanMs, formingBarTs: host.formingBarTs ?? null, rowVenue: leg.rowVenue });
|
|
929
935
|
if (lead === 0 && placedFrom === 0 && placed.length === rows.length && placed.every((row, at) => row === rows[at])) {
|
|
930
936
|
return rows;
|
|
931
937
|
}
|
|
@@ -2370,22 +2376,47 @@ function wrunPlainLaneRows(rows) {
|
|
|
2370
2376
|
: rows;
|
|
2371
2377
|
}
|
|
2372
2378
|
/** The session answers a run's clock carries (`WrunHostAlignClock`), keyed as the aligner reads
|
|
2373
|
-
* them: `wrunSessionClock` over the plan on the chart's session (
|
|
2374
|
-
* leg candles' closes and opens; none without a session), and a
|
|
2375
|
-
* market (`wrunCalendarRowBounds`, the chart's own rule beside the
|
|
2376
|
-
* under the chart's placeholder market (`WRUN_ROWS_CHART_MARKET`), so an
|
|
2377
|
-
* rows, a leg that names no exchange) reads the chart's exchange
|
|
2379
|
+
* them: `wrunSessionClock` over the plan on the chart's session (its symbol and the session the chart
|
|
2380
|
+
* rides: the session rows' bounds, the leg candles' closes and opens; none without a session), and a
|
|
2381
|
+
* calendar row's bounds on every market (`wrunCalendarRowBounds`, the chart's own rule beside the
|
|
2382
|
+
* package's). The browser plans under the chart's placeholder market (`WRUN_ROWS_CHART_MARKET`), so an
|
|
2383
|
+
* ask on it (the chart's own rows, a leg that names no exchange or no symbol) reads the chart's exchange
|
|
2384
|
+
* and symbol, as the browser's fetch does. The clock reads one session word for the chart's own rules
|
|
2385
|
+
* and for a US listing's: where the chart fetches a pinned listing on another session
|
|
2386
|
+
* (`listingSessionType`: a future riding its full session fetches a stock leg's regular hours), the
|
|
2387
|
+
* listing legs take their closes from the clock read again on that word, over their asks alone. */
|
|
2378
2388
|
function wrunSessionAnswersOf(host, plan, session, intervalMs) {
|
|
2379
2389
|
const calendarBounds = wrunCalendarRowBounds(intervalMs);
|
|
2380
2390
|
const calendar = calendarBounds === undefined ? {} : { rowBounds: calendarBounds };
|
|
2381
2391
|
if (session === undefined)
|
|
2382
2392
|
return calendar;
|
|
2383
|
-
const { exchange, sessionType } = session;
|
|
2384
|
-
const fetches = exchange === undefined
|
|
2393
|
+
const { exchange, symbol, sessionType, listingSessionType } = session;
|
|
2394
|
+
const fetches = exchange === undefined && symbol === undefined
|
|
2385
2395
|
? plan.fetches
|
|
2386
|
-
: plan.fetches.map((ask) =>
|
|
2396
|
+
: plan.fetches.map((ask) => {
|
|
2397
|
+
const onExchange = exchange !== undefined && ask.exchange === WRUN_ROWS_CHART_MARKET.exchange;
|
|
2398
|
+
const onSymbol = symbol !== undefined && ask.symbol === WRUN_ROWS_CHART_MARKET.symbol;
|
|
2399
|
+
return onExchange || onSymbol
|
|
2400
|
+
? { ...ask, ...(onExchange ? { exchange } : {}), ...(onSymbol ? { symbol } : {}) }
|
|
2401
|
+
: ask;
|
|
2402
|
+
});
|
|
2403
|
+
// A typed value, not an object literal: a kit whose clock names no `symbol` compiles with it and reads none.
|
|
2404
|
+
const chart = {
|
|
2405
|
+
exchange: exchange ?? '',
|
|
2406
|
+
intervalMs,
|
|
2407
|
+
...(symbol !== undefined ? { symbol } : {}),
|
|
2408
|
+
sessionType,
|
|
2409
|
+
};
|
|
2410
|
+
const answers = host.wrunSessionClock({ ...plan, fetches }, chart);
|
|
2411
|
+
const listingWord = listingSessionType !== sessionType ? listingSessionType : undefined;
|
|
2412
|
+
const listingAsks = listingWord === undefined ? [] : fetches.filter((ask) => host.wrunCalendarOfVenue(ask.exchange) === 'us_equities');
|
|
2413
|
+
if (listingWord === undefined || listingAsks.length === 0)
|
|
2414
|
+
return { ...answers, ...calendar };
|
|
2415
|
+
const listing = { ...chart, sessionType: listingWord };
|
|
2416
|
+
const listingCloses = host.wrunSessionClock({ ...plan, fetches: listingAsks }, listing).legCloses;
|
|
2387
2417
|
return {
|
|
2388
|
-
...
|
|
2418
|
+
...answers,
|
|
2419
|
+
...(listingCloses !== undefined ? { legCloses: { ...answers.legCloses, ...listingCloses } } : {}),
|
|
2389
2420
|
...calendar,
|
|
2390
2421
|
};
|
|
2391
2422
|
}
|
|
@@ -2517,7 +2548,11 @@ function wrunHostRunOf(metadata, sources, clock, cellsAfterTs) {
|
|
|
2517
2548
|
return legRowsOf(leg);
|
|
2518
2549
|
let rows = hostBarLegRows.get(leg.fetchKey);
|
|
2519
2550
|
if (rows === undefined) {
|
|
2520
|
-
rows = wrunLegRowsOnHostBars(legRowsOf(leg), hostBarGrid(), {
|
|
2551
|
+
rows = wrunLegRowsOnHostBars(legRowsOf(leg), hostBarGrid(), {
|
|
2552
|
+
legMs: sources.pinnedLegTierMs?.[leg.fetchKey] ?? leg.legMs,
|
|
2553
|
+
rowClass: wrunLegRowClassOf(leg),
|
|
2554
|
+
rowVenue: wrunLegRowVenue(leg.market, sources.venue?.barGrid),
|
|
2555
|
+
}, cellsAfterTs);
|
|
2521
2556
|
hostBarLegRows.set(leg.fetchKey, rows);
|
|
2522
2557
|
}
|
|
2523
2558
|
return rows;
|
|
@@ -2674,8 +2709,7 @@ function wrunHostRunOf(metadata, sources, clock, cellsAfterTs) {
|
|
|
2674
2709
|
: source.source === 'tape'
|
|
2675
2710
|
? sources.tapeRows
|
|
2676
2711
|
: sources.optionsChainRows;
|
|
2677
|
-
// The
|
|
2678
|
-
// tape keeps the plan's floor (the one its lane was asked at, from the run's settings).
|
|
2712
|
+
// The book lane is asked at the sheet's depth already, so its rows are read whole.
|
|
2679
2713
|
const adapted = ask.class === 'book' ? { ...ask, max_depth: undefined } : ask;
|
|
2680
2714
|
// Past the carry only (`cellsAfterTs`), except the options chain: the live row reads its newest poll, however old.
|
|
2681
2715
|
const rows = wrunPlainLaneRows(cellsAfterTs === undefined || source.source === 'options_chain'
|
|
@@ -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,7 @@
|
|
|
1
|
+
/** The one switch for the large CME tape's per-order history read and root defaults: a registry field replaces it here alone. */
|
|
2
|
+
import { wrunHostTapePerOrder } from '../../host-env.js';
|
|
3
|
+
import { tradesFloorPerOrder } from '../../kscript-data/controls/live-trades-merge.util.js';
|
|
4
|
+
/** Whether a tape on `exchange` is judged per aggressor order (above). */
|
|
5
|
+
export function wrunTapePerOrder(exchange) {
|
|
6
|
+
return tradesFloorPerOrder(exchange) && wrunHostTapePerOrder();
|
|
7
|
+
}
|