@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
|
@@ -193,7 +193,7 @@ import { wrunPollLaneByKey } from './sources/registry.js';
|
|
|
193
193
|
import { isWrunPollLaneId } from './sources/wrun-poll-lane.types.js';
|
|
194
194
|
import { wrunRowLaneByKey } from './sources/row-lane-registry.js';
|
|
195
195
|
import { isWrunRowLaneId } from './sources/wrun-row-lane.types.js';
|
|
196
|
-
import { fetchWrunRowLaneRows, wrunRowLaneChainAsk, wrunRowLaneChainGovernedExchange, wrunRowLaneFetchOptions, wrunRowLaneMovedInstance, } from './sources/wrun-row-lanes.util.js';
|
|
196
|
+
import { fetchWrunRowLaneRows, mergeWrunReplayRowLaneRows, wrunReplayRowLaneExtensions, wrunRowLaneAddKey, wrunRowLaneChainAsk, wrunRowLaneChainGovernedExchange, wrunRowLaneFetchOptions, wrunRowLaneMovedInstance, } from './sources/wrun-row-lanes.util.js';
|
|
197
197
|
import { wrunOpraLanePayloadAt } from './wrun-opra-lane.util.js';
|
|
198
198
|
import { drainWrunPollLaneLiveRows, setWrunPollLaneLiveDrainRequester, wrunPollLaneLiveOwed, wrunPollLaneLiveUp, } from './wrun-series-stream.util.js';
|
|
199
199
|
import { fetchWrunPollLaneHostGridRows, wrunPollLaneChainAsk, wrunPollLaneChainGovernedExchange, wrunPollLaneFetchOptions, wrunPollLaneMovedInstance, wrunPollLaneReconcileFrom, wrunPollLaneReconcileTo, } from './sources/wrun-poll-lanes.util.js';
|
|
@@ -213,15 +213,15 @@ import { isWrunBatchedChildRefused, mountWrunChildOverlays } from './wrun-panel-
|
|
|
213
213
|
import { getWrunBrowserHost, wrunLiveOf, WrunLiveOrderError, WrunLiveSessionLostError, } from './wrun-host.service.js';
|
|
214
214
|
import { getWrunOverlayLiveContext, isWrunOverlayRerunInFlight, onWrunOverlayLiveTeardown, rerunWrunOverlayForChartWave, setWrunChartRowsIdentityReader, setWrunLiveSheetReader, suspendWrunOverlayLiveSession, teardownWrunOverlay, withWrunOverlaySessionLock, wrunChartMarketIdentity, } from './wrun-overlay-drivers.util.js';
|
|
215
215
|
import { withWrunOverlayExecutionMeasure } from './wrun-overlay-lifecycle.util.js';
|
|
216
|
-
import { cutWrunReplayRowsAfterApply } from './wrun-replay-rows.util.js';
|
|
216
|
+
import { cutWrunReplayRows, cutWrunReplayRowsAfterApply } from './wrun-replay-rows.util.js';
|
|
217
217
|
import { healWrunOverlayIfIdle, requestWrunCasualtyRebuilds } from './wrun-overlay-recovery.util.js';
|
|
218
218
|
import { isWrunQuarantinedError, isWrunWorkerPoisonError, WrunIntegrationError, } from './wrun-registry-errors.util.js';
|
|
219
|
-
import { wrunLegBarCloseAt, wrunLegCandleClose, wrunLegCloseSettleMs, wrunLegCandleOpen, wrunPrimaryRowBounds, wrunPrimaryRowHoldingMs, wrunChartSession, } from './wrun-leg-close.util.js';
|
|
219
|
+
import { wrunLegBarCloseAt, wrunLegCandleClose, wrunLegCloseSettleMs, wrunLegCandleOpen, wrunLegRidesRth, wrunPrimaryRowBounds, wrunPrimaryRowHoldingMs, wrunChartSession, } from './wrun-leg-close.util.js';
|
|
220
220
|
import { wrunLiveReconcileMaySound } from './wrun-signal-sound-reasons.leaf.js';
|
|
221
221
|
import { wrunCanvasChildId, wrunCellRowsOf } from './wrun-canvases.util.js';
|
|
222
222
|
import { readWrunBatchedSections, wrunBatchedChildId, wrunSheetHasBatchedMarks } from './wrun-batched-marks.util.js';
|
|
223
223
|
import { isWrunStyleTargetHidden } from './wrun-color-settings.util.js';
|
|
224
|
-
import { buildWrunOverlayRunResult, closedLegCandles, forgetWrunOverlayCanvasState, openLegCandles, wrunLegReadsFormingOpen, wrunLegReadsLiveCandleOnly, cutWrunOddsLegRows, placeWrunResultTables, presentWrunIntegration, publishWrunRunHealth, publishWrunSessionCanvasNotices, recordWrunHostBuildMs, reseedWrunOverlayFromBuffers, wrunCanvasHostFillFor, wrunChartPriceDigits, wrunHostFillContextFor, wrunLegFetchType, wrunLegPayloadExtras, wrunIntegratedRowsView, wrunSessionCanvasFillOf, wrunSessionPinnedSheet, wrunSessionRespelledSheet, wrunResultMarketUnits, wrunSessionRunHealth, } from './wrun-overlay-run.util.js';
|
|
224
|
+
import { buildWrunOverlayRunResult, closedLegCandles, forgetWrunOverlayCanvasState, openLegCandles, wrunLegReadsFormingOpen, wrunLegReadsLiveCandleOnly, cutWrunOddsLegRows, placeWrunResultTables, presentWrunIntegration, publishWrunRunHealth, publishWrunSessionCanvasNotices, recordWrunHostBuildMs, reseedWrunOverlayFromBuffers, wrunCandleAskSource, wrunCanvasHostFillFor, wrunChartPriceDigits, wrunHostFillContextFor, wrunLegFetchType, wrunLegPayloadExtras, wrunIntegratedRowsView, wrunSessionCanvasFillOf, wrunSessionPinnedSheet, wrunSessionRespelledSheet, wrunResultMarketUnits, wrunSessionRunHealth, } from './wrun-overlay-run.util.js';
|
|
225
225
|
import { forgetWrunCanvasCache } from './wrun-canvas-cache.util.js';
|
|
226
226
|
import { wrunLegNativeRowsOption } from './wrun-pin-venues.util.js';
|
|
227
227
|
import { wrunSessionChartNamesOf } from './wrun-chart-context-names.util.js';
|
|
@@ -234,11 +234,11 @@ import { attachWrunRefusal, serializeWrunRefusal, wrunOverlayEditable, wrunRefus
|
|
|
234
234
|
import { noteWrunRunRetained, trimWrunRunDrawings } from './wrun-cap-notice.util.js';
|
|
235
235
|
import { evictWrunRetainedOutputRows, ringWrunRunRetained, trimWrunRetainedCanvasLanes, wrunRetainedCanvasSources, wrunStrategyOnRows, } from './wrun-run-retained.util.js';
|
|
236
236
|
import { projectWrunRefusal, retractWrunRefusal, wrunRefusalRetractionCount } from './wrun-refusal-surface.util.js';
|
|
237
|
-
import { advanceWrunInputCarry, buildWrunInputTailRows, planWrunPinnedWires, wrunDeclaredSourceLanes, wrunDemandedSourceClass, wrunFormingBucketStart, wrunAskWirePieces, wrunChartIntervalKeyOf, wrunPinnedLegTierMs, wrunSourceVerdictWhole, wrunLaneAcquisitionIntervalMs, wrunLegRowHostBar, wrunPinnedLegFetchSuffix, wrunTradeLegIntervals, wrunWireRowPieces, wrunChartCandleRows, wrunChartCandleRowsWithin, } from './wrun-source-rows.util.js';
|
|
237
|
+
import { advanceWrunInputCarry, buildWrunInputTailRows, planWrunPinnedWires, wrunDeclaredSourceLanes, wrunDemandedSourceClass, wrunFormingBucketStart, wrunAskWirePieces, wrunChartIntervalKeyOf, wrunPinnedLegTierMs, wrunSourceVerdictWhole, wrunLaneAcquisitionIntervalMs, wrunLegRowHostBar, wrunLegRowVenue, wrunPinnedLegFetchSuffix, wrunTradeLegIntervals, wrunWireRowPieces, wrunChartCandleRows, wrunChartCandleRowsWithin, } from './wrun-source-rows.util.js';
|
|
238
238
|
import { isWrunTradesLegLane, WRUN_TRADES_LANES, wrunTradesLegExtras } from './wrun-trades-lane.util.js';
|
|
239
239
|
import { drainWrunLiveIntake, dropWrunLiveQueuedBuckets, dropWrunLiveQueuedLegBuckets, enqueueWrunLiveFrame, markWrunLiveGap, noteWrunLiveIntakeEvent, setWrunLiveDrainRequester, takeWrunLiveGaps, wrunLaneAnswerCoversBucket, wrunLiveBucketTs, wrunLiveIntakeBacklogDue, wrunLiveIntakeStats, WRUN_LIVE_LANE_OF_SCRIPT_SOURCE, } from './wrun-live-intake.util.js';
|
|
240
240
|
import { stampWrunLiveFrameOpra } from './wrun-cloud-opra-stamp.util.js';
|
|
241
|
-
import { createWrunDownloadMeter } from './wrun-download-meter.util.js';
|
|
241
|
+
import { createWrunDownloadMeter, } from './wrun-download-meter.util.js';
|
|
242
242
|
/** Book frames are full snapshots and book runs are the heavy case: same 1s
|
|
243
243
|
* floor the kScript coalescer applies to orderbook-sourced scripts. */
|
|
244
244
|
const WRUN_BOOK_LIVE_UPDATE_MIN_MS = 1_000;
|
|
@@ -546,6 +546,14 @@ export function markWrunSourceFedLiveContext(context, session) {
|
|
|
546
546
|
diagnostics: session.diagnostics !== undefined ? wrunSourceVerdictKey(session.diagnostics) : undefined,
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
|
+
/** A Cloud session's receipt from here on (`WrunOverlayLiveContext.cloudOpraServed`): the receipt an answer with the
|
|
550
|
+
* OPRA mark named for its rows, or none when it named no tier. */
|
|
551
|
+
export function noteWrunCloudOpraServed(context, served) {
|
|
552
|
+
if (served === undefined)
|
|
553
|
+
delete context.cloudOpraServed;
|
|
554
|
+
else
|
|
555
|
+
context.cloudOpraServed = { ...served };
|
|
556
|
+
}
|
|
549
557
|
/** Whether a row source feeds `context` from elsewhere (its drain integrates the source's frames only). */
|
|
550
558
|
export function isWrunSourceFedLiveContext(context) {
|
|
551
559
|
return context !== undefined && wrunSourceFedContexts.has(context);
|
|
@@ -588,12 +596,49 @@ export function queueWrunSourceLiveFrame(context, frame, cellRowsOf) {
|
|
|
588
596
|
if (getWrunOverlayLiveContext(context.indicatorId) !== context || context.replay)
|
|
589
597
|
return;
|
|
590
598
|
const queued = queuedSourceFrames.get(context);
|
|
599
|
+
// A move of the served tier never folds into the rows of the tier before it: the source drops its session on one
|
|
600
|
+
// (`servedTierMoved`), and a frame naming another tier than the rows the session holds reseeds it the same way.
|
|
601
|
+
if (frame.servedTierMoved === true || wrunFrameMovesServedTier(context, queued?.frame, frame)) {
|
|
602
|
+
reseedWrunSourceSessionAtServedTier(context);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
591
605
|
// The verdict is weighed against the one the drain reaches next: the queued frames', else the session's.
|
|
592
606
|
if (!wrunRowFrameDraws(frame) && !wrunSourceVerdictMoves(context, frame, queued?.frame))
|
|
593
607
|
return;
|
|
594
608
|
queuedSourceFrames.set(context, { frame: queued ? coalesceWrunRowFrames(queued.frame, frame) : frame, cellRowsOf });
|
|
595
609
|
armWrunLiveDrain(context, false);
|
|
596
610
|
}
|
|
611
|
+
/**
|
|
612
|
+
* The cloud served the session's OPRA rows at another tier than the rows the overlay shows (its source's transition,
|
|
613
|
+
* `WrunRowFrame.servedTierMoved`: the source dropped every row it held). Nothing drawn at the old tier stays: the
|
|
614
|
+
* frames queued for the session go, the overlay's rows come off the chart (the parent, its nested plots and its child
|
|
615
|
+
* panes), its live session ends with the source it held (the driver stays: `suspendWrunOverlayLiveSession`, the
|
|
616
|
+
* primitive the browser lane's downgrade discard ends a session with), and a rebuild creates a fresh session at the
|
|
617
|
+
* tier the cloud serves now, whose result names its receipt to the legend. A downgraded viewer never keeps real-time
|
|
618
|
+
* rows under a delayed word, and an upgraded one never keeps delayed rows under none.
|
|
619
|
+
*/
|
|
620
|
+
/** Whether a frame names another served tier than the rows its session holds: the newest receipt queued for it, else
|
|
621
|
+
* the session's own (`cloudOpraServed`). A frame or a session that names no tier moves nothing. */
|
|
622
|
+
function wrunFrameMovesServedTier(context, queued, frame) {
|
|
623
|
+
const tier = frame.opra === true ? frame.opraServed?.tier : undefined;
|
|
624
|
+
if (tier === undefined)
|
|
625
|
+
return false;
|
|
626
|
+
const held = (queued?.opra === true ? queued.opraServed?.tier : undefined) ?? context.cloudOpraServed?.tier;
|
|
627
|
+
return held !== undefined && held !== tier;
|
|
628
|
+
}
|
|
629
|
+
function reseedWrunSourceSessionAtServedTier(context) {
|
|
630
|
+
const { chartIndex, indicatorId } = context;
|
|
631
|
+
queuedSourceFrames.delete(context);
|
|
632
|
+
try {
|
|
633
|
+
cutWrunReplayRows(wrunChartHostEnv().chart.instance(chartIndex), indicatorId, Number.NEGATIVE_INFINITY);
|
|
634
|
+
}
|
|
635
|
+
catch (error) {
|
|
636
|
+
console.warn(`[wrun] the served-tier reseed could not take '${indicatorId}' off the chart:`, error);
|
|
637
|
+
}
|
|
638
|
+
suspendWrunOverlayLiveSession(indicatorId);
|
|
639
|
+
noteWrunLiveIntakeEvent(indicatorId, { kind: 'rebuild' });
|
|
640
|
+
void rerunWrunOverlayForChartWave(indicatorId, { reason: 'live-rebuild' })?.catch(() => undefined);
|
|
641
|
+
}
|
|
597
642
|
/**
|
|
598
643
|
* The frames queued for `replaced`, a session the pass replaced with `context` over the same row source, go to
|
|
599
644
|
* `context` when both stand for the same calculation (`WrunSourceFedSession.generation`: a page of the held source):
|
|
@@ -680,8 +725,16 @@ function coalesceWrunRowFrames(held, next) {
|
|
|
680
725
|
: {}),
|
|
681
726
|
// The cloud's OPRA mark survives the fold: either frame's stamps the overlay before the tail lands.
|
|
682
727
|
...(next.opra === true || held.opra === true ? { opra: true } : {}),
|
|
728
|
+
// The receipt of the newest frame that carried the mark (its rows are the newest): its tier, or none.
|
|
729
|
+
...coalescedOpraServed(held, next),
|
|
683
730
|
};
|
|
684
731
|
}
|
|
732
|
+
/** The receipt a fold of two frames carries: the newer frame's when it carried the OPRA mark (none when it named no
|
|
733
|
+
* tier), else the held frame's (a frame without the mark says nothing of OPRA). */
|
|
734
|
+
function coalescedOpraServed(held, next) {
|
|
735
|
+
const served = next.opra === true ? next.opraServed : held.opraServed;
|
|
736
|
+
return served !== undefined ? { opraServed: served } : {};
|
|
737
|
+
}
|
|
685
738
|
/** A frame's handle records with their bar stamps moved by `offset` rows. */
|
|
686
739
|
function rebaseWrunFrameHandles(handles, offset) {
|
|
687
740
|
return handles.map((record) => ({
|
|
@@ -752,6 +805,10 @@ export function scheduleWrunOverlayLiveTick(chartIndex, indicatorId, matchedSour
|
|
|
752
805
|
export function requestWrunOverlayLiveDrain(indicatorId) {
|
|
753
806
|
registerWrunLiveTickSeams();
|
|
754
807
|
registerWrunLiveTickHostSeams();
|
|
808
|
+
// The settings oracle's freeze (holdWrunLiveTicks): the request, its heal and rebuild branches too, is dropped; the
|
|
809
|
+
// gap marks it woke for stay for the next drain.
|
|
810
|
+
if (wrunLiveHeld)
|
|
811
|
+
return;
|
|
755
812
|
const context = getWrunOverlayLiveContext(indicatorId);
|
|
756
813
|
if (!context)
|
|
757
814
|
return;
|
|
@@ -981,6 +1038,9 @@ function nextWrunTickDelayMs(state) {
|
|
|
981
1038
|
/** The overlay's cadence floor now (live-cadence.util decides): the adaptive/at-rest/hidden tiering
|
|
982
1039
|
* over the interval-scaled floor. Non-finite: the hidden hold. */
|
|
983
1040
|
function wrunLiveCadenceFloorMs(state, now) {
|
|
1041
|
+
// The settings oracle's freeze (holdWrunLiveTicks) holds every drain as on a hidden page, the Sounds tab's too.
|
|
1042
|
+
if (wrunLiveHeld)
|
|
1043
|
+
return Number.POSITIVE_INFINITY;
|
|
984
1044
|
const lastPanAt = wrunChartHostEnv().chart.lastPanAt(state.chartIndex);
|
|
985
1045
|
const hidden = wrunChartHostEnv().clock.pageHidden();
|
|
986
1046
|
return resolveV2LiveEffectiveMinIntervalMs({
|
|
@@ -1155,6 +1215,22 @@ function snapWrunLiveTicksOnReturn() {
|
|
|
1155
1215
|
wrunChartHostEnv().diagnostics.debug('wrun-live-hidden-drain', { overlays: held, runs });
|
|
1156
1216
|
}
|
|
1157
1217
|
}
|
|
1218
|
+
// The settings oracle's freeze (window.__kiyoSettingsOracle.holdLive, through qa/settings-oracle-live-hold): while it
|
|
1219
|
+
// is on every drain holds as on a hidden page and a bare drain request is dropped, its gap marks kept. Nothing held is
|
|
1220
|
+
// replayed: the release resumes the normal cadence, the return snap on a visible page and, on a hidden one, each held
|
|
1221
|
+
// overlay re-armed on its own cadence (where the page's hidden pace holds, it holds again under that hold).
|
|
1222
|
+
let wrunLiveHeld = false;
|
|
1223
|
+
export function holdWrunLiveTicks(on) {
|
|
1224
|
+
if (on === wrunLiveHeld)
|
|
1225
|
+
return;
|
|
1226
|
+
wrunLiveHeld = on;
|
|
1227
|
+
if (on)
|
|
1228
|
+
return;
|
|
1229
|
+
if (wrunChartHostEnv().clock.pageHidden())
|
|
1230
|
+
releaseWrunLiveHiddenHolds();
|
|
1231
|
+
else
|
|
1232
|
+
snapWrunLiveTicksOnReturn();
|
|
1233
|
+
}
|
|
1158
1234
|
// The switch turned off (`__kiyoSetLiveHiddenPace(false)`): every held drain
|
|
1159
1235
|
// goes back to today's cadence at once (the 2 s floor while still hidden).
|
|
1160
1236
|
function releaseWrunLiveHiddenHolds() {
|
|
@@ -1222,12 +1298,19 @@ function dropWrunPinnedCloseTimer(indicatorId) {
|
|
|
1222
1298
|
* the legs), null without legs: `floor(now / L) * L + L` for a fixed span,
|
|
1223
1299
|
* and for a WEEK leg the Monday-anchored week (`findMonday`, the main
|
|
1224
1300
|
* path's and the intake's week bucket), never the epoch week (a Thursday);
|
|
1225
|
-
* a leg on the
|
|
1226
|
-
*
|
|
1227
|
-
*
|
|
1228
|
-
*
|
|
1229
|
-
*
|
|
1301
|
+
* a leg on the chart's RTH grid closes where its RTH bar holding now does
|
|
1302
|
+
* (`wrunLegBarCloseAt`: a 4h bar anchored at the 09:30 New York open, the
|
|
1303
|
+
* session's stub at the 16:15 close, off the session the next session's
|
|
1304
|
+
* first bar), a leg on the CME session lattice where its venue's bar
|
|
1305
|
+
* holding now does (a 3d group at the next group's open), a leg on a US
|
|
1306
|
+
* listing with the session (the daily at 16:00 New York), read once its
|
|
1307
|
+
* venue's rows hold the whole candle (`wrunLegCloseSettleMs`: a stock's
|
|
1308
|
+
* minutes after its close). */
|
|
1230
1309
|
export function wrunNextPinnedCloseTs(context, nowMs) {
|
|
1310
|
+
return wrunNextPinnedClose(context, nowMs)?.closeAtMs ?? null;
|
|
1311
|
+
}
|
|
1312
|
+
/** The pinned leg that closes first and its close (`wrunNextPinnedCloseTs`), null without legs. */
|
|
1313
|
+
function wrunNextPinnedClose(context, nowMs) {
|
|
1231
1314
|
let next = null;
|
|
1232
1315
|
for (const leg of context.pinnedLegs ?? []) {
|
|
1233
1316
|
// A grid leg closes with every chart bar (the roll and the lane
|
|
@@ -1235,23 +1318,43 @@ export function wrunNextPinnedCloseTs(context, nowMs) {
|
|
|
1235
1318
|
// close) arm the timer.
|
|
1236
1319
|
if (!(leg.legMs > 0) || leg.kind === 'grid')
|
|
1237
1320
|
continue;
|
|
1238
|
-
const
|
|
1239
|
-
if (next === null ||
|
|
1240
|
-
next =
|
|
1321
|
+
const closeAtMs = wrunPinnedLegCloseAt(leg, context, nowMs);
|
|
1322
|
+
if (next === null || closeAtMs < next.closeAtMs)
|
|
1323
|
+
next = { leg, closeAtMs };
|
|
1241
1324
|
}
|
|
1242
1325
|
return next;
|
|
1243
1326
|
}
|
|
1327
|
+
/** The `wrun-leg-close-planned` debug ring event (contract C4): the leg close a new `pinned-close` timer is
|
|
1328
|
+
* armed at, and whether the chart's RTH rule answered it (`anchored`: the leg rides the chart's RTH grid,
|
|
1329
|
+
* `wrunLegRidesRth`) rather than the CME lattice, a stock's session or the plain grid. */
|
|
1330
|
+
function noteWrunLegClosePlanned(context, planned) {
|
|
1331
|
+
const { diagnostics } = wrunChartHostEnv();
|
|
1332
|
+
if (!diagnostics.debugEnabled())
|
|
1333
|
+
return;
|
|
1334
|
+
const market = context.market;
|
|
1335
|
+
diagnostics.debug('wrun-leg-close-planned', {
|
|
1336
|
+
chartIndex: context.chartIndex,
|
|
1337
|
+
indicatorId: context.indicatorId,
|
|
1338
|
+
legMs: planned.leg.legMs,
|
|
1339
|
+
closeAtMs: planned.closeAtMs,
|
|
1340
|
+
anchored: wrunLegRidesRth(planned.leg, market?.exchange, market?.sessionType, market?.symbol, context.intervalMs),
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1244
1343
|
/** When the leg candle holding `atMs` reads settled: its close (`floor(at / L) * L + L` for a
|
|
1245
|
-
* fixed span, the Monday-anchored week for a WEEK leg, the
|
|
1246
|
-
* or a US listing's session close: `wrunLegBarCloseAt`, on
|
|
1247
|
-
* the
|
|
1248
|
-
*
|
|
1249
|
-
* the
|
|
1250
|
-
|
|
1344
|
+
* fixed span, the Monday-anchored week for a WEEK leg, the RTH bar on the chart's RTH grid, the
|
|
1345
|
+
* venue's bar on the CME session lattice or a US listing's session close: `wrunLegBarCloseAt`, on
|
|
1346
|
+
* the bars the session the chart rides keys: its session word, symbol and interval) plus the time
|
|
1347
|
+
* its venue's rows take to hold the whole candle (`wrunLegCloseSettleMs`: 0 but for a stock, read
|
|
1348
|
+
* on the chart's word as the listing's fetch reads it), so a candle still settling at `atMs`
|
|
1349
|
+
* answers its own moment. The pinned-close timer and the routine poll's coverage check read the
|
|
1350
|
+
* same moment; the cuts keep the close itself. */
|
|
1351
|
+
function wrunPinnedLegCloseAt(leg, context, atMs) {
|
|
1352
|
+
const { market } = context;
|
|
1251
1353
|
const settleMs = wrunLegCloseSettleMs(leg, market?.exchange, market?.sessionType);
|
|
1252
1354
|
const fromMs = atMs - settleMs;
|
|
1253
1355
|
const open = leg.legMs === Intervals.WEEK ? findMonday(fromMs) : Math.floor(fromMs / leg.legMs) * leg.legMs;
|
|
1254
|
-
|
|
1356
|
+
const closeMs = wrunLegBarCloseAt(leg, market?.exchange, fromMs, market?.sessionType, market?.symbol, context.intervalMs);
|
|
1357
|
+
return (closeMs ?? open + leg.legMs) + settleMs;
|
|
1255
1358
|
}
|
|
1256
1359
|
/**
|
|
1257
1360
|
* Whether a routine poll can leave a period leg alone (TEMPLATE-QA E40): its coverage already
|
|
@@ -1268,7 +1371,7 @@ function wrunPeriodLegSettled(context, leg, nowMs) {
|
|
|
1268
1371
|
if (!Number.isFinite(leg.coveredThroughTs))
|
|
1269
1372
|
return false;
|
|
1270
1373
|
const settledFrom = leg.coveredThroughTs - WRUN_LIVE_PINNED_CLOSE_GRACE_MS;
|
|
1271
|
-
return wrunPinnedLegCloseAt(leg, context
|
|
1374
|
+
return wrunPinnedLegCloseAt(leg, context, settledFrom) + WRUN_LIVE_PINNED_CLOSE_GRACE_MS > nowMs;
|
|
1272
1375
|
}
|
|
1273
1376
|
/**
|
|
1274
1377
|
* Arm (or keep) the overlay's `pinned-close` timer at the earliest leg's
|
|
@@ -1286,12 +1389,12 @@ function armWrunPinnedCloseTimer(context) {
|
|
|
1286
1389
|
const { indicatorId } = context;
|
|
1287
1390
|
// The legs close on the server's grid: the next close and the delay to it read the server clock.
|
|
1288
1391
|
const nowMs = serverNowMs();
|
|
1289
|
-
const
|
|
1290
|
-
if (
|
|
1392
|
+
const planned = wrunNextPinnedClose(context, nowMs);
|
|
1393
|
+
if (planned === null) {
|
|
1291
1394
|
dropWrunPinnedCloseTimer(indicatorId);
|
|
1292
1395
|
return;
|
|
1293
1396
|
}
|
|
1294
|
-
const dueAt =
|
|
1397
|
+
const dueAt = planned.closeAtMs + WRUN_LIVE_PINNED_CLOSE_GRACE_MS;
|
|
1295
1398
|
const armed = pinnedCloseTimers.get(indicatorId);
|
|
1296
1399
|
if (armed !== undefined) {
|
|
1297
1400
|
if (armed.dueAt <= dueAt)
|
|
@@ -1307,6 +1410,7 @@ function armWrunPinnedCloseTimer(context) {
|
|
|
1307
1410
|
markWrunLiveGap(indicatorId, 'pinned-close');
|
|
1308
1411
|
}, Math.max(0, dueAt - nowMs));
|
|
1309
1412
|
pinnedCloseTimers.set(indicatorId, { timer, dueAt });
|
|
1413
|
+
noteWrunLegClosePlanned(context, planned);
|
|
1310
1414
|
}
|
|
1311
1415
|
// ---------------------------------------------------------------------------
|
|
1312
1416
|
// The drain body.
|
|
@@ -1581,6 +1685,11 @@ export async function advanceWrunReplaySession(indicatorId, ohlcvRows) {
|
|
|
1581
1685
|
if (wrunSourceFedContexts.has(context))
|
|
1582
1686
|
return 'skipped';
|
|
1583
1687
|
const newestTs = Number(ohlcvRows[ohlcvRows.length - 1][0]);
|
|
1688
|
+
// The session's flow and snapshot row lanes reach the step's cursor first (SKYLIT-PARITY L6a): the tail, and a
|
|
1689
|
+
// bar-count reseed, read the bars the step reveals off their buffers. One the session cannot extend reopens it.
|
|
1690
|
+
const owed = wrunReplayRowLaneExtensions(context.rowLanes, context.coveredThroughTs, newestTs);
|
|
1691
|
+
if (owed.length > 0 && !(await extendWrunReplayRowLanes(context, owed, newestTs)))
|
|
1692
|
+
return 'skipped';
|
|
1584
1693
|
if (wrunLiveContextReadsBarCount(context) && newestTs > context.lastRowTs)
|
|
1585
1694
|
return 'reseed';
|
|
1586
1695
|
const ledger = ledgerFor(indicatorId);
|
|
@@ -1613,6 +1722,51 @@ export async function advanceWrunReplaySession(indicatorId, ohlcvRows) {
|
|
|
1613
1722
|
ledger.inFlight = false;
|
|
1614
1723
|
}
|
|
1615
1724
|
}
|
|
1725
|
+
/**
|
|
1726
|
+
* A replay session's flow and snapshot row lanes extended to a step's cursor (SKYLIT-PARITY L6a): the replay run read
|
|
1727
|
+
* each through its cursor (wrun-row-lanes.util `replayCursorMs`), so the bars a step reveals are asked now, at the
|
|
1728
|
+
* step's cursor, from the bar after each lane's coverage (`wrunReplayRowLaneExtensions`; the lane's replay memo answers
|
|
1729
|
+
* the bars it already landed), merged into the lane's buffer (`mergeWrunReplayRowLaneRows`), and its coverage moves to
|
|
1730
|
+
* the cursor. The step then computes them as it computes every other lane's: the replay record's coverage stays its
|
|
1731
|
+
* window's end, so no step reopens the session for its row lanes. False when an ask failed or was not confirmed whole
|
|
1732
|
+
* (no memo keeps its bars, so the reopened run asks them again), when another drain holds the session, or when the
|
|
1733
|
+
* session moved meanwhile: the step reopens the session then.
|
|
1734
|
+
*/
|
|
1735
|
+
async function extendWrunReplayRowLanes(context, owed, cursorTs) {
|
|
1736
|
+
const ledger = ledgerFor(context.indicatorId);
|
|
1737
|
+
if (ledger.inFlight)
|
|
1738
|
+
return false;
|
|
1739
|
+
const tc = wrunChartHostEnv().chart.instance(context.chartIndex);
|
|
1740
|
+
const meta = tc?.metadata?.find((candidate) => candidate.id === context.indicatorId);
|
|
1741
|
+
if (meta === undefined)
|
|
1742
|
+
return false;
|
|
1743
|
+
const generation = context.generation;
|
|
1744
|
+
ledger.inFlight = true;
|
|
1745
|
+
try {
|
|
1746
|
+
for (const { key, fromTs } of owed) {
|
|
1747
|
+
const heard = { confirmed: true };
|
|
1748
|
+
const rows = await fetchWrunRowLaneReconcile(context, ledger, key, fromTs, cursorTs + 1, meta, {
|
|
1749
|
+
cursorMs: cursorTs,
|
|
1750
|
+
onUnconfirmed: () => {
|
|
1751
|
+
heard.confirmed = false;
|
|
1752
|
+
},
|
|
1753
|
+
});
|
|
1754
|
+
if (!wrunLiveContextCurrent(context, generation) || !heard.confirmed)
|
|
1755
|
+
return false;
|
|
1756
|
+
const merged = mergeWrunReplayRowLaneRows(context.rowLaneRows?.[key], rows);
|
|
1757
|
+
setLaneRows(context, key, merged);
|
|
1758
|
+
context.coveredThroughTs[key] = cursorTs;
|
|
1759
|
+
}
|
|
1760
|
+
return true;
|
|
1761
|
+
}
|
|
1762
|
+
catch (error) {
|
|
1763
|
+
console.warn(`[wrun] replay row lane extension failed for '${context.indicatorId}':`, error);
|
|
1764
|
+
return false;
|
|
1765
|
+
}
|
|
1766
|
+
finally {
|
|
1767
|
+
ledger.inFlight = false;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1616
1770
|
/**
|
|
1617
1771
|
* A socket row source's live frames (WRUN-PARITY-PLAN C7, plan row 18), the drain's integrate of every
|
|
1618
1772
|
* frame folded since the last one (`queueWrunSourceLiveFrame`): the bars the cloud moved enter the live
|
|
@@ -1671,6 +1825,13 @@ export async function integrateWrunOverlayLiveFrame(indicatorId, frame, cellRows
|
|
|
1671
1825
|
return;
|
|
1672
1826
|
if (!wrunLiveTickEligible(context, generation))
|
|
1673
1827
|
return;
|
|
1828
|
+
// A frame with the mark names the receipt of the rows it carries (contract opra-server-lanes C4): the legend's
|
|
1829
|
+
// served word follows it from this tick on, and a frame naming no tier leaves none (never the account's tier).
|
|
1830
|
+
// The session reads OPRA from here: its debug lines state it (the console provenance).
|
|
1831
|
+
if (frame.opra === true) {
|
|
1832
|
+
noteWrunCloudOpraServed(context, frame.opraServed);
|
|
1833
|
+
context.opraRead = true;
|
|
1834
|
+
}
|
|
1674
1835
|
// The verdict first: a refusal set that moved cuts the sheet again, so the integrate below builds without
|
|
1675
1836
|
// a family the source now leaves out (and with one it serves again).
|
|
1676
1837
|
const recut = await landWrunSourceFrameVerdict(context, meta, frame);
|
|
@@ -2314,8 +2475,9 @@ async function integrateWrunLiveTail(tail) {
|
|
|
2314
2475
|
// ran with, so a tick never flips a `{{label}}` back to the declared ones.
|
|
2315
2476
|
texts: wrunTextParamValuesFromSettings(context.metadata, meta.settings),
|
|
2316
2477
|
// And the legend note (wrun-draft-legend-note.util: the draft's word, an OPRA chain's served
|
|
2317
|
-
// tier off the session's chain acquisition), so a tick
|
|
2318
|
-
|
|
2478
|
+
// tier off the session's chain acquisition, a Cloud session's off its newest frame's receipt), so a tick
|
|
2479
|
+
// never drops it.
|
|
2480
|
+
legendNote: wrunOverlayLegendNote(meta.settings, context.acquisition.options_chain, context.acquisition, context.cloudOpraServed),
|
|
2319
2481
|
position: context.position,
|
|
2320
2482
|
axis: context.axis,
|
|
2321
2483
|
colors: context.colors,
|
|
@@ -2419,7 +2581,12 @@ async function integrateWrunLiveTail(tail) {
|
|
|
2419
2581
|
// The presentation every integrate owes (the full run's twin): the
|
|
2420
2582
|
// nested visibility a full adapter re-apply or a child remount reset,
|
|
2421
2583
|
// and the latest-values snapshot the HUD follows per tick.
|
|
2422
|
-
presentWrunIntegration(context.chartIndex, indicatorId, context.metadata, meta.settings, outputRows, tc, context.sessionSeed?.initArgs, wrunSessionChartNamesOf(context), runSession?.run
|
|
2584
|
+
presentWrunIntegration(context.chartIndex, indicatorId, context.metadata, meta.settings, outputRows, tc, context.sessionSeed?.initArgs, wrunSessionChartNamesOf(context), runSession?.run,
|
|
2585
|
+
// A tick carries the session's rows on: a full run refused since keeps its snapshot, so the
|
|
2586
|
+
// numbers it superseded never come back under its chip.
|
|
2587
|
+
'republish',
|
|
2588
|
+
// The build the chart now shows (applied, or found unchanged against it); a clamped session's covers its window.
|
|
2589
|
+
{ emptyTargets: runResult.emptyTargets, partial: context.window?.partial === true });
|
|
2423
2590
|
context.paintedThroughTs = newestTs;
|
|
2424
2591
|
context.repaintOwed = false;
|
|
2425
2592
|
// The retained range an eviction moved, on the "Cells capped" row (design 5).
|
|
@@ -2832,7 +2999,10 @@ function laneSourcesOf(context, ohlcvRows) {
|
|
|
2832
2999
|
// The session the run was computed under, as the full run and the reseed hand the builder: its
|
|
2833
3000
|
// session calendar answers at the tail clock's interval (the legs' candle closes and opens, the
|
|
2834
3001
|
// session rows' bounds).
|
|
2835
|
-
session: wrunChartSession(context.market?.exchange, context.market?.sessionType
|
|
3002
|
+
session: wrunChartSession(context.market?.exchange, context.market?.sessionType, {
|
|
3003
|
+
symbol: context.market?.symbol,
|
|
3004
|
+
interval: intervalMs,
|
|
3005
|
+
}),
|
|
2836
3006
|
// The market the session runs on, at the tail clock's interval: a new live bar reads its own
|
|
2837
3007
|
// `time.trade_date` / `time.session`, and a grid leg lands on its bar grid (`barGrid`).
|
|
2838
3008
|
venue: wrunBarVenueOf(context.market, intervalMs),
|
|
@@ -3009,7 +3179,12 @@ lastMainTs) {
|
|
|
3009
3179
|
? barEndMs(lastMainTs, leg.legMs) - 1
|
|
3010
3180
|
: lastMainTs;
|
|
3011
3181
|
const fetched = (leg.odds ? cutWrunOddsLegRows(outcome.value, oddsCutTs) : outcome.value);
|
|
3012
|
-
const legCloseMs = leg.kind === 'grid'
|
|
3182
|
+
const legCloseMs = leg.kind === 'grid'
|
|
3183
|
+
? undefined
|
|
3184
|
+
: wrunLegCandleClose(leg, context.market?.exchange, context.market?.sessionType, {
|
|
3185
|
+
symbol: context.market?.symbol,
|
|
3186
|
+
interval: context.intervalMs,
|
|
3187
|
+
});
|
|
3013
3188
|
// A leg a `candles` input reads with view "forming_open": the opens it showed before this
|
|
3014
3189
|
// answer, so a candle it shows anew can revise the committed rows the candle holds.
|
|
3015
3190
|
const shownBefore = formingOpenLegs.has(leg.fetchKey) ? wrunLegShownOpens(context, leg.fetchKey) : undefined;
|
|
@@ -3110,7 +3285,10 @@ function wrunFormingOpenRevisedFromTs(context, leg, before) {
|
|
|
3110
3285
|
if (intervalMs === 0)
|
|
3111
3286
|
return null;
|
|
3112
3287
|
const exchange = context.market?.exchange;
|
|
3113
|
-
const closeMs = wrunLegCandleClose(leg, exchange, context.market?.sessionType
|
|
3288
|
+
const closeMs = wrunLegCandleClose(leg, exchange, context.market?.sessionType, {
|
|
3289
|
+
symbol: context.market?.symbol,
|
|
3290
|
+
interval: context.intervalMs,
|
|
3291
|
+
});
|
|
3114
3292
|
const openMs = wrunLegCandleOpen(leg, exchange);
|
|
3115
3293
|
const after = wrunLegShownOpens(context, leg.fetchKey);
|
|
3116
3294
|
let earliest = Number.POSITIVE_INFINITY;
|
|
@@ -3131,7 +3309,7 @@ function wrunFormingOpenRevisedFromTs(context, leg, before) {
|
|
|
3131
3309
|
changed(stamp);
|
|
3132
3310
|
if (!Number.isFinite(earliest))
|
|
3133
3311
|
return null;
|
|
3134
|
-
const row = Math.max(context.firstRowTs, Math.min(wrunFormingBucketStart(earliest, intervalMs), wrunPrimaryRowHoldingMs(exchange, intervalMs, earliest) ?? Number.POSITIVE_INFINITY));
|
|
3312
|
+
const row = Math.max(context.firstRowTs, Math.min(wrunFormingBucketStart(earliest, intervalMs), wrunPrimaryRowHoldingMs(exchange, intervalMs, earliest, context.market) ?? Number.POSITIVE_INFINITY));
|
|
3135
3313
|
return row < context.lastRowTs ? row : null;
|
|
3136
3314
|
}
|
|
3137
3315
|
/** The fetch keys of the period legs every reading of which is a `candles` input's live candle
|
|
@@ -3244,7 +3422,7 @@ async function askWrunReconcileSourceAnswer(context, ledger, ask, meta) {
|
|
|
3244
3422
|
...(ask.interval === undefined ? wrunReconcileRunIntervalOption(context) : { interval: ask.interval }),
|
|
3245
3423
|
...(ask.nativeRows === true ? { nativeRows: true } : {}),
|
|
3246
3424
|
...(ask.endExclusive === true ? { endExclusive: true } : {}),
|
|
3247
|
-
meter: wrunLiveDownloadMeter(context),
|
|
3425
|
+
meter: ask.meter ?? wrunLiveDownloadMeter(context),
|
|
3248
3426
|
}), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun live reconcile fetch '${ask.type}' (${ask.key}) for '${context.fetchKey}'`);
|
|
3249
3427
|
return Array.isArray(fetched) ? fetched : null;
|
|
3250
3428
|
}
|
|
@@ -3341,14 +3519,15 @@ async function fetchWrunPollLaneReconcile(context, ledger, laneId, fromTs, toTs,
|
|
|
3341
3519
|
return askOnce(extras, askFromTs, askToTs);
|
|
3342
3520
|
}
|
|
3343
3521
|
/** A reconcile window's host bars, `[fromTs, toTs)`, on the session's bar grid (the chart's market: a
|
|
3344
|
-
* regular-session stock chart's 09:30-anchored bars, the UTC floor elsewhere)
|
|
3522
|
+
* regular-session stock chart's 09:30-anchored bars, the UTC floor elsewhere), at the server's now: the tier rule and
|
|
3523
|
+
* the add memo's final lag compare it with the gateway's bars (a device clock ahead would read a bar final early). */
|
|
3345
3524
|
function wrunReconcileHostGridWindow(context, fromTs, toTs) {
|
|
3346
3525
|
const barGrid = liveBucketVenueOf(context.market);
|
|
3347
3526
|
return {
|
|
3348
3527
|
barOpens: liveBucketStartsInRange(fromTs, toTs - 1, context.intervalMs, barGrid),
|
|
3349
3528
|
intervalMs: context.intervalMs,
|
|
3350
3529
|
barGrid,
|
|
3351
|
-
nowMs:
|
|
3530
|
+
nowMs: serverNowMs(),
|
|
3352
3531
|
};
|
|
3353
3532
|
}
|
|
3354
3533
|
/** A row lane instance's reconcile (`utility/wrun/sources/row-lane-registry.ts`): its lane's asks over the
|
|
@@ -3357,8 +3536,11 @@ function wrunReconcileHostGridWindow(context, fromTs, toTs) {
|
|
|
3357
3536
|
* or snapshot lane's under the tier rule on the window's host bars and landed on them, a latest lane's once; through
|
|
3358
3537
|
* its own fetch when it has one, deadline-raced like the chart's. The window opens where the lane's reconcile does
|
|
3359
3538
|
* (`wrunReconcileLaneWindowFrom`: a governed lane's reaches past its plane's embargo). An instance the context does
|
|
3360
|
-
* not hold, or whose lane left the registry, answers empty (which keeps every cached row).
|
|
3361
|
-
|
|
3539
|
+
* not hold, or whose lane left the registry, answers empty (which keeps every cached row). Each ask hands the chart
|
|
3540
|
+
* fetch's verdict, heard on the download charge it makes at its answer, to the read's memo (wrun-row-lanes.util
|
|
3541
|
+
* `ask`). A replay step's read (`replay`, SKYLIT-PARITY L6a) names the replay's cursor (the read keeps its replay
|
|
3542
|
+
* memo, never the add's) and hears the bars no ask confirmed. */
|
|
3543
|
+
async function fetchWrunRowLaneReconcile(context, ledger, laneId, fromTs, toTs, meta, replay) {
|
|
3362
3544
|
const instance = context.rowLanes?.find((candidate) => candidate.key === laneId);
|
|
3363
3545
|
const lane = instance === undefined ? undefined : wrunRowLaneByKey(instance.laneKey);
|
|
3364
3546
|
if (instance === undefined || lane === undefined)
|
|
@@ -3370,19 +3552,40 @@ async function fetchWrunRowLaneReconcile(context, ledger, laneId, fromTs, toTs,
|
|
|
3370
3552
|
: wrunRowLaneChainAsk(lane, recorded, governedMarketDataTier);
|
|
3371
3553
|
const laneFetch = lane.fetch;
|
|
3372
3554
|
const laneFromTs = wrunReconcileLaneWindowFrom(context, laneId, fromTs, toTs);
|
|
3373
|
-
const
|
|
3555
|
+
const window = wrunReconcileHostGridWindow(context, laneFromTs, toTs);
|
|
3556
|
+
const rows = await fetchWrunRowLaneRows(lane, extras, replay === undefined ? window : { ...window, replayCursorMs: replay.cursorMs }, { fromTs: laneFromTs, toTs }, async (askExtras, from, to, whole) => {
|
|
3374
3557
|
if (laneFetch !== undefined) {
|
|
3375
3558
|
ledger.stats.fetches += 1;
|
|
3376
|
-
|
|
3559
|
+
const own = await withWrunDeadline(laneFetch({ extras: askExtras, fromTs: from, toTs: to, intervalMs: context.intervalMs }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun live reconcile fetch '${lane.kType}' (${instance.key}) for '${context.fetchKey}'`);
|
|
3560
|
+
// A lane's own fetch rides no chart transport (no synthetic completion): its answer is whole once it resolved.
|
|
3561
|
+
whole?.(true);
|
|
3562
|
+
return own;
|
|
3377
3563
|
}
|
|
3378
|
-
|
|
3564
|
+
let heard;
|
|
3565
|
+
const sessionMeter = wrunLiveDownloadMeter(context);
|
|
3566
|
+
const answer = (await askWrunReconcileSource(context, ledger, {
|
|
3379
3567
|
type: lane.kType,
|
|
3380
3568
|
key: instance.key,
|
|
3381
3569
|
payload: { symbol: 'currentSymbol', exchange: 'currentExchange', ...askExtras },
|
|
3382
3570
|
fromTs: from,
|
|
3383
3571
|
toTs: to,
|
|
3384
3572
|
...(wrunRowLaneFetchOptions(lane) ?? {}),
|
|
3573
|
+
meter: {
|
|
3574
|
+
charge: (charge) => {
|
|
3575
|
+
if (charge.verdict !== undefined)
|
|
3576
|
+
heard = charge.verdict;
|
|
3577
|
+
sessionMeter.charge(charge);
|
|
3578
|
+
},
|
|
3579
|
+
},
|
|
3385
3580
|
}, meta));
|
|
3581
|
+
whole?.(wrunSourceVerdictWhole(heard));
|
|
3582
|
+
return answer;
|
|
3583
|
+
}, {
|
|
3584
|
+
// One record per add (wrun-row-lane-add-memo.util), whatever the budget: the live start and every reconcile reuse
|
|
3585
|
+
// the bars the add's reads landed whole and final, keep what a budgeted run cut partial, and ask only the rest (a
|
|
3586
|
+
// new bar, a bar still forming). A replay step's read keeps its own memo (`replayCursorMs`).
|
|
3587
|
+
addMemo: { key: wrunRowLaneAddKey(context.chartIndex, context.indicatorId, laneId), role: 'live' },
|
|
3588
|
+
...(replay !== undefined ? { onUnconfirmed: replay.onUnconfirmed } : {}),
|
|
3386
3589
|
});
|
|
3387
3590
|
return rows;
|
|
3388
3591
|
}
|
|
@@ -3506,8 +3709,18 @@ async function fetchWrunReconcileLeg(context, ledger, leg, meta) {
|
|
|
3506
3709
|
// record that names none.
|
|
3507
3710
|
const native = leg.nativeRows === true ? { nativeRows: true } : wrunLegNativeRowsOption(leg, context.market?.exchange);
|
|
3508
3711
|
const fetchType = wrunLegFetchType(leg);
|
|
3712
|
+
// An own-market candle leg (intrabar, candles, the run bars) re-asks where the chart's rows came from, as runs do.
|
|
3713
|
+
const candleAsk = fetchType === 'ohlcv' && leg.market === undefined && leg.odds !== true
|
|
3714
|
+
? wrunCandleAskSource(wrunChartHostEnv().chart.chartStore().mergedAllCharts[context.chartIndex]?.metadata, meta.settings)
|
|
3715
|
+
: undefined;
|
|
3716
|
+
const candleSourceExtras = candleAsk?.source && !candleAsk.walled ? { candleSource: candleAsk.source } : undefined;
|
|
3509
3717
|
const ask = async (fromTs, toTs, options, onSourceVerdict) => {
|
|
3510
|
-
const fetched = await withWrunDeadline(wrunChartHostEnv().transport.fetchSource(context.chartIndex, fetchType, {
|
|
3718
|
+
const fetched = await withWrunDeadline(wrunChartHostEnv().transport.fetchSource(context.chartIndex, fetchType, {
|
|
3719
|
+
symbol: 'currentSymbol',
|
|
3720
|
+
exchange: 'currentExchange',
|
|
3721
|
+
...candleSourceExtras,
|
|
3722
|
+
...wrunLegPayloadExtras(leg),
|
|
3723
|
+
}, fromTs, toTs, meta, `${context.fetchKey}-live-${suffix}`, false, {
|
|
3511
3724
|
silentLegend: true,
|
|
3512
3725
|
...options,
|
|
3513
3726
|
...(onSourceVerdict !== undefined ? { onSourceVerdict } : {}),
|
|
@@ -3560,7 +3773,7 @@ function mergeWrunLegAnswer(context, leg, answer, askedAtMs) {
|
|
|
3560
3773
|
record.coveredThroughTs = Math.max(record.coveredThroughTs, askedAtMs);
|
|
3561
3774
|
if (leg.kind === 'grid' && leg.legMs > 0) {
|
|
3562
3775
|
// A grid leg's revised row revises the chart bar it lands in, once that bar is committed (before the forming row).
|
|
3563
|
-
const revisedBar = wrunLegRevisedBarTs(context, before, merged, leg.fromTs, leg.tierMs ?? leg.legMs, context.lastRowTs);
|
|
3776
|
+
const revisedBar = wrunLegRevisedBarTs(context, before, merged, leg.fromTs, leg.tierMs ?? leg.legMs, context.lastRowTs, wrunLegRowVenue(record?.market, liveBucketVenueOf(context.market)));
|
|
3564
3777
|
return { served, revisedFromTs: revisedBar === null ? null : Math.max(context.firstRowTs, revisedBar) };
|
|
3565
3778
|
}
|
|
3566
3779
|
const exchange = context.market?.exchange;
|
|
@@ -3575,12 +3788,17 @@ function mergeWrunLegAnswer(context, leg, answer, askedAtMs) {
|
|
|
3575
3788
|
// February). A leg whose venue closes its bars off open + L (a CME session
|
|
3576
3789
|
// bar) is judged by its own closes: the newest open among them that closed
|
|
3577
3790
|
// by then.
|
|
3578
|
-
const closeMs = leg.kind === 'grid'
|
|
3791
|
+
const closeMs = leg.kind === 'grid'
|
|
3792
|
+
? undefined
|
|
3793
|
+
: wrunLegCandleClose(leg, exchange, context.market?.sessionType, {
|
|
3794
|
+
symbol: context.market?.symbol,
|
|
3795
|
+
interval: context.intervalMs,
|
|
3796
|
+
});
|
|
3579
3797
|
const committedCloseMs = leg.kind === 'grid' || intervalMs === 0
|
|
3580
3798
|
? context.lastRowTs
|
|
3581
3799
|
: Math.min(context.lastRowTs, wrunChartHostEnv()
|
|
3582
3800
|
.sharedHost()
|
|
3583
|
-
.wrunLegRowBoundsMs(context.lastRowTs, intervalMs, wrunPrimaryRowBounds(exchange, intervalMs)).openMs);
|
|
3801
|
+
.wrunLegRowBoundsMs(context.lastRowTs, intervalMs, wrunPrimaryRowBounds(exchange, intervalMs, context.market)).openMs);
|
|
3584
3802
|
const committedBound = closeMs === undefined
|
|
3585
3803
|
? prevBarStartMs(committedCloseMs, leg.legMs)
|
|
3586
3804
|
: newestOpenClosedBy(merged, before, leg.legMs, closeMs, committedCloseMs);
|
|
@@ -3593,7 +3811,7 @@ function mergeWrunLegAnswer(context, leg, answer, askedAtMs) {
|
|
|
3593
3811
|
// (its close less P on a plain grid). On the CME lattice the row holding
|
|
3594
3812
|
// the instant (the calendar that labels the rows) can come first: a 3d row
|
|
3595
3813
|
// spanning a weekend, a fall-back Sunday bar an hour long.
|
|
3596
|
-
const holdingMs = (instantMs) => wrunPrimaryRowHoldingMs(exchange, intervalMs, instantMs) ?? Number.POSITIVE_INFINITY;
|
|
3814
|
+
const holdingMs = (instantMs) => wrunPrimaryRowHoldingMs(exchange, intervalMs, instantMs, context.market) ?? Number.POSITIVE_INFINITY;
|
|
3597
3815
|
const closeAtMs = wrunChartHostEnv().sharedHost().wrunLegCandleCloseMs(changed, leg.legMs, closeMs);
|
|
3598
3816
|
const revisedRow = leg.kind === 'intrabar' && intervalMs > 0
|
|
3599
3817
|
? Math.min(wrunFormingBucketStart(changed, intervalMs), holdingMs(changed))
|
|
@@ -3726,10 +3944,7 @@ servedStartMs) {
|
|
|
3726
3944
|
// OPENED before the served start (its open, not its key: a CME daily-class bucket's 00:00Z key
|
|
3727
3945
|
// runs ahead of its 17:00 Chicago open) is partial: the answer holds only its later prints, so
|
|
3728
3946
|
// it is dropped from the answer and read like a bucket before the horizon (the fed row stands,
|
|
3729
|
-
// never a revised closed bar). An answered bucket
|
|
3730
|
-
// the union of the held row and the answer (`wrunTapeAnswerUnion`), and an unanswered held
|
|
3731
|
-
// bucket stays, since the table holds no print of a quote it does not price and the live floors
|
|
3732
|
-
// can still keep a print it lacks.
|
|
3947
|
+
// never a revised closed bar). An answered bucket keeps held orders the answer lacks: a live row can beat its table copy.
|
|
3733
3948
|
const answer = lane === 'tape'
|
|
3734
3949
|
? wrunTapeAnswerUnion(servedStartMs === undefined
|
|
3735
3950
|
? answerRows
|
|
@@ -3937,28 +4152,11 @@ function wrunTapeAnswerWithoutPartialHead(answer, servedStartMs, intervalMs, exc
|
|
|
3937
4152
|
return answer;
|
|
3938
4153
|
return answer.filter((row) => Number(row[0]) !== horizonTs);
|
|
3939
4154
|
}
|
|
3940
|
-
/**
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
return `${cell[0]}|${cell[1]}|${cell[3]}`;
|
|
4155
|
+
/** Stamp offset and side: the key the collector groups an order's fills by. */
|
|
4156
|
+
function wrunTapeOrderKey(cell) {
|
|
4157
|
+
return `${cell[0]}|${cell[3]}`;
|
|
3944
4158
|
}
|
|
3945
|
-
/**
|
|
3946
|
-
* A tape answer folded over the held rows: each answered bucket with a held row becomes the union
|
|
3947
|
-
* of both rows' prints, a multiset union by print (a print the two share is kept once, two equal
|
|
3948
|
-
* prints of one row stay two), in time order with the answer's prints first among equal offsets.
|
|
3949
|
-
* A reconcile only ever adds prints to a bar: the large-print table holds no print of a quote it
|
|
3950
|
-
* does not price, and the live floors can still keep a print it lacks (a contract's notional, a
|
|
3951
|
-
* print the writer had not committed when the ask landed), so a print shown live never vanishes
|
|
3952
|
-
* on the next poll.
|
|
3953
|
-
*
|
|
3954
|
-
* A print is the same print in both rows when its stamp, price and side are equal and its size agrees within float
|
|
3955
|
-
* rounding (`laneValuesEqual`, the session's own noise rule): two hosts compute one print's size, and under a dollar
|
|
3956
|
-
* floor (C-DOLLAR) they compute it differently, the gateway's writer on the stored row (an inverse contract's dollar
|
|
3957
|
-
* face), this browser as price x the live-feed COIN-arm size x the market's dollar unit: Binance delivery BTCUSD_PERP
|
|
3958
|
-
* trade 1160180465 (2026-10-22, tests/fixtures/wrun/tape-live-history-pairs.json) is $179,300 stored and
|
|
3959
|
-
* 84,428.9 x 2.12368039853652 = 179299.99999999997 live. Two equal prints still stay two: each held print matches one
|
|
3960
|
-
* answer print at most.
|
|
3961
|
-
*/
|
|
4159
|
+
/** Merges by order, never by price or size, which can print differently live and from the table; held-only orders stay. */
|
|
3962
4160
|
function wrunTapeAnswerUnion(answer, held) {
|
|
3963
4161
|
if (held.length === 0)
|
|
3964
4162
|
return answer;
|
|
@@ -3969,29 +4167,9 @@ function wrunTapeAnswerUnion(answer, held) {
|
|
|
3969
4167
|
const previous = heldByTs.get(Number(row[0]));
|
|
3970
4168
|
if (previous === undefined || previous.length <= 1)
|
|
3971
4169
|
return row;
|
|
3972
|
-
|
|
3973
|
-
const
|
|
3974
|
-
const
|
|
3975
|
-
for (let at = 1; at < row.length; at += 1) {
|
|
3976
|
-
const cell = row[at];
|
|
3977
|
-
cells.push(cell);
|
|
3978
|
-
const key = wrunTapePrintPlaceKey(cell);
|
|
3979
|
-
const sizes = unmatched.get(key);
|
|
3980
|
-
if (sizes === undefined)
|
|
3981
|
-
unmatched.set(key, [cell[2]]);
|
|
3982
|
-
else
|
|
3983
|
-
sizes.push(cell[2]);
|
|
3984
|
-
}
|
|
3985
|
-
const extra = [];
|
|
3986
|
-
for (let at = 1; at < previous.length; at += 1) {
|
|
3987
|
-
const cell = previous[at];
|
|
3988
|
-
const sizes = unmatched.get(wrunTapePrintPlaceKey(cell));
|
|
3989
|
-
const match = sizes === undefined ? -1 : sizes.findIndex((size) => laneValuesEqual(size, cell[2]));
|
|
3990
|
-
if (match >= 0)
|
|
3991
|
-
sizes?.splice(match, 1);
|
|
3992
|
-
else
|
|
3993
|
-
extra.push(cell);
|
|
3994
|
-
}
|
|
4170
|
+
const cells = Array.from(row).slice(1);
|
|
4171
|
+
const answered = new Set(cells.map(wrunTapeOrderKey));
|
|
4172
|
+
const extra = Array.from(previous).slice(1).filter((cell) => !answered.has(wrunTapeOrderKey(cell)));
|
|
3995
4173
|
if (extra.length === 0)
|
|
3996
4174
|
return row;
|
|
3997
4175
|
// A stable sort: the answer's prints keep their order and lead every held print of their offset.
|
|
@@ -4013,9 +4191,9 @@ function wrunTapeServedStartMs(context, windowFromTs, nowMs) {
|
|
|
4013
4191
|
// The full run validated the history; a malformed record reads as the live edge.
|
|
4014
4192
|
}
|
|
4015
4193
|
// The lane the ask rode (tradesLaneLimits, the control's own rule, under the acquisition's floor): the table's
|
|
4016
|
-
// retention and bar limit, the raw tape's two-hour seed
|
|
4017
|
-
//
|
|
4018
|
-
const lane = tradesLaneLimits(context.acquisition.tape?.large === true,
|
|
4194
|
+
// retention and bar limit on a large acquisition, else the raw tape's two-hour seed, or no history at all for a
|
|
4195
|
+
// dollar floor there.
|
|
4196
|
+
const lane = tradesLaneLimits(context.acquisition.tape?.large === true, {
|
|
4019
4197
|
minValue: context.acquisition.tape?.minValue,
|
|
4020
4198
|
});
|
|
4021
4199
|
return tradesServedStartMs(nowMs, Math.min(historySec, lane.historyCapSec), context.intervalMs, {
|
|
@@ -4059,11 +4237,11 @@ function laneWindowRevisedFromTs(before, after, fromTs, endTs) {
|
|
|
4059
4237
|
* row builder lands a grid or trades leg there (`wrunLegRowsOnHostBars`). A row no chart bar holds (off the chart's
|
|
4060
4238
|
* session) revises none, and a row's own stamp is never the answer (a 24/7 hour under a stock's 13:30 bar).
|
|
4061
4239
|
*/
|
|
4062
|
-
function wrunLegRevisedBarTs(context, before, merged, fromTs, legMs, beforeTs) {
|
|
4240
|
+
function wrunLegRevisedBarTs(context, before, merged, fromTs, legMs, beforeTs, rowVenue) {
|
|
4063
4241
|
const barOf = hostBucketResolverFor(context.intervalMs, liveBucketVenueOf(context.market));
|
|
4064
4242
|
let revisedBar = null;
|
|
4065
4243
|
for (const ts of laneWindowRevisedStamps(before, merged, fromTs, Number.POSITIVE_INFINITY)) {
|
|
4066
|
-
const bar = wrunLegRowHostBar(ts, legMs, barOf);
|
|
4244
|
+
const bar = wrunLegRowHostBar(ts, legMs, barOf, rowVenue);
|
|
4067
4245
|
if (bar !== null && bar < beforeTs)
|
|
4068
4246
|
revisedBar = minTs(revisedBar, bar);
|
|
4069
4247
|
}
|
|
@@ -4916,7 +5094,8 @@ function publishWrunDebugTick(context, outputRows) {
|
|
|
4916
5094
|
if (wrunDebugSlotIndex(context.metadata) === undefined)
|
|
4917
5095
|
return;
|
|
4918
5096
|
const store = wrunChartHostEnv().chart.chartStore();
|
|
4919
|
-
|
|
5097
|
+
// The session's own console provenance (the run that installed it), never the chart's market now.
|
|
5098
|
+
store.setIndicatorPrintOutputs(context.chartIndex, context.indicatorId, selectWrunDebugLines(context.metadata, outputRows), { opra: context.opraRead === true, ...(context.cmeRead === true ? { cme: true } : {}) });
|
|
4920
5099
|
}
|
|
4921
5100
|
export function __resetWrunLiveTickForTests() {
|
|
4922
5101
|
for (const state of tickStates.values()) {
|
|
@@ -4932,6 +5111,7 @@ export function __resetWrunLiveTickForTests() {
|
|
|
4932
5111
|
for (const armed of graceEndWakes.values())
|
|
4933
5112
|
clearTimeout(armed.timer);
|
|
4934
5113
|
graceEndWakes.clear();
|
|
5114
|
+
wrunLiveHeld = false;
|
|
4935
5115
|
}
|
|
4936
5116
|
/** Spec probe: the due time of the overlay's armed `pinned-close` timer, null when none. */
|
|
4937
5117
|
export function wrunPinnedCloseTimerDueAt(indicatorId) {
|