@orangecharts/wrun-chart-host 0.3.0 → 0.5.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 +23 -6
- package/dist/constants/exchange-names.leaf.d.ts +8 -0
- package/dist/constants/exchange-names.leaf.js +101 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
- package/dist/constants/opra-compliance.constants.d.ts +19 -0
- package/dist/constants/opra-compliance.constants.js +19 -0
- package/dist/constants/replay-ladder.leaf.d.ts +30 -0
- package/dist/constants/replay-ladder.leaf.js +99 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +133 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
- package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
- package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
- package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
- package/dist/constants/scriptEditor/execution.constants.js +14 -0
- package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
- package/dist/constants/wrun-prefix-safe.constants.js +26 -0
- package/dist/host-env.d.ts +321 -24
- package/dist/host-env.js +15 -0
- package/dist/host-ports.types.d.ts +857 -35
- package/dist/index.d.ts +149 -2
- package/dist/index.js +149 -2
- package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
- package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
- package/dist/interfaces/market-event.interface.d.ts +231 -0
- package/dist/interfaces/market-event.interface.js +15 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
- package/dist/interfaces/opra-realtime.interface.js +34 -59
- package/dist/interfaces/replay.interface.d.ts +285 -0
- package/dist/interfaces/replay.interface.js +1 -0
- package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
- package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
- package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
- package/dist/market-data/billing.interface.d.ts +219 -0
- package/dist/market-data/billing.interface.js +58 -0
- package/dist/market-data/venue-governed.util.d.ts +2 -0
- package/dist/market-data/venue-governed.util.js +10 -0
- package/dist/market-data/venue.d.ts +122 -0
- package/dist/market-data/venue.js +1 -0
- package/dist/market-data/venues/index.d.ts +97 -0
- package/dist/market-data/venues/index.js +33 -0
- package/dist/market-data/venues/opra.contract.copy.json +35 -0
- package/dist/market-data/venues/opra.d.ts +70 -0
- package/dist/market-data/venues/opra.js +74 -0
- package/dist/replay/replayIndicatorRows.d.ts +31 -0
- package/dist/replay/replayIndicatorRows.js +117 -0
- package/dist/replay/replayLadder.d.ts +85 -0
- package/dist/replay/replayLadder.js +388 -0
- package/dist/utility/auth/server-clock.util.d.ts +81 -0
- package/dist/utility/auth/server-clock.util.js +238 -0
- package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
- package/dist/utility/chart/builtin-identity.util.js +51 -0
- package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
- package/dist/utility/chart/cache-alignment.util.js +926 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
- package/dist/utility/chart/chart-mount-epoch.util.d.ts +5 -0
- package/dist/utility/chart/chart-mount-epoch.util.js +29 -0
- package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
- package/dist/utility/chart/chart-time-domain.util.js +23 -0
- package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
- package/dist/utility/chart/color-customization.leaf.js +16 -0
- package/dist/utility/chart/date-labelled-interval.leaf.d.ts +15 -0
- package/dist/utility/chart/date-labelled-interval.leaf.js +19 -0
- package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
- package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
- package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
- package/dist/utility/chart/gesture-timing.leaf.js +29 -0
- package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
- package/dist/utility/chart/governed-contract-coin.util.js +39 -0
- package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
- package/dist/utility/chart/host-bar-placement.util.js +447 -0
- package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
- package/dist/utility/chart/index-host-tier.util.js +118 -0
- package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
- package/dist/utility/chart/index-mode-admission.util.js +67 -0
- package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
- package/dist/utility/chart/indicator-error-message.util.js +44 -0
- package/dist/utility/chart/indicator-run-interval.util.d.ts +130 -0
- package/dist/utility/chart/indicator-run-interval.util.js +268 -0
- package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
- package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
- package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
- package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
- package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
- package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
- package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
- package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
- package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
- package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
- package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
- package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
- package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
- package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
- package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
- package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
- package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
- package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
- package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
- package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
- package/dist/utility/chart/kscript-source-retention.util.js +218 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
- package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
- package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
- package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
- package/dist/utility/chart/live-cadence.util.d.ts +38 -0
- package/dist/utility/chart/live-cadence.util.js +37 -0
- package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
- package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
- package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
- package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
- package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
- package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
- package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
- package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
- package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
- package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
- package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
- package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
- package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
- package/dist/utility/chart/mixed-mode.util.js +139 -0
- package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
- package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
- package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
- package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
- package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
- package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
- package/dist/utility/chart/price-precision.util.d.ts +40 -0
- package/dist/utility/chart/price-precision.util.js +70 -0
- package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
- package/dist/utility/chart/profile-block-size.util.js +141 -0
- package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
- package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
- package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
- package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
- package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
- package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
- package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
- package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
- package/dist/utility/chart/titan-constants.pin.js +18 -5
- package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
- package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
- package/dist/utility/chart/window-geometry.leaf.d.ts +119 -0
- package/dist/utility/chart/window-geometry.leaf.js +391 -0
- package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
- package/dist/utility/chart/window-owner.leaf.js +24 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
- package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
- package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
- package/dist/utility/chart/wrun-run-result.util.js +20 -14
- package/dist/utility/common/data-processing.util.d.ts +138 -0
- package/dist/utility/common/data-processing.util.js +346 -0
- package/dist/utility/common/visible-timeout.util.d.ts +13 -4
- package/dist/utility/common/visible-timeout.util.js +23 -8
- package/dist/utility/exchange-format.leaf.d.ts +1 -0
- package/dist/utility/exchange-format.leaf.js +47 -0
- package/dist/utility/html-escape.leaf.d.ts +11 -0
- package/dist/utility/html-escape.leaf.js +20 -0
- package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
- package/dist/utility/market-events/earnings-scope.util.js +92 -0
- package/dist/utility/market-events/market-events.util.d.ts +147 -0
- package/dist/utility/market-events/market-events.util.js +392 -0
- package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
- package/dist/utility/market-events/zoned-clock.util.js +11 -0
- package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
- package/dist/utility/options/option-venue-disclosure.util.js +56 -0
- package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
- package/dist/utility/scriptEditor/package-semver.util.js +120 -0
- package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
- package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
- package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
- package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
- package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
- package/dist/utility/v2/governed-tier.leaf.js +113 -0
- package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
- package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +43 -15
- package/dist/utility/wrun/sources/lanes/option_daily.js +78 -20
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +14 -10
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +5 -4
- package/dist/utility/wrun/sources/lanes/series.js +2 -2
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +22 -3
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +38 -7
- package/dist/utility/wrun/sources/registry.js +31 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +5 -5
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +49 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +75 -20
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +49 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +57 -47
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +36 -4
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +6 -12
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +37 -3
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +128 -2
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +233 -51
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +0 -8
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +26 -24
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +85 -104
- package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
- package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
- package/dist/utility/wrun/wrun-bar-count.util.d.ts +83 -0
- package/dist/utility/wrun/wrun-bar-count.util.js +259 -0
- package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
- package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
- package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
- package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
- package/dist/utility/wrun/wrun-deadline.util.js +2 -1
- package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
- package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
- package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
- package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
- package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
- package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
- package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
- package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
- package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
- package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
- package/dist/utility/wrun/wrun-host.service.d.ts +266 -0
- package/dist/utility/wrun/wrun-host.service.js +655 -0
- package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
- package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
- package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
- package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
- package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
- package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
- package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
- package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
- package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
- package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
- package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
- package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
- package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
- package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
- package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +29 -10
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +29 -10
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
- package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
- package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
- package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
- package/dist/utility/wrun/wrun-panel-mount.lazy.d.ts +10 -0
- package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +392 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +2346 -0
- package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
- package/dist/utility/wrun/wrun-param-map.util.js +40 -47
- package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
- package/dist/utility/wrun/wrun-param-values.util.js +5 -5
- package/dist/utility/wrun/wrun-pause-dim.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-pause-dim.util.js +153 -0
- package/dist/utility/wrun/wrun-plot-gate.types.d.ts +23 -0
- package/dist/utility/wrun/wrun-plot-gate.types.js +7 -0
- package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
- package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
- package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
- package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
- package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
- package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
- package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
- package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
- package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
- package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
- package/dist/utility/wrun/wrun-run-interval-projection.types.d.ts +14 -0
- package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
- package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
- package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
- package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
- package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
- package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
- package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
- package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
- package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
- package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
- package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
- package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
- package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
- package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
- package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
- package/dist/utility/wrun/wrun-text-params.util.js +19 -30
- package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
- package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
- package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
- package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
- package/dist/utility/wrun-alert-params.leaf.js +24 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
- package/dist/utils/replay/replay-buffer-math.js +684 -0
- package/dist/workers/wrun/wrun-abi-host.d.ts +190 -0
- package/dist/workers/wrun/wrun-abi-host.js +1201 -0
- package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
- package/dist/workers/wrun/wrun-engine-handler.js +211 -0
- package/package.json +3 -3
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run interval for the wrun Indicators that stand in for the built-ins (WRUN-HTF-NATIVE-PLAN.md):
|
|
3
|
+
* TradingView's Timeframe model, at the host.
|
|
4
|
+
*
|
|
5
|
+
* A proven twin (`builtinTwinOf`, wrun-builtin-twin.util) carries the built-in's `timeframe`
|
|
6
|
+
* select (option values "0".."7", labels chart, 5m, 15m, 30m, 1h, 4h, 1D, 1W) and, inside the
|
|
7
|
+
* package, rebuilt the selected timeframe from the chart's loaded bars (./sdk/resample), so smoothed
|
|
8
|
+
* values never settled and long windows stayed blank until the user zoomed out. When the selected
|
|
9
|
+
* timeframe is coarser than the chart, the host now runs the package AT that interval instead: on
|
|
10
|
+
* real candles of that interval fetched with a warm-up before the chart's first bar, with the
|
|
11
|
+
* package's own `timeframe` forced to its chart option (the package takes its plain chart path, the
|
|
12
|
+
* resampler never runs), and the run rows are projected onto the chart's bars by the kScript
|
|
13
|
+
* adapter stage (kscript-run-interval-projection.util), exactly as for the kScript built-ins
|
|
14
|
+
* (indicator-run-interval.util). The package and the kit never notice.
|
|
15
|
+
*
|
|
16
|
+
* Read the run interval ONCE per run and carry it on that run's context: the full run, the live
|
|
17
|
+
* ticks, the reseed and the projection must agree on it.
|
|
18
|
+
*
|
|
19
|
+
* A Timeframe at or below the chart's interval is the chart's own for every twin, as for its
|
|
20
|
+
* built-in (wrunTimeframeIsChartOrFiner): the package must compute its plain chart path on the
|
|
21
|
+
* chart's bars, never its selected-timeframe branch.
|
|
22
|
+
*
|
|
23
|
+
* On a CME Group chart the twins run at their interval too, where the kScript built-ins keep their
|
|
24
|
+
* template path (isRunIntervalUnsupportedMarket): the run is stamped `sessionLattice`, so every
|
|
25
|
+
* rule reads a run bar's span on the session calendar (runBarSpan: a 1D bar is its trade date,
|
|
26
|
+
* stamped 00:00Z after its 17:00 Chicago open; a 1W bar its trade-date week; a 4h bar the 17:00
|
|
27
|
+
* lattice) and steps over the session gaps, as the built-in's native higher-timeframe leg does.
|
|
28
|
+
*/
|
|
29
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
30
|
+
import { runIntervalOfTimeframeLabel, timeframeIsChartOrFiner, } from '../chart/indicator-run-interval.util.js';
|
|
31
|
+
import { isCmeSessionLatticeExchange } from '../chart/cme-session-bucket.util.js';
|
|
32
|
+
import { checkIsIndexMode } from '../chart/index-mode.util.js';
|
|
33
|
+
import { isRunIntervalUnservableMarket } from '../chart/run-interval-unservable.leaf.js';
|
|
34
|
+
import { runIntervalWarmupBars } from '../chart/run-interval-warmup.leaf.js';
|
|
35
|
+
import { builtinTwinOf } from './wrun-builtin-twin.util.js';
|
|
36
|
+
/** The param a twin selects its timeframe with, and the one that says whether to wait for closes. */
|
|
37
|
+
export const WRUN_TIMEFRAME_PARAM = 'timeframe';
|
|
38
|
+
export const WRUN_WAIT_FOR_CLOSE_PARAM = 'wait_for_close';
|
|
39
|
+
/** The twins' timeframe option labels by option value (index), the fallback when the overlay's
|
|
40
|
+
* persisted `scriptInputs` carry none. Index 0 is the chart's own interval. */
|
|
41
|
+
export const WRUN_TWIN_TIMEFRAME_LABELS = ['chart', '5m', '15m', '30m', '1h', '4h', '1D', '1W'];
|
|
42
|
+
/** The option value of the chart path, the value the host forces for a run at another interval. */
|
|
43
|
+
export const WRUN_TIMEFRAME_CHART_VALUE = '0';
|
|
44
|
+
function num(value) {
|
|
45
|
+
const parsed = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : Number.NaN;
|
|
46
|
+
return Number.isFinite(parsed) && parsed > 0 ? Math.ceil(parsed) : 0;
|
|
47
|
+
}
|
|
48
|
+
/** The smoothing MA the oscillator twins chain after their value (`smoothing_type` 0 = None). */
|
|
49
|
+
function smoothing(settings) {
|
|
50
|
+
const type = settings.smoothing_type;
|
|
51
|
+
const off = type === undefined || type === null || type === 0 || type === '0' || type === 'None';
|
|
52
|
+
return off ? 0 : num(settings.smoothing_length);
|
|
53
|
+
}
|
|
54
|
+
/** Keltner's band smoothing, as its built-in's (keltnerBandBars, indicator-run-interval.util): its ATR
|
|
55
|
+
* period on ATR bands (`band_style` 0, the default), nothing more on True Range or Range bands. */
|
|
56
|
+
function keltnerBandBars(settings) {
|
|
57
|
+
const style = settings.band_style;
|
|
58
|
+
const atr = style === undefined || style === null || style === 0 || style === '0';
|
|
59
|
+
return atr ? num(settings.atr_period) : 0;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The proven twins whose `timeframe` runs at its own interval, each with the lookback (in run bars)
|
|
63
|
+
* its current settings need before a value settles: the warm-up is runIntervalWarmupBars of it
|
|
64
|
+
* (max(300, 16 x lookback), capped). Param names are the ports' (WRUN-OFFICIAL-PORTS
|
|
65
|
+
* ports/<name>/src/gen/params.ts at the proven 0.3.0); a cumulative or path-dependent twin (ADL,
|
|
66
|
+
* OBV, PSAR) reads 0, the warm-up floor. The staples' twins (WRUN-PARITY-REST A3, their proven
|
|
67
|
+
* sheets' params) take their built-in's lookback term for term: the declared window inputs where
|
|
68
|
+
* the declaration is right (ATR, CMF, Momentum, ROC, the Awesome Oscillator's longer SMA),
|
|
69
|
+
* NATIVE_RUN_INTERVAL_LOOKBACK_BARS where it misses a term (the offset of Donchian, WMA and VWMA,
|
|
70
|
+
* Hull's outer average, the input the pass does not trace into atr(), wpr() and highestbars(),
|
|
71
|
+
* Keltner's ATR bands, the Stochastic RSI's chain).
|
|
72
|
+
*/
|
|
73
|
+
export const WRUN_RUN_INTERVAL_TWINS = {
|
|
74
|
+
ADL: () => 0,
|
|
75
|
+
ADX: (s) => 2 * num(s.period),
|
|
76
|
+
AO: (s) => Math.max(num(s.fast_length), num(s.slow_length)),
|
|
77
|
+
AROON: (s) => num(s.length) + 1,
|
|
78
|
+
ATR: (s) => num(s.period),
|
|
79
|
+
BOLLINGER_BANDS: (s) => num(s.period),
|
|
80
|
+
CCI: (s) => num(s.period) + smoothing(s),
|
|
81
|
+
CMF: (s) => num(s.length),
|
|
82
|
+
DONCHIAN: (s) => num(s.period) + num(s.offset),
|
|
83
|
+
EMA: (s) => num(s.period),
|
|
84
|
+
HMA: (s) => num(s.period) + Math.round(Math.sqrt(num(s.period))),
|
|
85
|
+
ICHI_CLOUD: (s) => Math.max(num(s.conversion_period), num(s.base_period), num(s.lagging_span_period)) + num(s.displacement),
|
|
86
|
+
KELTNER: (s) => Math.max(num(s.period), keltnerBandBars(s)),
|
|
87
|
+
MACD: (s) => Math.max(num(s.fast_period), num(s.slow_period)) + num(s.signal_period),
|
|
88
|
+
MFI: (s) => num(s.period) + smoothing(s),
|
|
89
|
+
MOMENTUM: (s) => num(s.length),
|
|
90
|
+
OBV: () => 0,
|
|
91
|
+
PSAR: () => 0,
|
|
92
|
+
ROC: (s) => num(s.length),
|
|
93
|
+
RSI: (s) => num(s.period) + smoothing(s),
|
|
94
|
+
SMA: (s) => num(s.period),
|
|
95
|
+
STOCH: (s) => num(s.k_period) + num(s.k_smoothing) + num(s.d_period) + smoothing(s),
|
|
96
|
+
STOCH_RSI: (s) => num(s.rsi_length) + num(s.stoch_length) + num(s.k_smoothing) + num(s.d_smoothing),
|
|
97
|
+
SUPERTREND: (s) => num(s.atr_period),
|
|
98
|
+
VOLUME_BAR: (s) => num(s.ma_length),
|
|
99
|
+
VWMA: (s) => num(s.period) + num(s.offset),
|
|
100
|
+
WILLIAMS_R: (s) => num(s.length),
|
|
101
|
+
WMA: (s) => num(s.period) + num(s.offset),
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* The lookback a proven twin's current settings need before a value settles, in bars of the
|
|
105
|
+
* interval it runs at (WRUN_RUN_INTERVAL_TWINS), null for any other overlay (a twin outside the
|
|
106
|
+
* table, an authored Indicator): the run-interval warm-up sizes from it, and a run on the chart's
|
|
107
|
+
* own bars hands it to the warm-up ask as the declared lookback (local-kscript-warmup-backfill-ask.util).
|
|
108
|
+
*/
|
|
109
|
+
export function wrunTwinLookbackBars(settings) {
|
|
110
|
+
const twin = builtinTwinOf(settings);
|
|
111
|
+
const lookback = twin ? WRUN_RUN_INTERVAL_TWINS[twin] : undefined;
|
|
112
|
+
return lookback ? lookback(settings) : null;
|
|
113
|
+
}
|
|
114
|
+
/** The label of the timeframe option a twin's settings select: through its persisted select's
|
|
115
|
+
* `optionLabels`, else the twins' fixed list. Undefined when unreadable. */
|
|
116
|
+
export function wrunTimeframeLabel(settings) {
|
|
117
|
+
if (!settings || typeof settings !== 'object')
|
|
118
|
+
return undefined;
|
|
119
|
+
const record = settings;
|
|
120
|
+
const value = record[WRUN_TIMEFRAME_PARAM];
|
|
121
|
+
if (value === undefined || value === null)
|
|
122
|
+
return undefined;
|
|
123
|
+
const optionValue = String(value);
|
|
124
|
+
const inputs = Array.isArray(record.scriptInputs) ? record.scriptInputs : [];
|
|
125
|
+
const input = inputs.find((candidate) => !!candidate && typeof candidate === 'object' && candidate.name === WRUN_TIMEFRAME_PARAM);
|
|
126
|
+
if (input && Array.isArray(input.options) && Array.isArray(input.optionLabels)) {
|
|
127
|
+
const index = input.options.map(String).indexOf(optionValue);
|
|
128
|
+
const label = index >= 0 ? input.optionLabels[index] : undefined;
|
|
129
|
+
if (typeof label === 'string')
|
|
130
|
+
return label;
|
|
131
|
+
}
|
|
132
|
+
const index = Number(optionValue);
|
|
133
|
+
return Number.isInteger(index) ? WRUN_TWIN_TIMEFRAME_LABELS[index] : undefined;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Whether a proven twin's Timeframe selects the chart's own interval or a finer one. Such a
|
|
137
|
+
* selection means "chart" for its built-in (timeframeIsChartOrFiner: the engine sees
|
|
138
|
+
* `timeframe: "chart"`, chartIntervalEngineMetadata), so the twin's package must compute its plain
|
|
139
|
+
* chart path too, its Timeframe forced to the chart option in the init args
|
|
140
|
+
* (wrunSettingsForRunInterval): its selected-timeframe branch shows each bar one closed bar late at
|
|
141
|
+
* the chart's interval and refuses (or draws nothing) below it. Read the built-in's way: every
|
|
142
|
+
* proven twin (`builtinTwinOf`), listed in WRUN_RUN_INTERVAL_TWINS or not, on replay, index mode and
|
|
143
|
+
* the unsupported markets alike; an authored Indicator's own `timeframe` param is its author's.
|
|
144
|
+
*/
|
|
145
|
+
export function wrunTimeframeIsChartOrFiner(settings, chartInterval) {
|
|
146
|
+
return builtinTwinOf(settings) !== undefined && timeframeIsChartOrFiner(wrunTimeframeLabel(settings), chartInterval);
|
|
147
|
+
}
|
|
148
|
+
/** Whether a twin waits for the selected bar to close (the param defaults on). */
|
|
149
|
+
export function wrunWaitsForClose(settings) {
|
|
150
|
+
const value = settings && typeof settings === 'object' ? settings[WRUN_WAIT_FOR_CLOSE_PARAM] : undefined;
|
|
151
|
+
return !(value === false || value === 0 || value === '0' || value === 'false');
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The interval a wrun overlay's package runs at when it is coarser than the chart's, else null (the
|
|
155
|
+
* package runs on the chart's bars, as before): a proven twin listed in WRUN_RUN_INTERVAL_TWINS,
|
|
156
|
+
* off replay, index mode and the markets one candle ask cannot serve (`unsupportedMarket`), whose
|
|
157
|
+
* timeframe selects an interval coarser than the chart. A selection at or below the chart's interval
|
|
158
|
+
* is the chart's own (wrunTimeframeIsChartOrFiner).
|
|
159
|
+
*/
|
|
160
|
+
export function resolveWrunRunInterval(input) {
|
|
161
|
+
if (input.replay || input.indexMode || input.unsupportedMarket)
|
|
162
|
+
return null;
|
|
163
|
+
const lookbackBars = wrunTwinLookbackBars(input.settings);
|
|
164
|
+
if (lookbackBars === null)
|
|
165
|
+
return null;
|
|
166
|
+
const run = runIntervalOfTimeframeLabel(wrunTimeframeLabel(input.settings), input.chartInterval);
|
|
167
|
+
if (!run)
|
|
168
|
+
return null;
|
|
169
|
+
return { ...run, waitForClose: wrunWaitsForClose(input.settings), warmupBars: runIntervalWarmupBars(lookbackBars) };
|
|
170
|
+
}
|
|
171
|
+
/** Whether one candle ask at the chart's venue and symbol cannot stand in for the chart's own series
|
|
172
|
+
* (see WrunRunIntervalInput.unsupportedMarket): a formula chart or a prediction market
|
|
173
|
+
* (isRunIntervalUnservableMarket). Unlike the kScript built-ins' predicate
|
|
174
|
+
* (isRunIntervalUnsupportedMarket), a CME-family venue is supported: its run bars are read on the
|
|
175
|
+
* session lattice. */
|
|
176
|
+
export function isWrunRunIntervalUnsupportedMarket(exchange, transformations) {
|
|
177
|
+
return isRunIntervalUnservableMarket(exchange, transformations);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The run interval of one mounted wrun overlay: its settings against the chart's interval, venue,
|
|
181
|
+
* series (`chartTransformations`, a formula chart's legs) and replay state. `chartExchange` is the
|
|
182
|
+
* chart's venue; omitted, the overlay's own `settings.exchange` stands in. A venue that rides the CME
|
|
183
|
+
* session lattice (CME, CBOT, NYMEX, COMEX: isCmeSessionLatticeExchange, the rule the chart's own
|
|
184
|
+
* live bars and the run bars' live fold key on) stamps the run `sessionLattice`.
|
|
185
|
+
*/
|
|
186
|
+
export function overlayWrunRunInterval(chartIndex, overlay, chartInterval, chartExchange, chartTransformations) {
|
|
187
|
+
const settings = overlay?.settings;
|
|
188
|
+
const exchange = chartExchange ?? settings?.exchange;
|
|
189
|
+
const venue = typeof exchange === 'string' ? exchange : undefined;
|
|
190
|
+
const run = resolveWrunRunInterval({
|
|
191
|
+
settings,
|
|
192
|
+
chartInterval,
|
|
193
|
+
// The replay flags are web's (replay/replayFlags.ts `isChartReplaying`, the same Set read at call time).
|
|
194
|
+
replay: wrunChartHostEnv().chart.isReplaying(chartIndex),
|
|
195
|
+
indexMode: checkIsIndexMode(venue),
|
|
196
|
+
unsupportedMarket: isWrunRunIntervalUnsupportedMarket(venue, chartTransformations),
|
|
197
|
+
});
|
|
198
|
+
return run && isCmeSessionLatticeExchange(venue) ? { ...run, sessionLattice: true } : run;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The settings a run at another interval sends the package: the twin's `timeframe` forced to its
|
|
202
|
+
* chart option, on a copy. Only the values the package computes with (the init args); the
|
|
203
|
+
* persisted settings, the dialog, the legend title and the alert arm keep the user's choice.
|
|
204
|
+
*/
|
|
205
|
+
export function wrunSettingsForRunInterval(settings) {
|
|
206
|
+
return { ...settings, [WRUN_TIMEFRAME_PARAM]: WRUN_TIMEFRAME_CHART_VALUE };
|
|
207
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { WrunIndicatorMetadata, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
|
|
2
|
+
import type { WrunOverlayLiveContext } from './wrun-overlay-drivers.util.js';
|
|
3
|
+
import type { StrategyOutput } from '@orangecharts/indicator-kit/host';
|
|
4
|
+
/** A live eviction keeps this share of the cap (the heatmap and batched budgets' watermark): one
|
|
5
|
+
* whole repaint per crossing, not one per bar at the cap. A run (or a reseed) past its cap lands
|
|
6
|
+
* the same share, so the headroom exists from its first bar roll on. */
|
|
7
|
+
export declare const WRUN_RETAINED_TRIM_WATERMARK = 0.95;
|
|
8
|
+
/** What a session's run budget kept, once it holds fewer bars than its chart asked. */
|
|
9
|
+
export interface WrunRetainedRange {
|
|
10
|
+
/** The most rows a run of the session may hold: the smaller of the two budgets. */
|
|
11
|
+
cap: number;
|
|
12
|
+
/** The bars the session calculated: its rows from its first row on. */
|
|
13
|
+
calculatedBars: number;
|
|
14
|
+
/** The older bars the budget left out (the run's window start, and every live eviction since). */
|
|
15
|
+
droppedBars: number;
|
|
16
|
+
}
|
|
17
|
+
/** The newest chart rows a run computes over when its rows pass the cap. */
|
|
18
|
+
export interface WrunRunRetainedWindow<Row> {
|
|
19
|
+
/** The newest rows that fit (the same row objects, the recorded missing bars inside them kept). */
|
|
20
|
+
rows: Row[];
|
|
21
|
+
cap: number;
|
|
22
|
+
/** The rows it kept and the older ones it left out. */
|
|
23
|
+
retainedBars: number;
|
|
24
|
+
droppedBars: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The most rows a run of this sheet may hold: the smaller of the worker's cell budget over its
|
|
28
|
+
* declared outputs and the integrated-row budget over the series it can mount per bar (the run
|
|
29
|
+
* target's fill pairs and candle groups among them), the fixed decorator rows the sheet declares
|
|
30
|
+
* (`wrunSheetFixedRows`: one per table and label, a declared upper bound) taken off that budget
|
|
31
|
+
* first, so a session at the cap passes the preflight and its live growth evicts before it refuses.
|
|
32
|
+
* Undefined when neither binds: a frame-only sheet with nothing plotted.
|
|
33
|
+
*/
|
|
34
|
+
export declare function wrunRunRetainedRowsCap(metadata: WrunIndicatorMetadata, target?: {
|
|
35
|
+
fills?: ReadonlyArray<unknown>;
|
|
36
|
+
candles?: ReadonlyArray<unknown>;
|
|
37
|
+
}): number | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The most rows one run block of this sheet may hold, a hidden warm-up head included: the worker's
|
|
40
|
+
* cell budget alone (`wrunRunCellsRows` over the declared outputs). A head's rows are cut by
|
|
41
|
+
* timestamp before anything integrates (wrun-overlay-run's `wrunSandboxLandedRows` and
|
|
42
|
+
* `wrunLandedOutputRows`), so they cost worker cells and never integrated rows: the integrated-row
|
|
43
|
+
* budget bounds the landed window only (`wrunRunRetainedRowsCap`). Undefined for a sheet that
|
|
44
|
+
* declares no outputs (a frame-only run allocates no cells).
|
|
45
|
+
*/
|
|
46
|
+
export declare function wrunRunBlockRowsCap(metadata: Pick<WrunIndicatorMetadata, 'outputs'>): number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The rows a run walks over a `wrunChartCandleRows` array: its candles plus the missing bars recorded strictly
|
|
49
|
+
* between them. A package that reads another lane on the chart's timeline walks a row at each recorded gap, and the
|
|
50
|
+
* dense grid of a nan or zero primary steps through them too for a non-candle primary only (a candle class's walks
|
|
51
|
+
* the chart's candles on every chart, wrun-source-rows.util `wrunNeedsChartPrimary`), so this bounds the input rows
|
|
52
|
+
* the row builder makes from these candles; a candle-only package walks the candles alone, under it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function wrunChartWalkedRows(rows: ReadonlyArray<ArrayLike<number>>): number;
|
|
55
|
+
/**
|
|
56
|
+
* The run's window over the chart rows it would compute (a `wrunChartCandleRows` array, a replay's rows): undefined
|
|
57
|
+
* when their walk fits the cap, else the newest rows whose walk fits `WRUN_RETAINED_TRIM_WATERMARK` of it (the same
|
|
58
|
+
* row objects in order, the recorded missing bars inside them kept: `wrunChartCandleRowsWithin`). The full run and the
|
|
59
|
+
* reseed decide here, so the session they install sits at the watermark under the cap its live eviction compares
|
|
60
|
+
* against: the first bar roll after either evicts nothing (landing at the cap evicted and repainted whole on it). A
|
|
61
|
+
* run over a window takes no hidden head.
|
|
62
|
+
*/
|
|
63
|
+
export declare function wrunRunRetainedWindowOf<Row extends ArrayLike<number>>(rows: ReadonlyArray<Row>, cap: number | undefined): WrunRunRetainedWindow<Row> | undefined;
|
|
64
|
+
/** Whether a hidden head of `headRows` rows fits the worker's run block beside the window it runs before
|
|
65
|
+
* (`blockRowsCap`, `wrunRunBlockRowsCap`: the cell budget alone, its rows never integrate); a run whose head does not
|
|
66
|
+
* fit runs without it (cold at its first landed bar), never with fewer bars of its window. */
|
|
67
|
+
export declare function wrunRunRetainedHeadFits(rows: ReadonlyArray<ArrayLike<number>>, headRows: number, blockRowsCap: number | undefined): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* A live session's merged rows over its cap lose their oldest rows down to
|
|
70
|
+
* `WRUN_RETAINED_TRIM_WATERMARK` of it, the run-level attachments (the handle set, the frames, the
|
|
71
|
+
* live block's accounting) carried over and the strategy rebased onto the kept rows
|
|
72
|
+
* (`wrunStrategyOnRows`); undefined while they fit. The newest row always stays.
|
|
73
|
+
*/
|
|
74
|
+
export declare function evictWrunRetainedOutputRows(rows: WrunOutputRow[], cap: number | undefined): {
|
|
75
|
+
rows: WrunOutputRow[];
|
|
76
|
+
evicted: number;
|
|
77
|
+
} | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* A session's broker output on its rows (design 5). The live guest's broker keeps every bar it ran since the session
|
|
80
|
+
* opened (one equity sample per bar, bar indexes counted from its first), while an eviction drops the session's
|
|
81
|
+
* oldest rows and the result's timeline (`combinedTimes`) is the rows' own timestamps: unrebased, the Strategy
|
|
82
|
+
* Tester would date each sample a dropped bar's count too late and leave the newest without a time. So the bars
|
|
83
|
+
* before the rows go: the per-bar series keep the rows' bars, every bar index moves back by the bars dropped, the
|
|
84
|
+
* closed trades keep those that exit on the rows (one that entered before them keeps its entry, at a negative bar),
|
|
85
|
+
* and the open trades all stay. The stats stay the run's, with the closed trades the cut left out counted
|
|
86
|
+
* (`closedTradeCount`, the tester's truncated-head rule). The output itself when its broker ran no bar before the
|
|
87
|
+
* rows; the broker's own answer is never rewritten.
|
|
88
|
+
*/
|
|
89
|
+
export declare function wrunStrategyOnRows(strategy: StrategyOutput, rowCount: number): StrategyOutput;
|
|
90
|
+
/**
|
|
91
|
+
* The rows of a time-ordered `[ts, ...]` array (the chart's candles, a lane buffer) from `fromTs` on: the array itself
|
|
92
|
+
* when its first row is not older (a buffer trimmed at its last eviction: no copy), else one slice from the first row
|
|
93
|
+
* that is not, found by bisection (never a walk of the older rows).
|
|
94
|
+
*/
|
|
95
|
+
export declare function wrunRowsFromTs<Row>(rows: Row[], fromTs: number): Row[];
|
|
96
|
+
export declare function wrunRowsFromTs<Row>(rows: ReadonlyArray<Row>, fromTs: number): ReadonlyArray<Row>;
|
|
97
|
+
/** A run's price-canvas source rows (`wrunCellRowsOf`'s): the candles and the celled lanes. */
|
|
98
|
+
export interface WrunCanvasSourceRows {
|
|
99
|
+
ohlcvRows?: ReadonlyArray<unknown>;
|
|
100
|
+
bookRows?: ReadonlyArray<unknown>;
|
|
101
|
+
volumeProfileRows?: ReadonlyArray<unknown>;
|
|
102
|
+
intrabarRows?: Readonly<Record<string, ReadonlyArray<unknown>>>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A session's price-canvas source rows from its retained start on (design 5: nothing outside the retained range is
|
|
106
|
+
* mounted): a canvas that takes its rows whole (an eviction's swap, a heatmap mounted afresh, a reseed's) paints the
|
|
107
|
+
* bars the session calculated and none before them, as the full run's own canvases did over its window, and a TPO
|
|
108
|
+
* folds the same bars on every tick. A lane trimmed there already is handed as it is; the chart's candles are cut
|
|
109
|
+
* from the first retained bar.
|
|
110
|
+
*/
|
|
111
|
+
export declare function wrunRetainedCanvasSources(sources: WrunCanvasSourceRows, fromTs: number): WrunCanvasSourceRows;
|
|
112
|
+
/**
|
|
113
|
+
* A session's celled canvas lanes (the book, the volume profile, the intrabar legs) trimmed to its retained start
|
|
114
|
+
* (design 5: nothing outside the retained range is carried, and a swap's cost stays the kept window's): a buffer
|
|
115
|
+
* reaching before `fromTs` is replaced by its rows from there on, once per move of the start (an eviction, a reseed's
|
|
116
|
+
* later window), and the lanes' start (`lanesFromTs`) follows, so a settings save never computes a window opening
|
|
117
|
+
* before it over these buffers. The scalar lanes keep their rows (an as-of read of the first retained bar may need
|
|
118
|
+
* the row before it).
|
|
119
|
+
*/
|
|
120
|
+
export declare function trimWrunRetainedCanvasLanes(session: Pick<WrunOverlayLiveContext, 'bookRows' | 'volumeProfileRows' | 'intrabarRows' | 'lanesFromTs'>, fromTs: number): void;
|
|
121
|
+
/** The `wrun-run-retained` ring line (the debug dump): where a budget decided a window, and what it kept. */
|
|
122
|
+
export declare function ringWrunRunRetained(details: Record<string, unknown>): void;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run's retained range (WRUN-MARKS-CONTRACT design 5): ONE decision, made where a run's input
|
|
3
|
+
* range is decided (the full run's planner and the reseed, wrun-overlay-run.util), shared by every
|
|
4
|
+
* reader of the run (packing, unpacking, the strategy feed, the session, the warm-up and prefix
|
|
5
|
+
* evidence, the reseed). A run asks for the newest rows its two budgets fit as its window:
|
|
6
|
+
*
|
|
7
|
+
* - the worker's cell budget: a run block holds `rows x outputCount` f64 cells, at most
|
|
8
|
+
* `WRUN_MAX_RUN_CELLS` (wrun-run-cells.util; Big Trades 0.4.0, 97 outputs: 41,237 rows);
|
|
9
|
+
* - the chart's integrated-row budget: the result mounts `rows x series` rows plus its fixed
|
|
10
|
+
* decorator rows (`wrunSheetFixedRows`: a table's, a label's), at most
|
|
11
|
+
* `OVERLAY_HISTORICAL_ROW_BUDGET` (the preflight, `applyWrunIntegrationBudget`), over the series
|
|
12
|
+
* per bar the sheet can mount (`wrunSheetRowSeriesPerBar`: 100 outputs with 11 plotted keep
|
|
13
|
+
* 36,363 rows).
|
|
14
|
+
*
|
|
15
|
+
* The smaller one is the session's cap (`retainedRowsCap`). A run whose rows pass it computes over
|
|
16
|
+
* the newest rows that fit the watermark of it (95%, the live eviction's, so the first bar roll after
|
|
17
|
+
* the run evicts nothing) with no hidden head (the window is the budget), and the session records
|
|
18
|
+
* what it kept (`retained`) and keeps the cap its eviction compares against. A hidden warm-up head
|
|
19
|
+
* costs worker cells only (its rows are cut before anything integrates), so it is checked against
|
|
20
|
+
* the worker's block alone (`wrunRunBlockRowsCap`). A range refresh whose retained window starts
|
|
21
|
+
* after the mounted rows replaces them, never merges onto them (wrun-overlay-run's integrate).
|
|
22
|
+
* Nothing outside the retained range is mounted, carried or used as
|
|
23
|
+
* evidence: the landing replaces the picture; a live session growing past the cap evicts its oldest
|
|
24
|
+
* rows to 95% of it (`evictWrunRetainedOutputRows`), so its merged result never passes either
|
|
25
|
+
* budget; a later prepend that would pass the cap evicts from the old end (the prefix planner
|
|
26
|
+
* declines it and the whole run decides again; a session holding a retained range takes no page
|
|
27
|
+
* before its first row, the lifecycle door's rule); a reseed computes nothing before the first row
|
|
28
|
+
* of a session holding a retained range and decides again over its own rows. The
|
|
29
|
+
* worker's refusal by name (`wrun_run_cells_too_large`) stays the backstop of a request nothing
|
|
30
|
+
* sized.
|
|
31
|
+
*
|
|
32
|
+
* The cost: a script whose state depends on bars before the kept window starts cold at the window,
|
|
33
|
+
* as on a chart whose history starts there.
|
|
34
|
+
*/
|
|
35
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
36
|
+
import { attachWrunLive, wrunLiveOf } from '../../interfaces/wrun-runtime.interface.js';
|
|
37
|
+
import { OVERLAY_HISTORICAL_ROW_BUDGET } from '../chart/overlay-output-budget.util.js';
|
|
38
|
+
import { wrunSheetFixedRows, wrunSheetRowSeriesPerBar } from '../chart/wrun-run-result.util.js';
|
|
39
|
+
import { attachWrunStrategy, wrunStrategyOf } from './wrun-box-segment.util.js';
|
|
40
|
+
import { attachWrunHandles, wrunHandlesOf } from './wrun-handles.util.js';
|
|
41
|
+
import { attachWrunFrames, wrunFramesOf } from './wrun-pack.util.js';
|
|
42
|
+
import { wrunRunCellsRows } from './wrun-run-cells.util.js';
|
|
43
|
+
import { wrunChartCandleRowsWithin, wrunChartGapBarsOf } from './wrun-source-rows.util.js';
|
|
44
|
+
/** A live eviction keeps this share of the cap (the heatmap and batched budgets' watermark): one
|
|
45
|
+
* whole repaint per crossing, not one per bar at the cap. A run (or a reseed) past its cap lands
|
|
46
|
+
* the same share, so the headroom exists from its first bar roll on. */
|
|
47
|
+
export const WRUN_RETAINED_TRIM_WATERMARK = 0.95;
|
|
48
|
+
/**
|
|
49
|
+
* The most rows a run of this sheet may hold: the smaller of the worker's cell budget over its
|
|
50
|
+
* declared outputs and the integrated-row budget over the series it can mount per bar (the run
|
|
51
|
+
* target's fill pairs and candle groups among them), the fixed decorator rows the sheet declares
|
|
52
|
+
* (`wrunSheetFixedRows`: one per table and label, a declared upper bound) taken off that budget
|
|
53
|
+
* first, so a session at the cap passes the preflight and its live growth evicts before it refuses.
|
|
54
|
+
* Undefined when neither binds: a frame-only sheet with nothing plotted.
|
|
55
|
+
*/
|
|
56
|
+
export function wrunRunRetainedRowsCap(metadata, target = {}) {
|
|
57
|
+
const caps = [];
|
|
58
|
+
const cells = wrunRunCellsRows(metadata.outputs?.length ?? 0);
|
|
59
|
+
if (cells !== null)
|
|
60
|
+
caps.push(cells);
|
|
61
|
+
const series = wrunSheetRowSeriesPerBar(metadata, target);
|
|
62
|
+
if (series > 0)
|
|
63
|
+
caps.push(Math.floor((OVERLAY_HISTORICAL_ROW_BUDGET - wrunSheetFixedRows(metadata)) / series));
|
|
64
|
+
return caps.length === 0 ? undefined : Math.max(1, Math.min(...caps));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The most rows one run block of this sheet may hold, a hidden warm-up head included: the worker's
|
|
68
|
+
* cell budget alone (`wrunRunCellsRows` over the declared outputs). A head's rows are cut by
|
|
69
|
+
* timestamp before anything integrates (wrun-overlay-run's `wrunSandboxLandedRows` and
|
|
70
|
+
* `wrunLandedOutputRows`), so they cost worker cells and never integrated rows: the integrated-row
|
|
71
|
+
* budget bounds the landed window only (`wrunRunRetainedRowsCap`). Undefined for a sheet that
|
|
72
|
+
* declares no outputs (a frame-only run allocates no cells).
|
|
73
|
+
*/
|
|
74
|
+
export function wrunRunBlockRowsCap(metadata) {
|
|
75
|
+
return wrunRunCellsRows(metadata.outputs?.length ?? 0) ?? undefined;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The rows a run walks over a `wrunChartCandleRows` array: its candles plus the missing bars recorded strictly
|
|
79
|
+
* between them. A package that reads another lane on the chart's timeline walks a row at each recorded gap, and the
|
|
80
|
+
* dense grid of a nan or zero primary steps through them too for a non-candle primary only (a candle class's walks
|
|
81
|
+
* the chart's candles on every chart, wrun-source-rows.util `wrunNeedsChartPrimary`), so this bounds the input rows
|
|
82
|
+
* the row builder makes from these candles; a candle-only package walks the candles alone, under it.
|
|
83
|
+
*/
|
|
84
|
+
export function wrunChartWalkedRows(rows) {
|
|
85
|
+
return rows.length + wrunChartGapBarsOf(rows).length;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The run's window over the chart rows it would compute (a `wrunChartCandleRows` array, a replay's rows): undefined
|
|
89
|
+
* when their walk fits the cap, else the newest rows whose walk fits `WRUN_RETAINED_TRIM_WATERMARK` of it (the same
|
|
90
|
+
* row objects in order, the recorded missing bars inside them kept: `wrunChartCandleRowsWithin`). The full run and the
|
|
91
|
+
* reseed decide here, so the session they install sits at the watermark under the cap its live eviction compares
|
|
92
|
+
* against: the first bar roll after either evicts nothing (landing at the cap evicted and repainted whole on it). A
|
|
93
|
+
* run over a window takes no hidden head.
|
|
94
|
+
*/
|
|
95
|
+
export function wrunRunRetainedWindowOf(rows, cap) {
|
|
96
|
+
if (cap === undefined || wrunChartWalkedRows(rows) <= cap)
|
|
97
|
+
return undefined;
|
|
98
|
+
const keep = Math.max(1, Math.floor(cap * WRUN_RETAINED_TRIM_WATERMARK));
|
|
99
|
+
const gaps = wrunChartGapBarsOf(rows);
|
|
100
|
+
// The gaps after a row's open (every gap sits before the newest row, so a slice from that row holds them all).
|
|
101
|
+
const gapsAfter = (ts) => {
|
|
102
|
+
let low = 0;
|
|
103
|
+
let high = gaps.length;
|
|
104
|
+
while (low < high) {
|
|
105
|
+
const mid = (low + high) >>> 1;
|
|
106
|
+
if (gaps[mid] > ts)
|
|
107
|
+
high = mid;
|
|
108
|
+
else
|
|
109
|
+
low = mid + 1;
|
|
110
|
+
}
|
|
111
|
+
return gaps.length - low;
|
|
112
|
+
};
|
|
113
|
+
// A slice from `from` walks `rows.length - from` rows and the gaps after its first: the first `from` that fits.
|
|
114
|
+
let low = 0;
|
|
115
|
+
let high = rows.length - 1;
|
|
116
|
+
while (low < high) {
|
|
117
|
+
const mid = (low + high) >>> 1;
|
|
118
|
+
if (rows.length - mid + gapsAfter(Number(rows[mid][0])) <= keep)
|
|
119
|
+
high = mid;
|
|
120
|
+
else
|
|
121
|
+
low = mid + 1;
|
|
122
|
+
}
|
|
123
|
+
const kept = wrunChartCandleRowsWithin(rows, Number(rows[low][0]));
|
|
124
|
+
return { rows: kept, cap, retainedBars: kept.length, droppedBars: rows.length - kept.length };
|
|
125
|
+
}
|
|
126
|
+
/** Whether a hidden head of `headRows` rows fits the worker's run block beside the window it runs before
|
|
127
|
+
* (`blockRowsCap`, `wrunRunBlockRowsCap`: the cell budget alone, its rows never integrate); a run whose head does not
|
|
128
|
+
* fit runs without it (cold at its first landed bar), never with fewer bars of its window. */
|
|
129
|
+
export function wrunRunRetainedHeadFits(rows, headRows, blockRowsCap) {
|
|
130
|
+
return blockRowsCap === undefined || headRows <= 0 || wrunChartWalkedRows(rows) + headRows <= blockRowsCap;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A live session's merged rows over its cap lose their oldest rows down to
|
|
134
|
+
* `WRUN_RETAINED_TRIM_WATERMARK` of it, the run-level attachments (the handle set, the frames, the
|
|
135
|
+
* live block's accounting) carried over and the strategy rebased onto the kept rows
|
|
136
|
+
* (`wrunStrategyOnRows`); undefined while they fit. The newest row always stays.
|
|
137
|
+
*/
|
|
138
|
+
export function evictWrunRetainedOutputRows(rows, cap) {
|
|
139
|
+
if (cap === undefined || rows.length <= cap)
|
|
140
|
+
return undefined;
|
|
141
|
+
const keep = Math.max(1, Math.floor(cap * WRUN_RETAINED_TRIM_WATERMARK));
|
|
142
|
+
const kept = rows.slice(rows.length - keep);
|
|
143
|
+
const handles = wrunHandlesOf(rows);
|
|
144
|
+
if (handles !== undefined)
|
|
145
|
+
attachWrunHandles(kept, handles);
|
|
146
|
+
const strategy = wrunStrategyOf(rows);
|
|
147
|
+
if (strategy !== undefined)
|
|
148
|
+
attachWrunStrategy(kept, wrunStrategyOnRows(strategy, kept.length));
|
|
149
|
+
const frames = wrunFramesOf(rows);
|
|
150
|
+
if (frames !== undefined)
|
|
151
|
+
attachWrunFrames(kept, frames);
|
|
152
|
+
const live = wrunLiveOf(rows);
|
|
153
|
+
if (live !== undefined)
|
|
154
|
+
attachWrunLive(kept, live);
|
|
155
|
+
return { rows: kept, evicted: rows.length - keep };
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* A session's broker output on its rows (design 5). The live guest's broker keeps every bar it ran since the session
|
|
159
|
+
* opened (one equity sample per bar, bar indexes counted from its first), while an eviction drops the session's
|
|
160
|
+
* oldest rows and the result's timeline (`combinedTimes`) is the rows' own timestamps: unrebased, the Strategy
|
|
161
|
+
* Tester would date each sample a dropped bar's count too late and leave the newest without a time. So the bars
|
|
162
|
+
* before the rows go: the per-bar series keep the rows' bars, every bar index moves back by the bars dropped, the
|
|
163
|
+
* closed trades keep those that exit on the rows (one that entered before them keeps its entry, at a negative bar),
|
|
164
|
+
* and the open trades all stay. The stats stay the run's, with the closed trades the cut left out counted
|
|
165
|
+
* (`closedTradeCount`, the tester's truncated-head rule). The output itself when its broker ran no bar before the
|
|
166
|
+
* rows; the broker's own answer is never rewritten.
|
|
167
|
+
*/
|
|
168
|
+
export function wrunStrategyOnRows(strategy, rowCount) {
|
|
169
|
+
const dropped = strategy.equity.length - rowCount;
|
|
170
|
+
if (!(dropped > 0))
|
|
171
|
+
return strategy;
|
|
172
|
+
const trades = strategy.trades.filter((trade) => trade.exitBar >= dropped);
|
|
173
|
+
const stated = strategy.stats.closedTradeCount;
|
|
174
|
+
const closedTradeCount = typeof stated === 'number' ? stated : strategy.trades.length;
|
|
175
|
+
return {
|
|
176
|
+
...strategy,
|
|
177
|
+
trades: trades.map((trade) => ({ ...trade, entryBar: trade.entryBar - dropped, exitBar: trade.exitBar - dropped })),
|
|
178
|
+
openTrades: strategy.openTrades.map((trade) => ({ ...trade, entryBar: trade.entryBar - dropped })),
|
|
179
|
+
equity: strategy.equity.slice(dropped),
|
|
180
|
+
drawdown: strategy.drawdown.slice(dropped),
|
|
181
|
+
...(strategy.committedMarginSeries !== undefined
|
|
182
|
+
? { committedMarginSeries: strategy.committedMarginSeries.slice(dropped) }
|
|
183
|
+
: {}),
|
|
184
|
+
...(strategy.fundingPaidSeries !== undefined
|
|
185
|
+
? { fundingPaidSeries: strategy.fundingPaidSeries.slice(dropped) }
|
|
186
|
+
: {}),
|
|
187
|
+
...(trades.length < strategy.trades.length
|
|
188
|
+
? { stats: { ...strategy.stats, closedTradeCount } }
|
|
189
|
+
: {}),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
export function wrunRowsFromTs(rows, fromTs) {
|
|
193
|
+
const tsAt = (at) => {
|
|
194
|
+
const row = rows[at];
|
|
195
|
+
return Number(row[0]);
|
|
196
|
+
};
|
|
197
|
+
if (rows.length === 0 || !(tsAt(0) < fromTs))
|
|
198
|
+
return rows;
|
|
199
|
+
let low = 1;
|
|
200
|
+
let high = rows.length;
|
|
201
|
+
while (low < high) {
|
|
202
|
+
const mid = (low + high) >>> 1;
|
|
203
|
+
if (tsAt(mid) < fromTs)
|
|
204
|
+
low = mid + 1;
|
|
205
|
+
else
|
|
206
|
+
high = mid;
|
|
207
|
+
}
|
|
208
|
+
return rows.slice(low);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* A session's price-canvas source rows from its retained start on (design 5: nothing outside the retained range is
|
|
212
|
+
* mounted): a canvas that takes its rows whole (an eviction's swap, a heatmap mounted afresh, a reseed's) paints the
|
|
213
|
+
* bars the session calculated and none before them, as the full run's own canvases did over its window, and a TPO
|
|
214
|
+
* folds the same bars on every tick. A lane trimmed there already is handed as it is; the chart's candles are cut
|
|
215
|
+
* from the first retained bar.
|
|
216
|
+
*/
|
|
217
|
+
export function wrunRetainedCanvasSources(sources, fromTs) {
|
|
218
|
+
const { ohlcvRows, bookRows, volumeProfileRows, intrabarRows } = sources;
|
|
219
|
+
return {
|
|
220
|
+
...(ohlcvRows !== undefined ? { ohlcvRows: wrunRowsFromTs(ohlcvRows, fromTs) } : {}),
|
|
221
|
+
...(bookRows !== undefined ? { bookRows: wrunRowsFromTs(bookRows, fromTs) } : {}),
|
|
222
|
+
...(volumeProfileRows !== undefined ? { volumeProfileRows: wrunRowsFromTs(volumeProfileRows, fromTs) } : {}),
|
|
223
|
+
...(intrabarRows !== undefined
|
|
224
|
+
? {
|
|
225
|
+
intrabarRows: Object.fromEntries(Object.entries(intrabarRows).map(([fetchKey, rows]) => [fetchKey, wrunRowsFromTs(rows, fromTs)])),
|
|
226
|
+
}
|
|
227
|
+
: {}),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* A session's celled canvas lanes (the book, the volume profile, the intrabar legs) trimmed to its retained start
|
|
232
|
+
* (design 5: nothing outside the retained range is carried, and a swap's cost stays the kept window's): a buffer
|
|
233
|
+
* reaching before `fromTs` is replaced by its rows from there on, once per move of the start (an eviction, a reseed's
|
|
234
|
+
* later window), and the lanes' start (`lanesFromTs`) follows, so a settings save never computes a window opening
|
|
235
|
+
* before it over these buffers. The scalar lanes keep their rows (an as-of read of the first retained bar may need
|
|
236
|
+
* the row before it).
|
|
237
|
+
*/
|
|
238
|
+
export function trimWrunRetainedCanvasLanes(session, fromTs) {
|
|
239
|
+
if (session.bookRows !== undefined)
|
|
240
|
+
session.bookRows = wrunRowsFromTs(session.bookRows, fromTs);
|
|
241
|
+
if (session.volumeProfileRows !== undefined) {
|
|
242
|
+
session.volumeProfileRows = wrunRowsFromTs(session.volumeProfileRows, fromTs);
|
|
243
|
+
}
|
|
244
|
+
const intrabar = session.intrabarRows;
|
|
245
|
+
if (intrabar !== undefined && Object.values(intrabar).some((rows) => rows.length > 0 && rows[0][0] < fromTs)) {
|
|
246
|
+
session.intrabarRows = Object.fromEntries(Object.entries(intrabar).map(([fetchKey, rows]) => [fetchKey, wrunRowsFromTs(rows, fromTs)]));
|
|
247
|
+
}
|
|
248
|
+
if (session.lanesFromTs !== undefined && session.lanesFromTs < fromTs)
|
|
249
|
+
session.lanesFromTs = fromTs;
|
|
250
|
+
}
|
|
251
|
+
/** The `wrun-run-retained` ring line (the debug dump): where a budget decided a window, and what it kept. */
|
|
252
|
+
export function ringWrunRunRetained(details) {
|
|
253
|
+
if (wrunChartHostEnv().diagnostics.debugEnabled())
|
|
254
|
+
wrunChartHostEnv().diagnostics.debug('wrun-run-retained', details);
|
|
255
|
+
}
|