@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,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `opra-user-scripts` runtime flag as the venue policy reads it (kscript-venue-policy.util, the one decider of
|
|
3
|
+
* the governed walls). Dependency-free on purpose, the shape of exchange-visibility.util and telemetryGates: the
|
|
4
|
+
* venue policy stays worker-safe and store-free, so the feature-flags store hands it readers instead.
|
|
5
|
+
*
|
|
6
|
+
* Two readers, one answer: the store registers its override-aware `isOn` as the fallback when it is created, and
|
|
7
|
+
* publishes its reader again after every successful fetch. Until a fetch publishes, the fallback answers, so the dev
|
|
8
|
+
* and internal `kiyo.flag-overrides` lens reaches the walls before the map lands and through a failed fetch, exactly
|
|
9
|
+
* as it reaches `opraUserScriptsEnabled` (opra-options-gate.util) and the editor's Run wall: the walls and the
|
|
10
|
+
* surfaces never disagree, and a restore that skipped the hydration wait on an override judges by that override. In
|
|
11
|
+
* any context neither reached (a worker, a guest-less spec), the gate reads closed: fail dark, today's wall.
|
|
12
|
+
*/
|
|
13
|
+
let published = null;
|
|
14
|
+
let fallback = null;
|
|
15
|
+
/** Called by the feature-flags store after a successful fetch (and by tests); null unpublishes. */
|
|
16
|
+
export function publishOpraUserScriptsFlag(next) {
|
|
17
|
+
published = next;
|
|
18
|
+
}
|
|
19
|
+
/** Called by the feature-flags store when it is created: its override-aware `isOn`, read until a fetch publishes. */
|
|
20
|
+
export function setOpraUserScriptsFlagFallback(next) {
|
|
21
|
+
fallback = next;
|
|
22
|
+
}
|
|
23
|
+
/** Whether the `opra-user-scripts` flag is on for this session: the published answer, else the store's own; closed
|
|
24
|
+
* when neither can tell. */
|
|
25
|
+
export function isOpraUserScriptsFlagOn() {
|
|
26
|
+
try {
|
|
27
|
+
return (published ?? fallback)?.() === true;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The overlay execution breaker's key (a leaf of utility/chart/overlay-execution-guard.ts; P2/inventory.md section 1.1):
|
|
3
|
+
* the one name the phase 2 run reads besides the breaker's members. The breaker's state stays in its module behind the
|
|
4
|
+
* chart-host members `chart.isOverlayTripped`, `chart.startOverlayMeasure`, `chart.endOverlayMeasure` and
|
|
5
|
+
* `diagnostics.recordPerfSample`; this leaf holds no state and imports nothing, so it moves into the chart-host package
|
|
6
|
+
* with the phase 2 closure. The old module re-exports it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function overlayExecutionGuardKey(chartIndex: number, id: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The overlay execution breaker's key (a leaf of utility/chart/overlay-execution-guard.ts; P2/inventory.md section 1.1):
|
|
3
|
+
* the one name the phase 2 run reads besides the breaker's members. The breaker's state stays in its module behind the
|
|
4
|
+
* chart-host members `chart.isOverlayTripped`, `chart.startOverlayMeasure`, `chart.endOverlayMeasure` and
|
|
5
|
+
* `diagnostics.recordPerfSample`; this leaf holds no state and imports nothing, so it moves into the chart-host package
|
|
6
|
+
* with the phase 2 closure. The old module re-exports it.
|
|
7
|
+
*/
|
|
8
|
+
export function overlayExecutionGuardKey(chartIndex, id) {
|
|
9
|
+
return `${chartIndex}:${id}`;
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hyperliquid prints a HIP-4 outcome price at five decimals — `0.31800` — no
|
|
3
|
+
* matter which size its grouping selector is on. Display precision and
|
|
4
|
+
* grouping granularity are separate concepts on that venue, so the book can
|
|
5
|
+
* aggregate at 0.001 while every price still reads to five places.
|
|
6
|
+
*/
|
|
7
|
+
export declare const HIP4_PRICE_DISPLAY_DECIMALS = 5;
|
|
8
|
+
/**
|
|
9
|
+
* The decimals a venue's prices DISPLAY at, given the decimals that surface
|
|
10
|
+
* would otherwise use. Only HIP-4 overrides them, so Polymarket cents and the
|
|
11
|
+
* adaptive crypto/tradfi axis are untouched.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolvePriceDisplayPrecision(exchange: string | undefined | null, venueDecimals: number): number;
|
|
14
|
+
/**
|
|
15
|
+
* Price-axis precision from the axis step, dust-tolerant.
|
|
16
|
+
*
|
|
17
|
+
* The label precision every chart surface shares (axis ticks via getYLabel,
|
|
18
|
+
* legend digits, price pill) derives from the pane's priceStep. Counting
|
|
19
|
+
* decimals off `step.toString()` explodes when the step carries float dust: a
|
|
20
|
+
* tape-ladder step of 0.01-with-dust stringifies as "0.00999999999999" and
|
|
21
|
+
* the old `decimals + 1` turned that into toFixed(15) across the whole UI
|
|
22
|
+
* (the 65.754999999999995 axis on SIL). The decimal count is now the
|
|
23
|
+
* smallest toFixed round-trip that reproduces the step within a relative
|
|
24
|
+
* epsilon, so dust cannot inflate it.
|
|
25
|
+
* The axis mode keeps its extra decimal; step mode returns only the decimals
|
|
26
|
+
* required to represent an exact profile grid level.
|
|
27
|
+
*/
|
|
28
|
+
export declare function pricePrecisionFromStep(step: number | undefined | null, mode?: 'axis' | 'step'): number;
|
|
29
|
+
/**
|
|
30
|
+
* The decimals the chart's MAIN price scale prints at (axis ticks, crosshair
|
|
31
|
+
* pill, last-price pill, legend). An engine that holds the instrument tick
|
|
32
|
+
* steps that axis on tick multiples and rounds the crosshair to the tick, so
|
|
33
|
+
* the tick's own decimals are exact (ES 2, YM 0, ZN 6) and the axis look's
|
|
34
|
+
* extra decimal would only print dust ("7784.250"). Without a tick the
|
|
35
|
+
* axis-step rule stands. HIP-4's display decimals win either way.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveChartPricePrecision(exchange: string | undefined | null, axisStep: number | undefined | null, priceTick: number | undefined | null): number;
|
|
38
|
+
/** Profile levels use the resolved prediction grid; pending grids use venue display precision. */
|
|
39
|
+
export declare function resolveProfilePricePrecision(exchange: string | undefined | null, blockSize: number | undefined | null, fallbackDigits?: number): number;
|
|
40
|
+
export { formatPriceByMagnitude } from '../number-format.util.js';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { checkIsHip4 } from './marketKind.util.js';
|
|
2
|
+
import { isPredictionExchangeName } from './prediction-identity.util.js';
|
|
3
|
+
import { PREDICTION_PROFILE_MIN_BLOCK_SIZE } from './profile-block-size.util.js';
|
|
4
|
+
/**
|
|
5
|
+
* Hyperliquid prints a HIP-4 outcome price at five decimals — `0.31800` — no
|
|
6
|
+
* matter which size its grouping selector is on. Display precision and
|
|
7
|
+
* grouping granularity are separate concepts on that venue, so the book can
|
|
8
|
+
* aggregate at 0.001 while every price still reads to five places.
|
|
9
|
+
*/
|
|
10
|
+
export const HIP4_PRICE_DISPLAY_DECIMALS = 5;
|
|
11
|
+
/**
|
|
12
|
+
* The decimals a venue's prices DISPLAY at, given the decimals that surface
|
|
13
|
+
* would otherwise use. Only HIP-4 overrides them, so Polymarket cents and the
|
|
14
|
+
* adaptive crypto/tradfi axis are untouched.
|
|
15
|
+
*/
|
|
16
|
+
export function resolvePriceDisplayPrecision(exchange, venueDecimals) {
|
|
17
|
+
return checkIsHip4(exchange) ? HIP4_PRICE_DISPLAY_DECIMALS : venueDecimals;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Price-axis precision from the axis step, dust-tolerant.
|
|
21
|
+
*
|
|
22
|
+
* The label precision every chart surface shares (axis ticks via getYLabel,
|
|
23
|
+
* legend digits, price pill) derives from the pane's priceStep. Counting
|
|
24
|
+
* decimals off `step.toString()` explodes when the step carries float dust: a
|
|
25
|
+
* tape-ladder step of 0.01-with-dust stringifies as "0.00999999999999" and
|
|
26
|
+
* the old `decimals + 1` turned that into toFixed(15) across the whole UI
|
|
27
|
+
* (the 65.754999999999995 axis on SIL). The decimal count is now the
|
|
28
|
+
* smallest toFixed round-trip that reproduces the step within a relative
|
|
29
|
+
* epsilon, so dust cannot inflate it.
|
|
30
|
+
* The axis mode keeps its extra decimal; step mode returns only the decimals
|
|
31
|
+
* required to represent an exact profile grid level.
|
|
32
|
+
*/
|
|
33
|
+
export function pricePrecisionFromStep(step, mode = 'axis') {
|
|
34
|
+
if (typeof step !== 'number' || !Number.isFinite(step) || step <= 0)
|
|
35
|
+
return 2;
|
|
36
|
+
for (let d = 0; d <= 10; d++) {
|
|
37
|
+
if (Math.abs(step - Number(step.toFixed(d))) <= step * 1e-9) {
|
|
38
|
+
if (mode === 'step')
|
|
39
|
+
return d;
|
|
40
|
+
// One extra decimal beyond the step (the pre-existing axis look),
|
|
41
|
+
// floored at the historical default of 2.
|
|
42
|
+
return Math.max(2, Math.min(d + 1, 10));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return 10;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The decimals the chart's MAIN price scale prints at (axis ticks, crosshair
|
|
49
|
+
* pill, last-price pill, legend). An engine that holds the instrument tick
|
|
50
|
+
* steps that axis on tick multiples and rounds the crosshair to the tick, so
|
|
51
|
+
* the tick's own decimals are exact (ES 2, YM 0, ZN 6) and the axis look's
|
|
52
|
+
* extra decimal would only print dust ("7784.250"). Without a tick the
|
|
53
|
+
* axis-step rule stands. HIP-4's display decimals win either way.
|
|
54
|
+
*/
|
|
55
|
+
export function resolveChartPricePrecision(exchange, axisStep, priceTick) {
|
|
56
|
+
const hasTick = typeof priceTick === 'number' && Number.isFinite(priceTick) && priceTick > 0;
|
|
57
|
+
const venueDecimals = hasTick ? pricePrecisionFromStep(priceTick, 'step') : pricePrecisionFromStep(axisStep);
|
|
58
|
+
return resolvePriceDisplayPrecision(exchange, venueDecimals);
|
|
59
|
+
}
|
|
60
|
+
/** Profile levels use the resolved prediction grid; pending grids use venue display precision. */
|
|
61
|
+
export function resolveProfilePricePrecision(exchange, blockSize, fallbackDigits = 2) {
|
|
62
|
+
if (!isPredictionExchangeName(exchange))
|
|
63
|
+
return fallbackDigits;
|
|
64
|
+
return typeof blockSize === 'number' && Number.isFinite(blockSize) && blockSize > 0
|
|
65
|
+
? pricePrecisionFromStep(blockSize, 'step')
|
|
66
|
+
: resolvePriceDisplayPrecision(exchange, pricePrecisionFromStep(PREDICTION_PROFILE_MIN_BLOCK_SIZE, 'step'));
|
|
67
|
+
}
|
|
68
|
+
// The ticker price text lives with the dependency-free number helpers so the tab
|
|
69
|
+
// title can share it without pulling this module's venue imports.
|
|
70
|
+
export { formatPriceByMagnitude } from '../number-format.util.js';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Volume-profile block-size resolution, pure half.
|
|
3
|
+
*
|
|
4
|
+
* The gate advertises exactly ONE block size per instrument
|
|
5
|
+
* (StreamBlockSizes, type VOLUME_PROFILE_AGG) and every VP-family control
|
|
6
|
+
* prices its row grid off it as `minimumBarHeight`. A workspace persists that
|
|
7
|
+
* base, so a server-side block-size change (the CME exchange-tick move: NQ
|
|
8
|
+
* 2.0 -> 0.25) leaves restored overlays pinned to a grid the venue no longer
|
|
9
|
+
* serves. These helpers decide when a freshly served catalog value replaces a
|
|
10
|
+
* persisted base, and render the effective row size the "Ticks per bar"
|
|
11
|
+
* multiplier produces. The impure orchestration (lookup, workspace scan,
|
|
12
|
+
* settings-save lane) lives in profile-block-size-reconcile.util.
|
|
13
|
+
*/
|
|
14
|
+
export declare const PREDICTION_PROFILE_MIN_BLOCK_SIZE = 0.001;
|
|
15
|
+
/** Prediction profiles aggregate on at least a thousandth of probability. */
|
|
16
|
+
export declare function clampProfileBlockSizeForVenue(exchange: string | undefined | null, blockSize: number): number;
|
|
17
|
+
export declare function profileBlockSizeFallbackForVenue(exchange: string | undefined | null): number;
|
|
18
|
+
export declare const DEFAULT_PROFILE_ROWS_COUNT = 24;
|
|
19
|
+
export declare const MIN_PROFILE_ROWS_COUNT = 4;
|
|
20
|
+
export declare const MAX_PROFILE_ROWS_COUNT = 400;
|
|
21
|
+
export interface ProfilePriceRange {
|
|
22
|
+
min: number;
|
|
23
|
+
max: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ProfileRowSettings {
|
|
26
|
+
rowsLayout?: 'ticks' | 'rows';
|
|
27
|
+
rowsCount?: unknown;
|
|
28
|
+
minimumBarHeight?: unknown;
|
|
29
|
+
barHeightMultiplier?: unknown;
|
|
30
|
+
barHeight?: unknown;
|
|
31
|
+
}
|
|
32
|
+
export declare function resolveProfileRowsCount(value: unknown): number;
|
|
33
|
+
/** Price coverage of parsed profile rows: [timestamp, [low, high, buy, sell], ...]. */
|
|
34
|
+
export declare function profilePriceRangeFromRows(rows: unknown): ProfilePriceRange | undefined;
|
|
35
|
+
/** Shared main-thread/worker row height. Missing range data preserves the ticks grid. */
|
|
36
|
+
export declare function resolveProfileRowHeight(settings: ProfileRowSettings, minimumBarHeight: number, priceRange?: ProfilePriceRange): number;
|
|
37
|
+
/**
|
|
38
|
+
* The block size a mounted overlay should adopt, or null when the persisted
|
|
39
|
+
* base already matches the served catalog value (or nothing valid was served).
|
|
40
|
+
* Adoption is symmetric: a venue moving finer (2.0 -> 0.25) and a rollback
|
|
41
|
+
* moving coarser both re-grid; the catalog is the request authority in either
|
|
42
|
+
* direction. An invalid persisted base adopts any valid served value. The
|
|
43
|
+
* relative epsilon ignores float round-trip dust, which must never trigger a
|
|
44
|
+
* re-grid refetch.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveAdoptedProfileBlockSize(servedBlockSize: unknown, persistedMinimumBarHeight: unknown): number | null;
|
|
47
|
+
/**
|
|
48
|
+
* The effective row size the "Ticks per bar" multiplier produces
|
|
49
|
+
* (minimumBarHeight x multiplier), formatted at the base block's precision so
|
|
50
|
+
* 0.25 x 2 reads "0.50" and 2 x 8 reads "16". Null hides the readout
|
|
51
|
+
* (missing/degenerate inputs, e.g. a not-yet-resolved block size).
|
|
52
|
+
*/
|
|
53
|
+
export declare function formatEffectiveProfileRowSize(minimumBarHeight: unknown, multiplier: unknown, rowsSettings?: ProfileRowSettings, priceRange?: ProfilePriceRange): string | null;
|
|
54
|
+
/**
|
|
55
|
+
* The row a "Ticks per bar" multiplier DRAWS, formatted at the precision of
|
|
56
|
+
* the unit it is drawn in. On a footprint over a sparse-tick venue the workers
|
|
57
|
+
* fold on the exchange tick (`priceTick`, the overlay's persisted anchor), so
|
|
58
|
+
* the row is the tick x the multiplier (footprint-tick-grid.util
|
|
59
|
+
* footprintDrawnRowHeight): a block x multiplier readout there showed a row
|
|
60
|
+
* tick/block times smaller than the one drawn (3x on PUMPUSDT). Everywhere
|
|
61
|
+
* else (no anchor, a block at or above the tick, a whole-ratio block) it is
|
|
62
|
+
* `formatEffectiveProfileRowSize`.
|
|
63
|
+
*/
|
|
64
|
+
export declare function formatDrawnProfileRowSize(minimumBarHeight: unknown, multiplier: unknown, priceTick: unknown): string | null;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Volume-profile block-size resolution, pure half.
|
|
3
|
+
*
|
|
4
|
+
* The gate advertises exactly ONE block size per instrument
|
|
5
|
+
* (StreamBlockSizes, type VOLUME_PROFILE_AGG) and every VP-family control
|
|
6
|
+
* prices its row grid off it as `minimumBarHeight`. A workspace persists that
|
|
7
|
+
* base, so a server-side block-size change (the CME exchange-tick move: NQ
|
|
8
|
+
* 2.0 -> 0.25) leaves restored overlays pinned to a grid the venue no longer
|
|
9
|
+
* serves. These helpers decide when a freshly served catalog value replaces a
|
|
10
|
+
* persisted base, and render the effective row size the "Ticks per bar"
|
|
11
|
+
* multiplier produces. The impure orchestration (lookup, workspace scan,
|
|
12
|
+
* settings-save lane) lives in profile-block-size-reconcile.util.
|
|
13
|
+
*/
|
|
14
|
+
import { isPredictionExchangeName } from './prediction-identity.util.js';
|
|
15
|
+
import { footprintDrawnRowHeight, isSparseTickVenue } from './footprint-tick-grid.util.js';
|
|
16
|
+
export const PREDICTION_PROFILE_MIN_BLOCK_SIZE = 0.001;
|
|
17
|
+
/** Prediction profiles aggregate on at least a thousandth of probability. */
|
|
18
|
+
export function clampProfileBlockSizeForVenue(exchange, blockSize) {
|
|
19
|
+
return isPredictionExchangeName(exchange) ? Math.max(blockSize, PREDICTION_PROFILE_MIN_BLOCK_SIZE) : blockSize;
|
|
20
|
+
}
|
|
21
|
+
export function profileBlockSizeFallbackForVenue(exchange) {
|
|
22
|
+
return isPredictionExchangeName(exchange) ? PREDICTION_PROFILE_MIN_BLOCK_SIZE : 1;
|
|
23
|
+
}
|
|
24
|
+
const MAX_ROW_SIZE_DECIMALS = 15;
|
|
25
|
+
export const DEFAULT_PROFILE_ROWS_COUNT = 24;
|
|
26
|
+
export const MIN_PROFILE_ROWS_COUNT = 4;
|
|
27
|
+
export const MAX_PROFILE_ROWS_COUNT = 400;
|
|
28
|
+
export function resolveProfileRowsCount(value) {
|
|
29
|
+
return typeof value === 'number' && Number.isFinite(value)
|
|
30
|
+
? Math.max(MIN_PROFILE_ROWS_COUNT, Math.min(MAX_PROFILE_ROWS_COUNT, Math.round(value)))
|
|
31
|
+
: DEFAULT_PROFILE_ROWS_COUNT;
|
|
32
|
+
}
|
|
33
|
+
function isPositiveFinite(value) {
|
|
34
|
+
return typeof value === 'number' && Number.isFinite(value) && value > 0;
|
|
35
|
+
}
|
|
36
|
+
/** Price coverage of parsed profile rows: [timestamp, [low, high, buy, sell], ...]. */
|
|
37
|
+
export function profilePriceRangeFromRows(rows) {
|
|
38
|
+
if (!Array.isArray(rows))
|
|
39
|
+
return undefined;
|
|
40
|
+
let min = Infinity;
|
|
41
|
+
let max = -Infinity;
|
|
42
|
+
for (const row of rows) {
|
|
43
|
+
if (!Array.isArray(row))
|
|
44
|
+
continue;
|
|
45
|
+
for (let i = 1; i < row.length; i++) {
|
|
46
|
+
const bucket = row[i];
|
|
47
|
+
if (!Array.isArray(bucket))
|
|
48
|
+
continue;
|
|
49
|
+
const [low, high] = bucket;
|
|
50
|
+
if (typeof low !== 'number' || typeof high !== 'number')
|
|
51
|
+
continue;
|
|
52
|
+
if (!Number.isFinite(low) || !Number.isFinite(high) || high <= low)
|
|
53
|
+
continue;
|
|
54
|
+
min = Math.min(min, low);
|
|
55
|
+
max = Math.max(max, high);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return max > min ? { min, max } : undefined;
|
|
59
|
+
}
|
|
60
|
+
/** Shared main-thread/worker row height. Missing range data preserves the ticks grid. */
|
|
61
|
+
export function resolveProfileRowHeight(settings, minimumBarHeight, priceRange) {
|
|
62
|
+
if (settings.rowsLayout === 'rows' &&
|
|
63
|
+
priceRange &&
|
|
64
|
+
Number.isFinite(priceRange.min) &&
|
|
65
|
+
Number.isFinite(priceRange.max) &&
|
|
66
|
+
priceRange.max > priceRange.min) {
|
|
67
|
+
const multiple = Math.max(1, Math.round((priceRange.max - priceRange.min) / resolveProfileRowsCount(settings.rowsCount) / minimumBarHeight));
|
|
68
|
+
const height = minimumBarHeight * multiple;
|
|
69
|
+
if (isPositiveFinite(height))
|
|
70
|
+
return height;
|
|
71
|
+
}
|
|
72
|
+
const multiplier = isPositiveFinite(settings.barHeightMultiplier)
|
|
73
|
+
? settings.barHeightMultiplier
|
|
74
|
+
: isPositiveFinite(settings.barHeight) && isPositiveFinite(settings.minimumBarHeight)
|
|
75
|
+
? settings.barHeight / settings.minimumBarHeight
|
|
76
|
+
: 1;
|
|
77
|
+
return minimumBarHeight * multiplier;
|
|
78
|
+
}
|
|
79
|
+
/** Decimal places of a positive block size, exponent notation included, capped
|
|
80
|
+
* at MAX_ROW_SIZE_DECIMALS. Local on purpose: this module must stay importable
|
|
81
|
+
* without the titan-charts dependency its consumers may have mocked away. */
|
|
82
|
+
function decimalPlacesOf(value) {
|
|
83
|
+
const text = String(value);
|
|
84
|
+
const exponentMatch = text.match(/e-(\d+)$/i);
|
|
85
|
+
if (exponentMatch) {
|
|
86
|
+
const mantissaDecimals = text.split('.')[1]?.split(/e/i)[0]?.length ?? 0;
|
|
87
|
+
return Math.min(Number(exponentMatch[1]) + mantissaDecimals, MAX_ROW_SIZE_DECIMALS);
|
|
88
|
+
}
|
|
89
|
+
const dot = text.indexOf('.');
|
|
90
|
+
return dot === -1 ? 0 : Math.min(text.length - dot - 1, MAX_ROW_SIZE_DECIMALS);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The block size a mounted overlay should adopt, or null when the persisted
|
|
94
|
+
* base already matches the served catalog value (or nothing valid was served).
|
|
95
|
+
* Adoption is symmetric: a venue moving finer (2.0 -> 0.25) and a rollback
|
|
96
|
+
* moving coarser both re-grid; the catalog is the request authority in either
|
|
97
|
+
* direction. An invalid persisted base adopts any valid served value. The
|
|
98
|
+
* relative epsilon ignores float round-trip dust, which must never trigger a
|
|
99
|
+
* re-grid refetch.
|
|
100
|
+
*/
|
|
101
|
+
export function resolveAdoptedProfileBlockSize(servedBlockSize, persistedMinimumBarHeight) {
|
|
102
|
+
if (!isPositiveFinite(servedBlockSize))
|
|
103
|
+
return null;
|
|
104
|
+
if (!isPositiveFinite(persistedMinimumBarHeight))
|
|
105
|
+
return servedBlockSize;
|
|
106
|
+
const scale = Math.max(servedBlockSize, persistedMinimumBarHeight);
|
|
107
|
+
return Math.abs(servedBlockSize - persistedMinimumBarHeight) > scale * 1e-9 ? servedBlockSize : null;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The effective row size the "Ticks per bar" multiplier produces
|
|
111
|
+
* (minimumBarHeight x multiplier), formatted at the base block's precision so
|
|
112
|
+
* 0.25 x 2 reads "0.50" and 2 x 8 reads "16". Null hides the readout
|
|
113
|
+
* (missing/degenerate inputs, e.g. a not-yet-resolved block size).
|
|
114
|
+
*/
|
|
115
|
+
export function formatEffectiveProfileRowSize(minimumBarHeight, multiplier, rowsSettings, priceRange) {
|
|
116
|
+
if (isPositiveFinite(minimumBarHeight) && rowsSettings?.rowsLayout === 'rows') {
|
|
117
|
+
const height = resolveProfileRowHeight({ ...rowsSettings, minimumBarHeight, barHeightMultiplier: multiplier }, minimumBarHeight, priceRange);
|
|
118
|
+
return isPositiveFinite(height) ? height.toFixed(decimalPlacesOf(minimumBarHeight)) : null;
|
|
119
|
+
}
|
|
120
|
+
if (!isPositiveFinite(minimumBarHeight) || !isPositiveFinite(multiplier))
|
|
121
|
+
return null;
|
|
122
|
+
return (minimumBarHeight * multiplier).toFixed(decimalPlacesOf(minimumBarHeight));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The row a "Ticks per bar" multiplier DRAWS, formatted at the precision of
|
|
126
|
+
* the unit it is drawn in. On a footprint over a sparse-tick venue the workers
|
|
127
|
+
* fold on the exchange tick (`priceTick`, the overlay's persisted anchor), so
|
|
128
|
+
* the row is the tick x the multiplier (footprint-tick-grid.util
|
|
129
|
+
* footprintDrawnRowHeight): a block x multiplier readout there showed a row
|
|
130
|
+
* tick/block times smaller than the one drawn (3x on PUMPUSDT). Everywhere
|
|
131
|
+
* else (no anchor, a block at or above the tick, a whole-ratio block) it is
|
|
132
|
+
* `formatEffectiveProfileRowSize`.
|
|
133
|
+
*/
|
|
134
|
+
export function formatDrawnProfileRowSize(minimumBarHeight, multiplier, priceTick) {
|
|
135
|
+
if (!isPositiveFinite(minimumBarHeight) || !isPositiveFinite(multiplier))
|
|
136
|
+
return null;
|
|
137
|
+
if (!isSparseTickVenue(minimumBarHeight, priceTick))
|
|
138
|
+
return formatEffectiveProfileRowSize(minimumBarHeight, multiplier);
|
|
139
|
+
const height = footprintDrawnRowHeight(minimumBarHeight, multiplier, priceTick);
|
|
140
|
+
return height === null ? null : height.toFixed(decimalPlacesOf(priceTick));
|
|
141
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The degenerate-rows check of a protected kScript result (a leaf of services/protected-kscript-cache.service.ts;
|
|
3
|
+
* P2/inventory.md section 1.1): the one rule the integration decision leaf reads to refuse a merge onto a zombie
|
|
4
|
+
* mount. It holds no state and imports nothing, so it moves into the chart-host package with the phase 2 closure;
|
|
5
|
+
* the cache service re-exports it and keeps its cache.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* True when a row array is non-empty but its timeline is unusable: no finite
|
|
9
|
+
* timestamps at all, or a first bar before any plausible market data epoch.
|
|
10
|
+
*/
|
|
11
|
+
export declare function protectedKScriptRowsLookDegenerate(rows: unknown): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The degenerate-rows check of a protected kScript result (a leaf of services/protected-kscript-cache.service.ts;
|
|
3
|
+
* P2/inventory.md section 1.1): the one rule the integration decision leaf reads to refuse a merge onto a zombie
|
|
4
|
+
* mount. It holds no state and imports nothing, so it moves into the chart-host package with the phase 2 closure;
|
|
5
|
+
* the cache service re-exports it and keeps its cache.
|
|
6
|
+
*/
|
|
7
|
+
// A real result's first bar is never epoch-adjacent; rows that start before
|
|
8
|
+
// this were produced by a broken integration (the 2026-07-02 wire-contract
|
|
9
|
+
// window wrote such results) and must never be cached or merged against.
|
|
10
|
+
const DEGENERATE_ROW_TS_FLOOR_MS = Date.UTC(2001, 0, 1);
|
|
11
|
+
/**
|
|
12
|
+
* True when a row array is non-empty but its timeline is unusable: no finite
|
|
13
|
+
* timestamps at all, or a first bar before any plausible market data epoch.
|
|
14
|
+
*/
|
|
15
|
+
export function protectedKScriptRowsLookDegenerate(rows) {
|
|
16
|
+
if (!Array.isArray(rows) || rows.length === 0)
|
|
17
|
+
return false;
|
|
18
|
+
let firstFinite = Number.POSITIVE_INFINITY;
|
|
19
|
+
for (const row of rows) {
|
|
20
|
+
if (!Array.isArray(row))
|
|
21
|
+
continue;
|
|
22
|
+
const time = Number(row[0]);
|
|
23
|
+
if (Number.isFinite(time))
|
|
24
|
+
firstFinite = Math.min(firstFinite, time);
|
|
25
|
+
}
|
|
26
|
+
if (!Number.isFinite(firstFinite))
|
|
27
|
+
return true;
|
|
28
|
+
return firstFinite < DEGENERATE_ROW_TS_FLOOR_MS;
|
|
29
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Total row entries in a run output (top-level data + nested plot data, or a
|
|
2
|
+
* canonical outputs record). Untimed payload rows (e.g. viewport mini-chart
|
|
3
|
+
* `[null, payload]`) count as rows. Canonical support exists so the Phase 1
|
|
4
|
+
* funnel flip (KSCRIPT_SHAPE_UNIFICATION_PLAN.md) cannot make canonical
|
|
5
|
+
* arrivals read as empty and loop the retry ladder. */
|
|
6
|
+
export declare function protectedKScriptRunOutputRowCount(runOutput: unknown): number;
|
|
7
|
+
/** Total mounted row entries on the overlay metadata (top-level rawData + nested
|
|
8
|
+
* rawData/activeData/data). Nested plots may hold all the rows while the
|
|
9
|
+
* top-level rawData stays empty (e.g. multi-line VWAP suites). */
|
|
10
|
+
export declare function protectedKScriptMountedRowCount(meta: unknown): number;
|
|
11
|
+
export interface ProtectedKScriptEmptyOutputSkip {
|
|
12
|
+
skip: boolean;
|
|
13
|
+
reason: 'missing-output' | 'polling' | 'blocking-diagnostics' | 'has-rows' | 'nothing-mounted' | 'empty-output-after-wipe-retained' | 'empty-output-mounted-retained';
|
|
14
|
+
incomingRows: number;
|
|
15
|
+
mountedRows: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function getProtectedKScriptEmptyOutputRetrySkip(args: {
|
|
18
|
+
runOutput: unknown;
|
|
19
|
+
meta: unknown;
|
|
20
|
+
isPolling?: boolean;
|
|
21
|
+
hasBlockingDiagnostics?: boolean;
|
|
22
|
+
/** Mounted rows a refetch wipe destroyed just before this fetch (0 or
|
|
23
|
+
* absent when no wipe is pending for this overlay and identity). Refetch
|
|
24
|
+
* lanes wipe BEFORE fetching, which zeroes the live mounted count and
|
|
25
|
+
* would otherwise disarm the retain branch for exactly the replies the
|
|
26
|
+
* guard exists to catch; the caller's pre-wipe ledger restores the truth. */
|
|
27
|
+
wipedMountedRows?: number;
|
|
28
|
+
}): ProtectedKScriptEmptyOutputSkip;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Empty protected-script results must not finalize a fetch when the overlay
|
|
2
|
+
// already has mounted rows. The backend ships init failures (upstream fetch
|
|
3
|
+
// starvation, worker-pool shedding, cold-create clamp misses) as a well-formed
|
|
4
|
+
// `type:"result"` whose outputs carry ZERO rows; integrating that as success
|
|
5
|
+
// records a fetch-cache completion, writes the empty payload into the IDB
|
|
6
|
+
// result cache, and re-keys the lazy identity, so the overlay silently stops
|
|
7
|
+
// extending and every gap-repair attempt is spent on a no-op (prod incident
|
|
8
|
+
// 2026-07-02: anchored VWAP froze to its last mounted slice after an interval
|
|
9
|
+
// change while the backend returned empty createScript results for ~75s).
|
|
10
|
+
// Treat those results like transport failures instead: keep the mounted rows,
|
|
11
|
+
// leave the fetch un-completed so the existing refresh/gap-repair ladder can
|
|
12
|
+
// retry, and skip the cache write.
|
|
13
|
+
function rowCount(rows) {
|
|
14
|
+
return Array.isArray(rows) ? rows.length : 0;
|
|
15
|
+
}
|
|
16
|
+
function nestedEntries(nestedMeta) {
|
|
17
|
+
if (!Array.isArray(nestedMeta))
|
|
18
|
+
return [];
|
|
19
|
+
return nestedMeta.filter((entry) => typeof entry === 'object' && entry !== null);
|
|
20
|
+
}
|
|
21
|
+
/** Total row entries in a run output (top-level data + nested plot data, or a
|
|
22
|
+
* canonical outputs record). Untimed payload rows (e.g. viewport mini-chart
|
|
23
|
+
* `[null, payload]`) count as rows. Canonical support exists so the Phase 1
|
|
24
|
+
* funnel flip (KSCRIPT_SHAPE_UNIFICATION_PLAN.md) cannot make canonical
|
|
25
|
+
* arrivals read as empty and loop the retry ladder. */
|
|
26
|
+
export function protectedKScriptRunOutputRowCount(runOutput) {
|
|
27
|
+
if (!runOutput || typeof runOutput !== 'object')
|
|
28
|
+
return 0;
|
|
29
|
+
const output = runOutput;
|
|
30
|
+
let total = rowCount(output.data);
|
|
31
|
+
for (const nested of nestedEntries(output.nestedMeta)) {
|
|
32
|
+
total += rowCount(nested.data);
|
|
33
|
+
}
|
|
34
|
+
if (output.outputs && typeof output.outputs === 'object' && !Array.isArray(output.outputs)) {
|
|
35
|
+
for (const entry of Object.values(output.outputs)) {
|
|
36
|
+
if (typeof entry === 'object' && entry !== null) {
|
|
37
|
+
total += rowCount(entry.data);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return total;
|
|
42
|
+
}
|
|
43
|
+
/** Total mounted row entries on the overlay metadata (top-level rawData + nested
|
|
44
|
+
* rawData/activeData/data). Nested plots may hold all the rows while the
|
|
45
|
+
* top-level rawData stays empty (e.g. multi-line VWAP suites). */
|
|
46
|
+
export function protectedKScriptMountedRowCount(meta) {
|
|
47
|
+
if (!meta || typeof meta !== 'object')
|
|
48
|
+
return 0;
|
|
49
|
+
const carrier = meta;
|
|
50
|
+
let total = rowCount(carrier.rawData);
|
|
51
|
+
for (const nested of nestedEntries(carrier.nestedMeta)) {
|
|
52
|
+
total += rowCount(nested.rawData ?? nested.activeData ?? nested.data);
|
|
53
|
+
}
|
|
54
|
+
return total;
|
|
55
|
+
}
|
|
56
|
+
export function getProtectedKScriptEmptyOutputRetrySkip(args) {
|
|
57
|
+
const incomingRows = protectedKScriptRunOutputRowCount(args.runOutput);
|
|
58
|
+
const mountedRows = protectedKScriptMountedRowCount(args.meta);
|
|
59
|
+
const base = { incomingRows, mountedRows };
|
|
60
|
+
if (!args.runOutput || typeof args.runOutput !== 'object') {
|
|
61
|
+
return { skip: false, reason: 'missing-output', ...base };
|
|
62
|
+
}
|
|
63
|
+
// Polling top-ups legitimately return nothing new.
|
|
64
|
+
if (args.isPolling === true)
|
|
65
|
+
return { skip: false, reason: 'polling', ...base };
|
|
66
|
+
// A result carrying error diagnostics must reach the diagnostic display path.
|
|
67
|
+
if (args.hasBlockingDiagnostics === true) {
|
|
68
|
+
return { skip: false, reason: 'blocking-diagnostics', ...base };
|
|
69
|
+
}
|
|
70
|
+
if (incomingRows > 0)
|
|
71
|
+
return { skip: false, reason: 'has-rows', ...base };
|
|
72
|
+
if (mountedRows === 0) {
|
|
73
|
+
// A refetch wipe emptied this overlay moments ago: the blank is the
|
|
74
|
+
// wipe's doing, not evidence of a bar-less window. Retain (skip) so the
|
|
75
|
+
// empty reply stays retryable instead of committing and caching.
|
|
76
|
+
if ((args.wipedMountedRows ?? 0) > 0) {
|
|
77
|
+
return { skip: true, reason: 'empty-output-after-wipe-retained', ...base };
|
|
78
|
+
}
|
|
79
|
+
// Nothing mounted yet: an empty first result keeps the current semantics
|
|
80
|
+
// (complete + empty overlay) so a genuinely bar-less window cannot loop.
|
|
81
|
+
return { skip: false, reason: 'nothing-mounted', ...base };
|
|
82
|
+
}
|
|
83
|
+
return { skip: true, reason: 'empty-output-mounted-retained', ...base };
|
|
84
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether one candle ask at the chart's venue and symbol cannot stand in for the chart's own
|
|
3
|
+
* series on either lane, so the overlay keeps the template path (a wrun twin its package path),
|
|
4
|
+
* which consumes the chart's transformed main candles: a formula chart (several legs, BTC/ETH or a
|
|
5
|
+
* spread: a run-interval fetch would ask the first leg alone and compute on BTC) or a prediction
|
|
6
|
+
* market (event-sparse candles the chart's own request gap-fills). The wrun twins' whole predicate
|
|
7
|
+
* (isWrunRunIntervalUnsupportedMarket).
|
|
8
|
+
*/
|
|
9
|
+
export declare function isRunIntervalUnservableMarket(exchange: string | undefined, transformations: string | null | undefined): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a market cannot be served at another run interval (a leaf of utility/chart/overlay-run-interval.util.ts;
|
|
3
|
+
* P2/inventory.md section 1.1), the name the run-interval module reads. It reads package modules only, so it moves into
|
|
4
|
+
* the chart-host package with the phase 2 closure. The old module re-exports it.
|
|
5
|
+
*/
|
|
6
|
+
import { isPredictionExchangeName } from './prediction-identity.util.js';
|
|
7
|
+
import { parsedTransformations } from '../common/transformations.util.js';
|
|
8
|
+
/**
|
|
9
|
+
* Whether one candle ask at the chart's venue and symbol cannot stand in for the chart's own
|
|
10
|
+
* series on either lane, so the overlay keeps the template path (a wrun twin its package path),
|
|
11
|
+
* which consumes the chart's transformed main candles: a formula chart (several legs, BTC/ETH or a
|
|
12
|
+
* spread: a run-interval fetch would ask the first leg alone and compute on BTC) or a prediction
|
|
13
|
+
* market (event-sparse candles the chart's own request gap-fills). The wrun twins' whole predicate
|
|
14
|
+
* (isWrunRunIntervalUnsupportedMarket).
|
|
15
|
+
*/
|
|
16
|
+
export function isRunIntervalUnservableMarket(exchange, transformations) {
|
|
17
|
+
if (isPredictionExchangeName(exchange))
|
|
18
|
+
return true;
|
|
19
|
+
return typeof transformations === 'string' && parsedTransformations(transformations).length > 1;
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Floor of the warm-up fetched before the run bar holding the chart's first loaded bar, in run bars. */
|
|
2
|
+
export declare const RUN_INTERVAL_WARMUP_BARS = 300;
|
|
3
|
+
/**
|
|
4
|
+
* Warm-up per declared lookback bar. Smoothed series settle geometrically: measured on the real
|
|
5
|
+
* engine (2026-10-01), RSI(14) on 300 run bars of warm-up is within 1.3e-8 of a full-history
|
|
6
|
+
* run at the first chart bar, RSI(50) still 0.058 off; about 16 x period reaches 1e-6.
|
|
7
|
+
*/
|
|
8
|
+
export declare const RUN_INTERVAL_WARMUP_BARS_PER_LOOKBACK_BAR = 16;
|
|
9
|
+
/** Cap of the warm-up, and of the chart part of one run-interval rebuild, in run bars. */
|
|
10
|
+
export declare const RUN_INTERVAL_MAX_RUN_BARS = 5000;
|
|
11
|
+
export declare function isFiniteNumber(value: unknown): value is number;
|
|
12
|
+
/**
|
|
13
|
+
* Warm-up run bars for a script's declared lookback (in run bars: the script runs at the run
|
|
14
|
+
* interval): RUN_INTERVAL_WARMUP_BARS_PER_LOOKBACK_BAR per lookback bar, at least
|
|
15
|
+
* RUN_INTERVAL_WARMUP_BARS, at most RUN_INTERVAL_MAX_RUN_BARS. An unknown lookback reads the floor.
|
|
16
|
+
*/
|
|
17
|
+
export declare function runIntervalWarmupBars(lookbackBars: number | null | undefined): number;
|
|
18
|
+
/** Open of the first warm-up run bar: `warmupBars` run bars below the run bar holding `chartFirstTs`. */
|
|
19
|
+
export declare function runIntervalWarmupStartTs(chartFirstTs: number, runMs: number, warmupBars: number): number;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run-interval warm-up (a leaf of utility/chart/run-interval-engine.util.ts; P2/inventory.md section 1.1): how many
|
|
3
|
+
* bars a run at another interval warms up and where that warm-up starts, the names the run-interval session and the
|
|
4
|
+
* run-interval module read. Pure arithmetic over its arguments and the range leaf's bar cap, no state, so it moves into
|
|
5
|
+
* the chart-host package with the phase 2 closure. The old module re-exports it.
|
|
6
|
+
*/
|
|
7
|
+
import { LOCAL_TECHNICAL_SCRIPT_MAX_REPLAY_BARS } from './local-technical-script-range.leaf.js';
|
|
8
|
+
/** Floor of the warm-up fetched before the run bar holding the chart's first loaded bar, in run bars. */
|
|
9
|
+
export const RUN_INTERVAL_WARMUP_BARS = 300;
|
|
10
|
+
/**
|
|
11
|
+
* Warm-up per declared lookback bar. Smoothed series settle geometrically: measured on the real
|
|
12
|
+
* engine (2026-10-01), RSI(14) on 300 run bars of warm-up is within 1.3e-8 of a full-history
|
|
13
|
+
* run at the first chart bar, RSI(50) still 0.058 off; about 16 x period reaches 1e-6.
|
|
14
|
+
*/
|
|
15
|
+
export const RUN_INTERVAL_WARMUP_BARS_PER_LOOKBACK_BAR = 16;
|
|
16
|
+
/** Cap of the warm-up, and of the chart part of one run-interval rebuild, in run bars. */
|
|
17
|
+
export const RUN_INTERVAL_MAX_RUN_BARS = LOCAL_TECHNICAL_SCRIPT_MAX_REPLAY_BARS;
|
|
18
|
+
export function isFiniteNumber(value) {
|
|
19
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Warm-up run bars for a script's declared lookback (in run bars: the script runs at the run
|
|
23
|
+
* interval): RUN_INTERVAL_WARMUP_BARS_PER_LOOKBACK_BAR per lookback bar, at least
|
|
24
|
+
* RUN_INTERVAL_WARMUP_BARS, at most RUN_INTERVAL_MAX_RUN_BARS. An unknown lookback reads the floor.
|
|
25
|
+
*/
|
|
26
|
+
export function runIntervalWarmupBars(lookbackBars) {
|
|
27
|
+
if (!isFiniteNumber(lookbackBars) || lookbackBars <= 0)
|
|
28
|
+
return RUN_INTERVAL_WARMUP_BARS;
|
|
29
|
+
const scaled = Math.ceil(lookbackBars) * RUN_INTERVAL_WARMUP_BARS_PER_LOOKBACK_BAR;
|
|
30
|
+
return Math.min(RUN_INTERVAL_MAX_RUN_BARS, Math.max(RUN_INTERVAL_WARMUP_BARS, scaled));
|
|
31
|
+
}
|
|
32
|
+
/** Open of the first warm-up run bar: `warmupBars` run bars below the run bar holding `chartFirstTs`. */
|
|
33
|
+
export function runIntervalWarmupStartTs(chartFirstTs, runMs, warmupBars) {
|
|
34
|
+
return Math.floor(chartFirstTs / runMs) * runMs - warmupBars * runMs;
|
|
35
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Byte-for-byte copies of the
|
|
3
|
-
* `findMonday`, `TimeIntervalConstant`, `MIN_GRID_HEIGHT_ALLOWED`), in a leaf with no import: the
|
|
4
|
-
* refuses every titan edge (scripts/wrun-chart-host-extract.mjs), so a module that moves into the
|
|
5
|
-
* reads these instead of the engine's. tests/utility/chart/titan-constants.pin.spec.ts compares them
|
|
6
|
-
* engine's (values
|
|
2
|
+
* Byte-for-byte copies of the four titan constants package-bound code reads (`@orangecharts/titan-charts-next/constants`
|
|
3
|
+
* `findMonday`, `TimeIntervalConstant`, `MIN_GRID_HEIGHT_ALLOWED`, `getDecimalPlaces`), in a leaf with no import: the
|
|
4
|
+
* extraction walker refuses every titan edge (scripts/wrun-chart-host-extract.mjs), so a module that moves into the
|
|
5
|
+
* chart-host package reads these instead of the engine's. tests/utility/chart/titan-constants.pin.spec.ts compares them
|
|
6
|
+
* with the installed engine's (values, 200 sampled timestamps and 200 sampled numbers), and
|
|
7
|
+
* src/utility/wrun/wrun-chart-host-type-pins.ts pins their types.
|
|
7
8
|
*/
|
|
8
9
|
/** The UTC midnight of the Monday that starts the week holding `unixTimeStamp` (ms). */
|
|
9
10
|
export declare function findMonday(unixTimeStamp: number): number;
|
|
@@ -41,3 +42,6 @@ export declare const TimeIntervalConstant: {
|
|
|
41
42
|
};
|
|
42
43
|
/** The smallest grid height share a pane may take (the engine's split floor). */
|
|
43
44
|
export declare const MIN_GRID_HEIGHT_ALLOWED = 0.13;
|
|
45
|
+
/** The decimal places of `num`: the digits right of its decimal point, less a scientific-notation exponent (titan
|
|
46
|
+
* 0.0.4-alpha.1136 src/utils/price.ts). */
|
|
47
|
+
export declare function getDecimalPlaces(num: number): number;
|