@orangecharts/wrun-chart-host 0.4.0 → 0.6.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 +17 -5
- package/dist/constants/exchange-names.leaf.d.ts +8 -0
- package/dist/constants/exchange-names.leaf.js +101 -0
- package/dist/constants/feature-flags.constants.js +7 -2
- 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/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 +301 -22
- package/dist/host-env.js +15 -0
- package/dist/host-ports.types.d.ts +853 -29
- package/dist/index.d.ts +140 -2
- package/dist/index.js +140 -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/interfaces/wrun-runtime.interface.d.ts +88 -13
- package/dist/interfaces/wrun-runtime.interface.js +17 -3
- 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 +17 -0
- package/dist/utility/chart/chart-mount-epoch.util.js +61 -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/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/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/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/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/series.js +2 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +4 -4
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +5 -6
- 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 +94 -0
- package/dist/utility/wrun/wrun-bar-count.util.js +274 -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 +330 -0
- package/dist/utility/wrun/wrun-host.service.js +855 -0
- package/dist/utility/wrun/wrun-hover.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-hover.util.js +25 -4
- 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-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-pack.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +24 -9
- package/dist/utility/wrun/wrun-panel-mount.util.js +138 -43
- 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-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-registry-errors.util.d.ts +5 -3
- 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-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-sha256.leaf.d.ts +13 -0
- package/dist/utility/wrun/wrun-sha256.leaf.js +84 -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 +203 -0
- package/dist/workers/wrun/wrun-abi-host.js +1220 -0
- package/dist/workers/wrun/wrun-engine-handler.d.ts +20 -0
- package/dist/workers/wrun/wrun-engine-handler.js +380 -0
- package/package.json +3 -3
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alert-armable outputs of the mounted browser-run Indicator overlays, by
|
|
3
|
+
* overlay id. The registry loader stamps an overlay's package metadata here
|
|
4
|
+
* at mount (add, rehydrate, draft re-run); the alert resolver reads it to
|
|
5
|
+
* build the Indicator target's output picker.
|
|
6
|
+
*
|
|
7
|
+
* Rules are anchored server-side by output NAME, so each entry carries the
|
|
8
|
+
* metadata name as the stable identity (`outputKey` = name, `outputColumn`
|
|
9
|
+
* = 1) and as its `label`: the hosted engine labels the series by name and
|
|
10
|
+
* refuses a threshold rule whose `outputLabel` says otherwise. The sheet's
|
|
11
|
+
* own display `label` rides beside it as `displayLabel`, for the pickers
|
|
12
|
+
* only (displayOutputLabel). Data-only outputs (`plot: ''`) are never
|
|
13
|
+
* armable and are excluded here, mirroring the server's own list, and so are
|
|
14
|
+
* guides (`role: "guide"`): a guide is the kScript hline it stands for, one
|
|
15
|
+
* constant level, which the kScript lane never offers either. Two more sheet
|
|
16
|
+
* facts ride for the resolver's offer: `transparent` (a line declared
|
|
17
|
+
* `opacity: 0`, drawn clear: a fill's edge) and `displacement` (the declared
|
|
18
|
+
* bar shift, read against the armed params there).
|
|
19
|
+
*
|
|
20
|
+
* A strategy package (a sheet that declares `strategy`, OM-WRUN3-STRATEGIES-
|
|
21
|
+
* CONTRACT section 5) adds four host-published entries after its outputs,
|
|
22
|
+
* the same ones the hosted alerts engine evaluates: the two event streams
|
|
23
|
+
* (`strategy.order`, a pending order that did not exist before the bar's
|
|
24
|
+
* finalize(); `strategy.fill`, a trade opened or closed by the bar's fills;
|
|
25
|
+
* both fire on confirmed bars only) and the two reserved outputs
|
|
26
|
+
* (`strategy.position`, the signed position after the bar's fills;
|
|
27
|
+
* `strategy.equity`), addressable by name like any output. They never enter
|
|
28
|
+
* the module's output count, so their `index` continues after the declared
|
|
29
|
+
* outputs and `kind` tells them apart from a plotted output.
|
|
30
|
+
*
|
|
31
|
+
* A sheet's declared alerts (`alerts: [{ name, when, message?, description?,
|
|
32
|
+
* text?, every_bar? }]`, the kit's `alert(name, { when: handle, message })`
|
|
33
|
+
* declaration over an output the module already writes, data-only allowed)
|
|
34
|
+
* are stamped beside the armable outputs as alert CONDITIONS: the form lists
|
|
35
|
+
* them as `signal:<name>` options and the arm sends a `kind: 'signal'` rule
|
|
36
|
+
* whose `conditionTitle` is the declared name; the hosted engine fires on
|
|
37
|
+
* the `when` output's false to true flip (or on every bar it holds when the
|
|
38
|
+
* declaration or the user says `every_bar`) and refuses an undeclared title
|
|
39
|
+
* with 422 UNKNOWN_CONDITION. The two scaffold-37 facts ride along so the
|
|
40
|
+
* arm form can say what will fire and what the message will be: `text`
|
|
41
|
+
* names the declared string slot whose fired-row value is the fire text,
|
|
42
|
+
* `every_bar` the author's firing default. They never enter the output
|
|
43
|
+
* entries: the `when` output stays armable (or data-only) on its own terms.
|
|
44
|
+
* A declared `title` (frozen authoring contract C1.8: display text with
|
|
45
|
+
* spaces beside the slug name) rides as the entry's `label`: the picker
|
|
46
|
+
* lists it, the arm stamps it as the signal rule's `outputLabel`, and the
|
|
47
|
+
* cards and fired notifications show it. The entry's `title` stays the
|
|
48
|
+
* name, the `conditionTitle` every option, edit and armed rule is keyed by,
|
|
49
|
+
* so arms made before titles existed keep matching.
|
|
50
|
+
*
|
|
51
|
+
* Leaf module (no imports) so the resolver stays node-testable without the
|
|
52
|
+
* wasm host or the chart instance in its graph; the four names mirror the
|
|
53
|
+
* SDK's WRUN3_STRATEGY_EVENT_STREAMS and WRUN3_STRATEGY_RESERVED_OUTPUTS.
|
|
54
|
+
*/
|
|
55
|
+
type WrunAlertOutputKind = 'output' | 'event' | 'reserved';
|
|
56
|
+
export interface WrunAlertOutputEntry {
|
|
57
|
+
index: number;
|
|
58
|
+
label: string;
|
|
59
|
+
outputKey: string;
|
|
60
|
+
outputColumn: number;
|
|
61
|
+
panel?: string;
|
|
62
|
+
/** A declared plotted output (absent = 'output'), a strategy event
|
|
63
|
+
* stream, or a host-published reserved strategy output. */
|
|
64
|
+
kind?: WrunAlertOutputKind;
|
|
65
|
+
/** The sheet's display `label` when it says something the name does not:
|
|
66
|
+
* what the pickers show. Never on a rule (see `label`). */
|
|
67
|
+
displayLabel?: string;
|
|
68
|
+
/** Declared `opacity: 0`: a line drawn clear (a fill's edge). */
|
|
69
|
+
transparent?: true;
|
|
70
|
+
/** The declared bar shift as the sheet states it (`displacement_bars`,
|
|
71
|
+
* `displacement_bars_by`); the resolver reads it against the armed params. */
|
|
72
|
+
displacement?: {
|
|
73
|
+
bars?: number;
|
|
74
|
+
by?: unknown;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** One declared alert of a package, in the shape the rule dialog context's
|
|
78
|
+
* `alertConditions` already carries for kScript `alertcondition()` entries. */
|
|
79
|
+
export interface WrunAlertConditionEntry {
|
|
80
|
+
kind: 'condition';
|
|
81
|
+
/** The declared alert name: the signal rule's `conditionTitle` (its identity) and, without a
|
|
82
|
+
* `label`, the picker label. */
|
|
83
|
+
title: string;
|
|
84
|
+
/** The declared display title (C1.8) when the sheet carries one that differs from the name:
|
|
85
|
+
* what the picker, the armed rule (`outputLabel`) and the notifications show. */
|
|
86
|
+
label?: string;
|
|
87
|
+
/** The declared fire text (the engine's fallback when the rule carries no user note). */
|
|
88
|
+
message?: string;
|
|
89
|
+
/** The picker sub-line. */
|
|
90
|
+
description?: string;
|
|
91
|
+
/** The declared string slot whose value on the fired row is the fire text
|
|
92
|
+
* (over `message`, over the name): the module writes it in finalize(). */
|
|
93
|
+
text?: string;
|
|
94
|
+
/** The author's firing default: true = a fire on every bar the condition
|
|
95
|
+
* holds (one per bar at most), absent = the false-to-true edge. The arm
|
|
96
|
+
* form seeds its Fire choice from it and the armed rule may override it. */
|
|
97
|
+
everyBar?: true;
|
|
98
|
+
}
|
|
99
|
+
interface WrunAlertOutputMetadataLike {
|
|
100
|
+
outputs: ReadonlyArray<{
|
|
101
|
+
index?: number;
|
|
102
|
+
name: string;
|
|
103
|
+
plot?: string;
|
|
104
|
+
panel?: string;
|
|
105
|
+
label?: string;
|
|
106
|
+
role?: string;
|
|
107
|
+
opacity?: number;
|
|
108
|
+
displacement_bars?: number;
|
|
109
|
+
displacement_bars_by?: unknown;
|
|
110
|
+
}>;
|
|
111
|
+
/** The sheet's strategy section; its presence makes the package a strategy. */
|
|
112
|
+
strategy?: unknown;
|
|
113
|
+
/** The sheet's declared alerts (read loosely: the registry hands over parsed
|
|
114
|
+
* JSON, and a sheet from an older kit has none). */
|
|
115
|
+
alerts?: unknown;
|
|
116
|
+
}
|
|
117
|
+
/** The words of a strategy package's host-published entry by its name
|
|
118
|
+
* (`strategy.fill` -> "Strategy trade opened or closed"); undefined for any
|
|
119
|
+
* other name. An alert on one names it without its sheet in hand. */
|
|
120
|
+
export declare function wrunStrategyAlertEntryLabel(outputKey: string): string | undefined;
|
|
121
|
+
/** Armable entries from a package metadata sheet (data-only outputs and
|
|
122
|
+
* guides dropped; a strategy package's event streams and reserved outputs
|
|
123
|
+
* appended). */
|
|
124
|
+
export declare function wrunAlertOutputsFromMetadata(metadata: WrunAlertOutputMetadataLike): WrunAlertOutputEntry[];
|
|
125
|
+
/** The sheet's declared alerts as picker conditions, in declaration order.
|
|
126
|
+
* A row without a string name is skipped; a repeated name keeps its first
|
|
127
|
+
* row (the sheet namespace forbids duplicates, so this only guards a
|
|
128
|
+
* hand-edited sheet). `when` is the engine's concern: the FE never
|
|
129
|
+
* re-derives the output it names. `text` rides only as a non-empty string
|
|
130
|
+
* and `every_bar` only as the literal `true` (a sheet from an older kit
|
|
131
|
+
* carries neither, and `false` means the edge, the default); `title` rides
|
|
132
|
+
* as `label` only when it is non-empty and differs from the name. */
|
|
133
|
+
export declare function wrunAlertConditionsFromMetadata(metadata: WrunAlertOutputMetadataLike): WrunAlertConditionEntry[];
|
|
134
|
+
/** Registers an overlay's entries from its sheet. `partial`: the sheet lacks
|
|
135
|
+
* the output facts the offer reads (labels, guide roles, opacity, shifts), so
|
|
136
|
+
* the entries stand in until a complete sheet replaces them
|
|
137
|
+
* (wrunOverlayAlertOutputsArePartial). */
|
|
138
|
+
export declare function setWrunOverlayAlertOutputs(overlayId: string, metadata: WrunAlertOutputMetadataLike, options?: {
|
|
139
|
+
partial?: boolean;
|
|
140
|
+
}): void;
|
|
141
|
+
/** Whether the overlay's entries were registered `partial`: a complete sheet replaces them. */
|
|
142
|
+
export declare function wrunOverlayAlertOutputsArePartial(overlayId: string): boolean;
|
|
143
|
+
export declare function clearWrunOverlayAlertOutputs(overlayId: string): void;
|
|
144
|
+
/** undefined until the overlay's package is mounted (an inert reload-time overlay has none). */
|
|
145
|
+
export declare function getWrunOverlayAlertOutputs(overlayId: string): WrunAlertOutputEntry[] | undefined;
|
|
146
|
+
/** The mounted overlay's declared alerts; undefined until its package is
|
|
147
|
+
* mounted, an empty list for a package that declares none. */
|
|
148
|
+
export declare function getWrunOverlayAlertConditions(overlayId: string): WrunAlertConditionEntry[] | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* The live frontier of an Indicator overlay's alert outputs on the mounted
|
|
151
|
+
* chart, for the quick dialog's Current values, threshold seed and direction
|
|
152
|
+
* (the built-in opener's lastValues / colors / labels): each array indexed by
|
|
153
|
+
* the output's `index`, the plot's last row value, its first colour, and the
|
|
154
|
+
* output's display label. Plots live under the overlay and its series
|
|
155
|
+
* children (`<id>::series:<pane>`, wrun-run-result.util wrunSeriesChildId).
|
|
156
|
+
* An output with no mounted plot (an empty `omit_if_empty` line, a strategy's
|
|
157
|
+
* reserved output or event stream) reads NaN, which the dialog prints as "-".
|
|
158
|
+
*/
|
|
159
|
+
export declare function wrunOverlayAlertOutputValues(chart: {
|
|
160
|
+
metadata?: ReadonlyArray<unknown>;
|
|
161
|
+
} | null | undefined, overlayId: string, outputs: ReadonlyArray<Pick<WrunAlertOutputEntry, 'index' | 'label' | 'outputKey' | 'displayLabel'>>): {
|
|
162
|
+
lastValues: number[];
|
|
163
|
+
colors: (string | undefined)[];
|
|
164
|
+
labels: (string | undefined)[];
|
|
165
|
+
};
|
|
166
|
+
export {};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alert-armable outputs of the mounted browser-run Indicator overlays, by
|
|
3
|
+
* overlay id. The registry loader stamps an overlay's package metadata here
|
|
4
|
+
* at mount (add, rehydrate, draft re-run); the alert resolver reads it to
|
|
5
|
+
* build the Indicator target's output picker.
|
|
6
|
+
*
|
|
7
|
+
* Rules are anchored server-side by output NAME, so each entry carries the
|
|
8
|
+
* metadata name as the stable identity (`outputKey` = name, `outputColumn`
|
|
9
|
+
* = 1) and as its `label`: the hosted engine labels the series by name and
|
|
10
|
+
* refuses a threshold rule whose `outputLabel` says otherwise. The sheet's
|
|
11
|
+
* own display `label` rides beside it as `displayLabel`, for the pickers
|
|
12
|
+
* only (displayOutputLabel). Data-only outputs (`plot: ''`) are never
|
|
13
|
+
* armable and are excluded here, mirroring the server's own list, and so are
|
|
14
|
+
* guides (`role: "guide"`): a guide is the kScript hline it stands for, one
|
|
15
|
+
* constant level, which the kScript lane never offers either. Two more sheet
|
|
16
|
+
* facts ride for the resolver's offer: `transparent` (a line declared
|
|
17
|
+
* `opacity: 0`, drawn clear: a fill's edge) and `displacement` (the declared
|
|
18
|
+
* bar shift, read against the armed params there).
|
|
19
|
+
*
|
|
20
|
+
* A strategy package (a sheet that declares `strategy`, OM-WRUN3-STRATEGIES-
|
|
21
|
+
* CONTRACT section 5) adds four host-published entries after its outputs,
|
|
22
|
+
* the same ones the hosted alerts engine evaluates: the two event streams
|
|
23
|
+
* (`strategy.order`, a pending order that did not exist before the bar's
|
|
24
|
+
* finalize(); `strategy.fill`, a trade opened or closed by the bar's fills;
|
|
25
|
+
* both fire on confirmed bars only) and the two reserved outputs
|
|
26
|
+
* (`strategy.position`, the signed position after the bar's fills;
|
|
27
|
+
* `strategy.equity`), addressable by name like any output. They never enter
|
|
28
|
+
* the module's output count, so their `index` continues after the declared
|
|
29
|
+
* outputs and `kind` tells them apart from a plotted output.
|
|
30
|
+
*
|
|
31
|
+
* A sheet's declared alerts (`alerts: [{ name, when, message?, description?,
|
|
32
|
+
* text?, every_bar? }]`, the kit's `alert(name, { when: handle, message })`
|
|
33
|
+
* declaration over an output the module already writes, data-only allowed)
|
|
34
|
+
* are stamped beside the armable outputs as alert CONDITIONS: the form lists
|
|
35
|
+
* them as `signal:<name>` options and the arm sends a `kind: 'signal'` rule
|
|
36
|
+
* whose `conditionTitle` is the declared name; the hosted engine fires on
|
|
37
|
+
* the `when` output's false to true flip (or on every bar it holds when the
|
|
38
|
+
* declaration or the user says `every_bar`) and refuses an undeclared title
|
|
39
|
+
* with 422 UNKNOWN_CONDITION. The two scaffold-37 facts ride along so the
|
|
40
|
+
* arm form can say what will fire and what the message will be: `text`
|
|
41
|
+
* names the declared string slot whose fired-row value is the fire text,
|
|
42
|
+
* `every_bar` the author's firing default. They never enter the output
|
|
43
|
+
* entries: the `when` output stays armable (or data-only) on its own terms.
|
|
44
|
+
* A declared `title` (frozen authoring contract C1.8: display text with
|
|
45
|
+
* spaces beside the slug name) rides as the entry's `label`: the picker
|
|
46
|
+
* lists it, the arm stamps it as the signal rule's `outputLabel`, and the
|
|
47
|
+
* cards and fired notifications show it. The entry's `title` stays the
|
|
48
|
+
* name, the `conditionTitle` every option, edit and armed rule is keyed by,
|
|
49
|
+
* so arms made before titles existed keep matching.
|
|
50
|
+
*
|
|
51
|
+
* Leaf module (no imports) so the resolver stays node-testable without the
|
|
52
|
+
* wasm host or the chart instance in its graph; the four names mirror the
|
|
53
|
+
* SDK's WRUN3_STRATEGY_EVENT_STREAMS and WRUN3_STRATEGY_RESERVED_OUTPUTS.
|
|
54
|
+
*/
|
|
55
|
+
/** The strategy entries in picker order: the actionable stream first (the
|
|
56
|
+
* strategy wants a fill at the next open), the accounting stream, then the
|
|
57
|
+
* two reserved outputs. Labels are the user-facing names. */
|
|
58
|
+
const WRUN_STRATEGY_ALERT_ENTRIES = [
|
|
59
|
+
{ outputKey: 'strategy.order', label: 'Strategy order placed', kind: 'event' },
|
|
60
|
+
{ outputKey: 'strategy.fill', label: 'Strategy trade opened or closed', kind: 'event' },
|
|
61
|
+
{ outputKey: 'strategy.position', label: 'Strategy position', kind: 'reserved' },
|
|
62
|
+
{ outputKey: 'strategy.equity', label: 'Strategy equity', kind: 'reserved' },
|
|
63
|
+
];
|
|
64
|
+
/** The words of a strategy package's host-published entry by its name
|
|
65
|
+
* (`strategy.fill` -> "Strategy trade opened or closed"); undefined for any
|
|
66
|
+
* other name. An alert on one names it without its sheet in hand. */
|
|
67
|
+
export function wrunStrategyAlertEntryLabel(outputKey) {
|
|
68
|
+
return WRUN_STRATEGY_ALERT_ENTRIES.find((entry) => entry.outputKey === outputKey)?.label;
|
|
69
|
+
}
|
|
70
|
+
const recordsByOverlay = new Map();
|
|
71
|
+
/** Armable entries from a package metadata sheet (data-only outputs and
|
|
72
|
+
* guides dropped; a strategy package's event streams and reserved outputs
|
|
73
|
+
* appended). */
|
|
74
|
+
export function wrunAlertOutputsFromMetadata(metadata) {
|
|
75
|
+
const entries = [];
|
|
76
|
+
metadata.outputs.forEach((output, position) => {
|
|
77
|
+
if (!output?.name || output.plot === '' || output.role === 'guide')
|
|
78
|
+
return;
|
|
79
|
+
const displayLabel = typeof output.label === 'string' ? output.label.trim() : '';
|
|
80
|
+
const shift = {
|
|
81
|
+
...(typeof output.displacement_bars === 'number' ? { bars: output.displacement_bars } : {}),
|
|
82
|
+
...(output.displacement_bars_by !== undefined ? { by: output.displacement_bars_by } : {}),
|
|
83
|
+
};
|
|
84
|
+
entries.push({
|
|
85
|
+
index: typeof output.index === 'number' ? output.index : position,
|
|
86
|
+
label: output.name,
|
|
87
|
+
outputKey: output.name,
|
|
88
|
+
outputColumn: 1,
|
|
89
|
+
...(output.panel ? { panel: output.panel } : {}),
|
|
90
|
+
...(displayLabel && displayLabel !== output.name ? { displayLabel } : {}),
|
|
91
|
+
...(output.opacity === 0 ? { transparent: true } : {}),
|
|
92
|
+
...(Object.keys(shift).length ? { displacement: shift } : {}),
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
if (metadata.strategy !== undefined) {
|
|
96
|
+
// After every declared output index, so a reserved entry never collides
|
|
97
|
+
// with a declared column whatever the sheet's index gaps.
|
|
98
|
+
let index = metadata.outputs.reduce((max, output, position) => Math.max(max, typeof output?.index === 'number' ? output.index : position), -1);
|
|
99
|
+
for (const entry of WRUN_STRATEGY_ALERT_ENTRIES) {
|
|
100
|
+
index += 1;
|
|
101
|
+
entries.push({ index, label: entry.label, outputKey: entry.outputKey, outputColumn: 1, kind: entry.kind });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return entries;
|
|
105
|
+
}
|
|
106
|
+
/** The sheet's declared alerts as picker conditions, in declaration order.
|
|
107
|
+
* A row without a string name is skipped; a repeated name keeps its first
|
|
108
|
+
* row (the sheet namespace forbids duplicates, so this only guards a
|
|
109
|
+
* hand-edited sheet). `when` is the engine's concern: the FE never
|
|
110
|
+
* re-derives the output it names. `text` rides only as a non-empty string
|
|
111
|
+
* and `every_bar` only as the literal `true` (a sheet from an older kit
|
|
112
|
+
* carries neither, and `false` means the edge, the default); `title` rides
|
|
113
|
+
* as `label` only when it is non-empty and differs from the name. */
|
|
114
|
+
export function wrunAlertConditionsFromMetadata(metadata) {
|
|
115
|
+
if (!Array.isArray(metadata.alerts))
|
|
116
|
+
return [];
|
|
117
|
+
const entries = [];
|
|
118
|
+
const seen = new Set();
|
|
119
|
+
for (const row of metadata.alerts) {
|
|
120
|
+
const alert = row;
|
|
121
|
+
if (!alert || typeof alert !== 'object' || typeof alert.name !== 'string' || !alert.name)
|
|
122
|
+
continue;
|
|
123
|
+
if (seen.has(alert.name))
|
|
124
|
+
continue;
|
|
125
|
+
seen.add(alert.name);
|
|
126
|
+
// The display title (C1.8) rides only when it says something the name does not.
|
|
127
|
+
const label = typeof alert.title === 'string' ? alert.title.trim() : '';
|
|
128
|
+
entries.push({
|
|
129
|
+
kind: 'condition',
|
|
130
|
+
title: alert.name,
|
|
131
|
+
...(label && label !== alert.name ? { label } : {}),
|
|
132
|
+
...(typeof alert.message === 'string' && alert.message ? { message: alert.message } : {}),
|
|
133
|
+
...(typeof alert.description === 'string' && alert.description ? { description: alert.description } : {}),
|
|
134
|
+
...(typeof alert.text === 'string' && alert.text ? { text: alert.text } : {}),
|
|
135
|
+
...(alert.every_bar === true ? { everyBar: true } : {}),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return entries;
|
|
139
|
+
}
|
|
140
|
+
/** Registers an overlay's entries from its sheet. `partial`: the sheet lacks
|
|
141
|
+
* the output facts the offer reads (labels, guide roles, opacity, shifts), so
|
|
142
|
+
* the entries stand in until a complete sheet replaces them
|
|
143
|
+
* (wrunOverlayAlertOutputsArePartial). */
|
|
144
|
+
export function setWrunOverlayAlertOutputs(overlayId, metadata, options = {}) {
|
|
145
|
+
recordsByOverlay.set(overlayId, {
|
|
146
|
+
outputs: wrunAlertOutputsFromMetadata(metadata),
|
|
147
|
+
alertConditions: wrunAlertConditionsFromMetadata(metadata),
|
|
148
|
+
...(options.partial === true ? { partial: true } : {}),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/** Whether the overlay's entries were registered `partial`: a complete sheet replaces them. */
|
|
152
|
+
export function wrunOverlayAlertOutputsArePartial(overlayId) {
|
|
153
|
+
return recordsByOverlay.get(overlayId)?.partial === true;
|
|
154
|
+
}
|
|
155
|
+
export function clearWrunOverlayAlertOutputs(overlayId) {
|
|
156
|
+
recordsByOverlay.delete(overlayId);
|
|
157
|
+
}
|
|
158
|
+
/** undefined until the overlay's package is mounted (an inert reload-time overlay has none). */
|
|
159
|
+
export function getWrunOverlayAlertOutputs(overlayId) {
|
|
160
|
+
const record = recordsByOverlay.get(overlayId);
|
|
161
|
+
return record ? record.outputs.map((entry) => ({ ...entry })) : undefined;
|
|
162
|
+
}
|
|
163
|
+
/** The mounted overlay's declared alerts; undefined until its package is
|
|
164
|
+
* mounted, an empty list for a package that declares none. */
|
|
165
|
+
export function getWrunOverlayAlertConditions(overlayId) {
|
|
166
|
+
const record = recordsByOverlay.get(overlayId);
|
|
167
|
+
return record ? record.alertConditions.map((entry) => ({ ...entry })) : undefined;
|
|
168
|
+
}
|
|
169
|
+
/** The mounted plot of output `name` under `hosts`, found the way the
|
|
170
|
+
* visibility apply finds it (wrun-run-result.util applyWrunOutputVisibility):
|
|
171
|
+
* the nested meta whose engine keys name `<host>:<name>` or `<name>`. */
|
|
172
|
+
function mountedOutputPlot(hosts, name) {
|
|
173
|
+
for (const host of hosts) {
|
|
174
|
+
const wanted = [`${String(host.id)}:${name}`, name];
|
|
175
|
+
const nested = Array.isArray(host.nestedMeta) ? host.nestedMeta : [];
|
|
176
|
+
const plot = nested.find((candidate) => !!candidate &&
|
|
177
|
+
[candidate.id, candidate.plotId, candidate.mainPlotKey, candidate.outputKey, candidate.plotKey].some((key) => typeof key === 'string' && wanted.includes(key)));
|
|
178
|
+
if (plot)
|
|
179
|
+
return plot;
|
|
180
|
+
}
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The live frontier of an Indicator overlay's alert outputs on the mounted
|
|
185
|
+
* chart, for the quick dialog's Current values, threshold seed and direction
|
|
186
|
+
* (the built-in opener's lastValues / colors / labels): each array indexed by
|
|
187
|
+
* the output's `index`, the plot's last row value, its first colour, and the
|
|
188
|
+
* output's display label. Plots live under the overlay and its series
|
|
189
|
+
* children (`<id>::series:<pane>`, wrun-run-result.util wrunSeriesChildId).
|
|
190
|
+
* An output with no mounted plot (an empty `omit_if_empty` line, a strategy's
|
|
191
|
+
* reserved output or event stream) reads NaN, which the dialog prints as "-".
|
|
192
|
+
*/
|
|
193
|
+
export function wrunOverlayAlertOutputValues(chart, overlayId, outputs) {
|
|
194
|
+
const length = outputs.reduce((max, output) => Math.max(max, output.index + 1), 0);
|
|
195
|
+
const lastValues = Array.from({ length }, () => Number.NaN);
|
|
196
|
+
const colors = Array.from({ length }, () => undefined);
|
|
197
|
+
const labels = Array.from({ length }, () => undefined);
|
|
198
|
+
const childPrefix = `${overlayId}::series:`;
|
|
199
|
+
const hosts = (chart?.metadata ?? []).filter((meta) => {
|
|
200
|
+
const id = meta?.id;
|
|
201
|
+
return typeof id === 'string' && (id === overlayId || id.startsWith(childPrefix));
|
|
202
|
+
});
|
|
203
|
+
for (const output of outputs) {
|
|
204
|
+
labels[output.index] = output.displayLabel ?? output.label;
|
|
205
|
+
const plot = mountedOutputPlot(hosts, output.outputKey);
|
|
206
|
+
if (!plot)
|
|
207
|
+
continue;
|
|
208
|
+
const rows = Array.isArray(plot.rawData) ? plot.rawData : [];
|
|
209
|
+
const row = rows[rows.length - 1];
|
|
210
|
+
const value = Array.isArray(row) ? Number(row[1]) : Number.NaN;
|
|
211
|
+
if (Number.isFinite(value))
|
|
212
|
+
lastValues[output.index] = value;
|
|
213
|
+
const palette = Array.isArray(plot.settings?.colors) ? plot.settings.colors : plot.colors;
|
|
214
|
+
const color = Array.isArray(palette) ? palette[0] : undefined;
|
|
215
|
+
if (typeof color === 'string')
|
|
216
|
+
colors[output.index] = color;
|
|
217
|
+
}
|
|
218
|
+
return { lastValues, colors, labels };
|
|
219
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wrun-6 row count (om docs/WRUN6_ABI.md): `wrun_bar_count() -> i32`, the number of bars the
|
|
3
|
+
* run holds while a row is evaluated, the forming bar included. It is the length of the series a
|
|
4
|
+
* kScript script reads ahead in (the engine's source `data.length`, the bound ichimoku()'s lagging
|
|
5
|
+
* span tests `i + displacement` against), so a row can tell whether a later row exists.
|
|
6
|
+
*
|
|
7
|
+
* The engine's semantics (v3.0.92), which every host mirrors: a full run and every reseed load the
|
|
8
|
+
* source whole, so every bar reads the bars loaded; live, a forming tick recomputes the forming bar
|
|
9
|
+
* only (the count it reads is unchanged), and a NEW bar re-seeds, recomputing every bar with the
|
|
10
|
+
* new length. The chart's worker answers the count (wrun-abi-host); the live tick reopens the
|
|
11
|
+
* session over every bar when a bar appears for a module that imports it (the reseed), and every
|
|
12
|
+
* other module keeps the close-confirm.
|
|
13
|
+
*
|
|
14
|
+
* Beside it, the chart's corroboration of the history-independent stamp (`history_independent: true`,
|
|
15
|
+
* kit 0.66.0): a module that reads the row count is never history-independent, and the stamp is
|
|
16
|
+
* admitted only when the module imports nothing outside the kit's per-bar list
|
|
17
|
+
* (`wrunStampCorroborated`) and the sheet passes the kit's sheet facts (`wrunStampSheetRefusal`, the
|
|
18
|
+
* kit's own rules ported), so a stamp hand-added to a published sheet still answers to the module it
|
|
19
|
+
* ships beside and to the facts the kit checks.
|
|
20
|
+
*
|
|
21
|
+
* The exact warm-up stamp (`history_warmup`, round A of the warm-up program) answers to the same module and
|
|
22
|
+
* sheet checks (`wrunWarmupStampOf` reads it, `wrunWarmupSheetRefusal` adds the one fact of its own: never
|
|
23
|
+
* beside `history_independent`), and a warm-up session must read the chart's own candles alone
|
|
24
|
+
* (`wrunWarmupSheetReadsCandlesOnly`): its hidden head is candles, so a book, a leg, a feed or a poll lane
|
|
25
|
+
* would reach the head's bars without their rows.
|
|
26
|
+
*
|
|
27
|
+
* Every reader takes the module's import list, never the compiled module: the main thread reads the list off the
|
|
28
|
+
* module's handle (`WrunModuleHandle.imports`, which the engine worker's load answered in WebAssembly.Module.imports()
|
|
29
|
+
* order; the main thread holds no WebAssembly.Module), and the worker's ABI host reads the same predicates over
|
|
30
|
+
* `WebAssembly.Module.imports(module)`, so the two sides cannot answer differently for one module.
|
|
31
|
+
*
|
|
32
|
+
* Pure and worker-safe.
|
|
33
|
+
*/
|
|
34
|
+
import { type WrunAbiVersion, type WrunHistoryWarmup, type WrunModuleHandle, type WrunModuleImport } from '../../interfaces/wrun-runtime.interface.js';
|
|
35
|
+
/** The import (the one the shared host links under wrun-6; wrun-bar-count.kit-mirror.spec.ts). */
|
|
36
|
+
export declare const WRUN6_BAR_IMPORTS: readonly ["wrun:wrun_bar_count"];
|
|
37
|
+
/** The refusal names a host raises on the row count (a code of the shared host's refusal table). */
|
|
38
|
+
export declare const WRUN6_BAR_REFUSALS: {
|
|
39
|
+
/** wrun_bar_count called outside state() and finalize(). */
|
|
40
|
+
readonly phase: "wrun_bar_count_phase";
|
|
41
|
+
};
|
|
42
|
+
/** Whether an import list carries the row count: `wrun_bar_count` under the `wrun` module, qualified on both (an
|
|
43
|
+
* import of the same name from another module is not the host's count). */
|
|
44
|
+
export declare function wrunImportsBarCount(imports: readonly WrunModuleImport[]): boolean;
|
|
45
|
+
/** Whether a module imports the row count (read once per handle). */
|
|
46
|
+
export declare function wrunModuleImportsBarCount(module: WrunModuleHandle): boolean;
|
|
47
|
+
/** Whether a module READS the row count under its ABI: wrun-6 or later and the import declared.
|
|
48
|
+
* Such a module's live session re-runs every bar when a bar appears; any other keeps the
|
|
49
|
+
* close-confirm. */
|
|
50
|
+
export declare function wrunModuleReadsBarCount(module: WrunModuleHandle, abi: WrunAbiVersion): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The import names a stamped module may carry: the kit's own list (`WRUN_HISTORY_INDEPENDENT_IMPORTS`,
|
|
53
|
+
* wrun-history-independence.ts, kit 0.67.1), name for name, read as the kit's decision reads them
|
|
54
|
+
* (`WebAssembly.Module.imports(module).map((entry) => entry.name)`): the argument readers `wrun_arg_*`
|
|
55
|
+
* (a row's scalar inputs and, during init(), the numeric and boolean setting readers), the cell channel
|
|
56
|
+
* `wrun_arg_len` and `wrun_arg_bytes` (this bar's block), the output writers `wrun_output_f64` and
|
|
57
|
+
* `wrun_result_write`, `abort`, and the text channel `wrun_param_len` and `wrun_param_bytes`. The text
|
|
58
|
+
* channel is admitted because a text setting is fixed for the run and read once in init(): the generated
|
|
59
|
+
* reader runs there, before onStart(), both hosts trap the two imports anywhere else, and the kit's walker
|
|
60
|
+
* refuses every `pt_*` read, so the setting's byte count reaches bar code through `p_<name>()` like any
|
|
61
|
+
* setting. Every other import refuses: the row count (`wrun_bar_count`), the last-bar signal
|
|
62
|
+
* (`wrun_bar_last`), the draw, string, frame and strategy channels, and any import a later kit adds until
|
|
63
|
+
* it is listed here (wrun-bar-count.util.spec.ts runs the kit's own decision over every host import and
|
|
64
|
+
* holds this list to exactly the names it admits).
|
|
65
|
+
*/
|
|
66
|
+
export declare const WRUN_STAMP_IMPORTS: ReadonlySet<string>;
|
|
67
|
+
/** Whether every import of a list is on the kit's per-bar list (`WRUN_STAMP_IMPORTS`), by name alone (the kit's
|
|
68
|
+
* decision reads the names, whatever module each comes from). */
|
|
69
|
+
export declare function wrunImportsWithinStamp(imports: readonly WrunModuleImport[]): boolean;
|
|
70
|
+
/** Whether every import of a module is on the kit's per-bar list (`WRUN_STAMP_IMPORTS`), read once per
|
|
71
|
+
* handle; a handle without a readable import list answers false. */
|
|
72
|
+
export declare function wrunStampCorroborated(module: WrunModuleHandle): boolean;
|
|
73
|
+
/** The first sheet fact that reads or draws beyond the bar at hand, in the kit's own words
|
|
74
|
+
* (`sheet:<fact>[:<name>]`); undefined when the sheet passes. */
|
|
75
|
+
export declare function wrunStampSheetRefusal(sheet: unknown): string | undefined;
|
|
76
|
+
/** The sheet's raw exact warm-up stamp: its `history_warmup` in the frozen shape (wrun-declared-warmup.util
|
|
77
|
+
* `wrunHistoryWarmupOf`), undefined for no key, another kind or a malformed value. The chart admits a
|
|
78
|
+
* session on it only once the module and the sheet corroborate it (wrun-overlay-run.util). */
|
|
79
|
+
export declare function wrunWarmupStampOf(sheet: unknown): WrunHistoryWarmup | undefined;
|
|
80
|
+
/** The first sheet fact that refuses an exact warm-up stamp: `sheet:history-both` for a sheet that also carries
|
|
81
|
+
* `history_independent` (the kit writes one stamp or the other, never both: a sheet holding both was assembled
|
|
82
|
+
* by hand), then the per-bar stamp's own sheet facts (`wrunStampSheetRefusal`, the same rules: a warm-up module
|
|
83
|
+
* carries kit instances, never a handle, a string slot, a leg or a carried input); undefined when it passes. */
|
|
84
|
+
export declare function wrunWarmupSheetRefusal(sheet: unknown): string | undefined;
|
|
85
|
+
/** Whether one input reads the chart's own feed, the chart-feed shape (the plan's D3, the kit's `sheet:lanes`
|
|
86
|
+
* rule): `ohlcv` or `time`, with no key besides source, field and missing (no market, interval, view or depth of
|
|
87
|
+
* its own) and no cells. A row of the chart's candles carries every such input itself: its prices, and the bar
|
|
88
|
+
* times read off its own open. The exact warm-up rule below reads it, and the prefix lanes rule reads it for a
|
|
89
|
+
* `time` input (wrun-overlay-run.util). */
|
|
90
|
+
export declare function wrunInputReadsChartFeed(input: unknown, source: unknown): boolean;
|
|
91
|
+
/** Whether every input the sheet declares reads the chart's own feed (`wrunInputReadsChartFeed`). Those are the
|
|
92
|
+
* only rows an exact warm-up session's hidden head carries: its candles, and the bar times read off their own
|
|
93
|
+
* opens. A sheet with no input reads nothing a head could feed and is not candles-only. */
|
|
94
|
+
export declare function wrunWarmupSheetReadsCandlesOnly(sheet: unknown): boolean;
|