@orangecharts/wrun-chart-host 0.1.0 → 0.3.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 +39 -6
- package/dist/constants/common.constants.d.ts +15 -0
- package/dist/constants/common.constants.js +23 -0
- package/dist/constants/data-source.constants.d.ts +1 -0
- package/dist/constants/data-source.constants.js +1 -0
- package/dist/constants/economic.constants.d.ts +39 -0
- package/dist/constants/economic.constants.js +77 -0
- package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
- package/dist/constants/etf-covered-coins.constants.js +9 -0
- package/dist/constants/feature-flags.constants.d.ts +60 -0
- package/dist/constants/feature-flags.constants.js +308 -0
- package/dist/constants/feature-limits.constants.d.ts +134 -0
- package/dist/constants/feature-limits.constants.js +155 -0
- package/dist/constants/marketCapabilities.constants.d.ts +87 -0
- package/dist/constants/marketCapabilities.constants.js +213 -0
- package/dist/constants/option-venues.constants.d.ts +100 -0
- package/dist/constants/option-venues.constants.js +167 -0
- package/dist/constants/overlay-data.constants.d.ts +53 -0
- package/dist/constants/overlay-data.constants.js +80 -0
- package/dist/constants/pane-grid.constants.d.ts +15 -0
- package/dist/constants/pane-grid.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +10 -0
- package/dist/constants/venue-presets.constants.js +22 -0
- package/dist/enums/chart.enum.d.ts +68 -0
- package/dist/enums/chart.enum.js +70 -0
- package/dist/helpers/data.helpers.d.ts +2 -0
- package/dist/helpers/data.helpers.js +14 -0
- package/dist/host-env.d.ts +161 -5
- package/dist/host-ports.types.d.ts +446 -0
- package/dist/host-ports.types.js +1 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +131 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
- package/dist/interfaces/asset-venue.interface.d.ts +91 -0
- package/dist/interfaces/asset-venue.interface.js +1 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
- package/dist/interfaces/cancel-reason.interface.js +2 -0
- package/dist/interfaces/catalog-display.interface.d.ts +3 -0
- package/dist/interfaces/catalog-display.interface.js +1 -0
- package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
- package/dist/interfaces/cme-realtime.interface.js +46 -0
- package/dist/interfaces/feed.interface.d.ts +80 -0
- package/dist/interfaces/feed.interface.js +7 -0
- package/dist/interfaces/market-kind.interface.d.ts +8 -0
- package/dist/interfaces/market-kind.interface.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
- package/dist/interfaces/opra-realtime.interface.js +105 -0
- package/dist/interfaces/option-instrument.interface.d.ts +32 -0
- package/dist/interfaces/option-instrument.interface.js +1 -0
- package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
- package/dist/interfaces/options-chain-scope.interface.js +7 -0
- package/dist/interfaces/prediction-market.interface.d.ts +88 -0
- package/dist/interfaces/prediction-market.interface.js +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
- package/dist/settings-templates/frvp-fields.d.ts +27 -0
- package/dist/settings-templates/frvp-fields.js +108 -0
- package/dist/settings-templates/index.d.ts +119 -0
- package/dist/settings-templates/index.js +442 -0
- package/dist/settings-templates/indicator-fields.d.ts +56 -0
- package/dist/settings-templates/indicator-fields.js +793 -0
- package/dist/settings-templates/tool-rules.d.ts +59 -0
- package/dist/settings-templates/tool-rules.js +49 -0
- package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
- package/dist/settings-templates/tool-tables.generated.js +1668 -0
- package/dist/utility/blk-market.util.d.ts +5 -0
- package/dist/utility/blk-market.util.js +12 -0
- package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
- package/dist/utility/chart/chart-load-phase.util.js +78 -0
- package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
- package/dist/utility/chart/cme-cache-context.util.js +166 -0
- package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
- package/dist/utility/chart/cme-session-bucket.util.js +343 -0
- package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
- package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
- package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
- package/dist/utility/chart/continuous-contracts.util.js +374 -0
- package/dist/utility/chart/feed-interval.util.d.ts +119 -0
- package/dist/utility/chart/feed-interval.util.js +321 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
- package/dist/utility/chart/footprint-band.util.d.ts +76 -0
- package/dist/utility/chart/footprint-band.util.js +205 -0
- package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
- package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
- package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
- package/dist/utility/chart/formula-calendar.util.js +59 -0
- package/dist/utility/chart/history-wall.util.d.ts +67 -0
- package/dist/utility/chart/history-wall.util.js +87 -0
- package/dist/utility/chart/index-mode.util.d.ts +66 -0
- package/dist/utility/chart/index-mode.util.js +360 -0
- package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
- package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
- package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
- package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
- package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
- package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
- package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
- package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
- package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
- package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
- package/dist/utility/chart/interval-registry.util.d.ts +23 -0
- package/dist/utility/chart/interval-registry.util.js +83 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
- package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
- package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
- package/dist/utility/chart/live-bucket.util.d.ts +66 -0
- package/dist/utility/chart/live-bucket.util.js +165 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
- package/dist/utility/chart/market-session-schedule.util.js +337 -0
- package/dist/utility/chart/marketKind.util.d.ts +181 -0
- package/dist/utility/chart/marketKind.util.js +371 -0
- package/dist/utility/chart/om-panel.util.js +6 -0
- package/dist/utility/chart/om-widget.util.d.ts +4 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
- package/dist/utility/chart/opra-read-access.leaf.js +25 -0
- package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
- package/dist/utility/chart/prediction-identity.util.js +236 -0
- package/dist/utility/chart/rth-session.util.d.ts +352 -0
- package/dist/utility/chart/rth-session.util.js +926 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
- package/dist/utility/chart/titan-constants.pin.js +50 -0
- package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
- package/dist/utility/chart/us-equities-session.util.js +251 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
- package/dist/utility/chart/wrun-run-result.util.js +10 -0
- package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
- package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
- package/dist/utility/common/safe-math-eval.d.ts +18 -0
- package/dist/utility/common/safe-math-eval.js +160 -0
- package/dist/utility/common/time.util.d.ts +134 -0
- package/dist/utility/common/time.util.js +428 -0
- package/dist/utility/common/transformations.util.d.ts +126 -0
- package/dist/utility/common/transformations.util.js +711 -0
- package/dist/utility/common/visible-timeout.util.d.ts +17 -0
- package/dist/utility/common/visible-timeout.util.js +75 -0
- package/dist/utility/exchange-normalization.util.d.ts +8 -0
- package/dist/utility/exchange-normalization.util.js +32 -0
- package/dist/utility/intl-locale.util.d.ts +2 -0
- package/dist/utility/intl-locale.util.js +28 -0
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +50 -19
- package/dist/utility/options/option-symbol.util.d.ts +28 -0
- package/dist/utility/options/option-symbol.util.js +176 -0
- package/dist/utility/options/option-trade-units.util.d.ts +190 -0
- package/dist/utility/options/option-trade-units.util.js +283 -0
- package/dist/utility/options/option-venue.util.d.ts +75 -0
- package/dist/utility/options/option-venue.util.js +85 -0
- package/dist/utility/pool-symbol.leaf.d.ts +34 -0
- package/dist/utility/pool-symbol.leaf.js +95 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
- package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
- package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
- package/dist/utility/v2/gate-plane.util.d.ts +58 -0
- package/dist/utility/v2/gate-plane.util.js +99 -0
- package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
- package/dist/utility/v2/gate-session-latch.util.js +34 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
- package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
- package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/economic.js +79 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
- package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/lanes/index.js +32 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
- package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
- package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
- package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
- package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
- package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
- package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
- package/dist/utility/wrun/sources/lanes/series.js +321 -0
- package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
- package/dist/utility/wrun/sources/registry.d.ts +21 -0
- package/dist/utility/wrun/sources/registry.js +207 -0
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
- package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
- package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
- package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +1 -1
- package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
- package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
- package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-deadline.util.js +82 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
- package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
- package/dist/utility/wrun/wrun-failure-cause.d.ts +39 -0
- package/dist/utility/wrun/wrun-failure-cause.js +94 -0
- package/dist/utility/wrun/wrun-frames.d.ts +28 -3
- package/dist/utility/wrun/wrun-frames.js +132 -52
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +167 -4
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +47 -2
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +5 -2
- package/dist/utility/wrun/wrun-hosted-wire.util.js +4 -2
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
- package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
- package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
- package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
- package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +30 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
- package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
- package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
- package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
- package/dist/utility/wrun/wrun-pack.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-pack.util.js +13 -3
- package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
- package/dist/utility/wrun/wrun-param-map.util.js +581 -0
- package/dist/utility/wrun/wrun-param-values.util.d.ts +8 -0
- package/dist/utility/wrun/wrun-param-values.util.js +8 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +95 -7
- package/dist/utility/wrun/wrun-refusal.util.js +314 -18
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
- package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
- package/dist/utility/wrun/wrun-render-select.util.js +1 -0
- package/dist/utility/wrun/wrun-row-market.util.d.ts +29 -0
- package/dist/utility/wrun/wrun-row-market.util.js +92 -0
- package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
- package/dist/utility/wrun/wrun-row-source.js +75 -0
- package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
- package/dist/utility/wrun/wrun-run-health.util.js +273 -0
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
- package/dist/utility/wrun/wrun-symbol-code.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-symbol-code.util.js +56 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
- package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
- package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
- package/dist/utility/wrun-display-name.util.d.ts +33 -0
- package/dist/utility/wrun-display-name.util.js +64 -0
- package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
- package/dist/workers/constants/kscript-transport-codes.js +15 -0
- package/dist/workers/constants/socket-slots.d.ts +574 -0
- package/dist/workers/constants/socket-slots.js +539 -0
- package/dist/workers/utils/number.worker.util.d.ts +5 -0
- package/dist/workers/utils/number.worker.util.js +10 -0
- package/dist/workers/utils/time.worker.util.d.ts +12 -0
- package/dist/workers/utils/time.worker.util.js +24 -0
- package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
- package/dist/workers/utils/volume-profile.worker.util.js +631 -0
- package/package.json +10 -4
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The param maps a host other than the browser receives for an Indicator's settings (WRUN-INPUTS-PLAN
|
|
3
|
+
* 1.5, 1.9 delta d; moved out of the hosted glue in lane parity U16, which deleted the glue and kept
|
|
4
|
+
* these: the alerts arm and the socket row source's createScript still send them). The alerts engine
|
|
5
|
+
* (the arm's `wrun.params`) and the cloud executor (the createScript `settings`) read a NUMBER for
|
|
6
|
+
* every declared sheet param but a text param (its words) and a market picker (its market text), so
|
|
7
|
+
* both lanes derive their map here through the run path's own derivation
|
|
8
|
+
* (`wrunParamValuesFromSettings`: a toggle 1/0, a colour its packed number, a time its epoch seconds,
|
|
9
|
+
* composites and colour arrays as their members). Style page rows (`__style__*`) and virtual
|
|
10
|
+
* composite rows never enter it.
|
|
11
|
+
*
|
|
12
|
+
* Frozen contract C1 (WRUN-PARITY-PLAN, the param map): "a `color[]` row
|
|
13
|
+
* carries `members: string[]`; the hosted map holds one packed colour per
|
|
14
|
+
* member name (`wrunParamValuesFromSettings` packs element i of the row's
|
|
15
|
+
* value exactly as the browser lane does); a `host: 'symbol'` param rides as
|
|
16
|
+
* its `EXCHANGE:SYMBOL` text when off its default, else 0; a `host:
|
|
17
|
+
* 'interval'` param rides as the select index; a text param rides as its
|
|
18
|
+
* capped plain text; everything else as today." So the lane that holds only
|
|
19
|
+
* the overlay's rows (the cloud createScript, sent from the kScript socket
|
|
20
|
+
* worker) carries a colour-array pick member for member, and the cloud
|
|
21
|
+
* applies every host pick the browser applies: a source or timeframe pick
|
|
22
|
+
* from its select index, a market pick from its text (the bound inputs'
|
|
23
|
+
* pins, as the browser's host writes do), while the module's slot for a
|
|
24
|
+
* market picker stays 0 on every host. tests/utility/wrun/
|
|
25
|
+
* wrun-lane-param-parity.spec.ts holds the two lanes' init args equal over
|
|
26
|
+
* every dev fixture sheet.
|
|
27
|
+
*
|
|
28
|
+
* The market text rides by capability, not by deploy order: a server that
|
|
29
|
+
* did not advertise `wrun-symbol-text-v1` (WRUN_SYMBOL_TEXT_SERVER_CAP, in
|
|
30
|
+
* the `hello` that opens its socket) reads the param through Number() and
|
|
31
|
+
* refuses the text, which would stop the overlay drawing. So every map takes
|
|
32
|
+
* the caller's server caps and, without that cap, sends a market pick as 0
|
|
33
|
+
* (the pre-C1 map: the cloud draws the sheet's own market). Only the cloud
|
|
34
|
+
* createScript knows its socket's caps (the kScript socket worker reads the
|
|
35
|
+
* hello); Run once in Cloud, the alert arm and the browser run's arm
|
|
36
|
+
* identity pass none, so the three agree with each other.
|
|
37
|
+
*
|
|
38
|
+
* The alerts engine applies a source pick (the index into the nine source
|
|
39
|
+
* words, kscript-alerts c7cce1b) and no other host pick: it plans from the
|
|
40
|
+
* sheet's own pins, so `wrunHostParamOverride` names the first timeframe or
|
|
41
|
+
* symbol setting that left its default for the alert arm to refuse.
|
|
42
|
+
*
|
|
43
|
+
* The settings record (lane parity C4, wrunHostedSettingsRecord) replaces
|
|
44
|
+
* the map for the cloud createScript on a socket whose server advertised
|
|
45
|
+
* `wrun-settings-v1`: the overlay's own setting values over the sheet's
|
|
46
|
+
* params, each in the dialog's storage type as the browser run reads it
|
|
47
|
+
* (a shape the dialog never writes, such as a time in epoch milliseconds,
|
|
48
|
+
* normalized through the same derivation), beside the packed host fills
|
|
49
|
+
* (wrunHostedHostFill), which the cloud resolves through the SDK as the
|
|
50
|
+
* browser does. The map stays for every other server (and the alert arm)
|
|
51
|
+
* until the backend floor (the env flip to `shared-v1`) retires it.
|
|
52
|
+
*
|
|
53
|
+
* Worker-safe on purpose (types, the colour helpers and the inputs util
|
|
54
|
+
* only): the cloud createScript is sent from the kScript socket worker,
|
|
55
|
+
* whose runtime graph may not reach i18n or the chart constants
|
|
56
|
+
* (tests/workers/worker-runtime-boundary.spec.ts), which the alert identity
|
|
57
|
+
* module does.
|
|
58
|
+
*/
|
|
59
|
+
import { wrunServerAdmitsSettings, wrunServerAdmitsSymbolText } from './wrun-hosted-wire-caps.js';
|
|
60
|
+
import { isWrunStyleRowKey, packWrunColor, parseWrunColor, wrunHostParamAtDefault, wrunHostParamSetting, } from './wrun-color-settings.util.js';
|
|
61
|
+
import { formatWrunRowLabel } from '../../indicators/controls/technical-script/technical-script-input-rendering.js';
|
|
62
|
+
import { wrunParamControlType, wrunParamValuesFromSettings, wrunRowLabel, } from './wrun-script-inputs.util.js';
|
|
63
|
+
import { isWrunTextParam, wrunTextParamCap, wrunTextParamValue } from './wrun-text-params.util.js';
|
|
64
|
+
/** The declaration types that stand for one sheet param each. */
|
|
65
|
+
const DECLARED_PARAM_TYPES = new Set([
|
|
66
|
+
'number',
|
|
67
|
+
'int',
|
|
68
|
+
'boolean',
|
|
69
|
+
'select',
|
|
70
|
+
'color',
|
|
71
|
+
'time',
|
|
72
|
+
'price',
|
|
73
|
+
'multi',
|
|
74
|
+
'symbol',
|
|
75
|
+
'text',
|
|
76
|
+
]);
|
|
77
|
+
/** The string a hosted lane receives for a text param: the value the chart
|
|
78
|
+
* runs with (wrunTextParamValue: the stored words plain and within the
|
|
79
|
+
* row's max_bytes, else the declared words). A stored value over the cap
|
|
80
|
+
* (saved under a wider cap) therefore goes out as the declared words, the
|
|
81
|
+
* words the chart draws with, instead of a string the host would refuse
|
|
82
|
+
* for a value the user cannot see. The arm identity stays consistent: the
|
|
83
|
+
* alerts engine mints over the string it receives. */
|
|
84
|
+
export function wrunHostedTextValue(param, raw) {
|
|
85
|
+
return wrunTextParamValue(param, raw);
|
|
86
|
+
}
|
|
87
|
+
/** The value a hosted lane receives for a market picker (`host: 'symbol'`),
|
|
88
|
+
* C1: its `EXCHANGE:SYMBOL` text when the setting left its declared default
|
|
89
|
+
* (wrunHostParamAtDefault: not empty, not 0, not the `symbol_default`
|
|
90
|
+
* market), else 0. The text is the setting trimmed, the very text the
|
|
91
|
+
* browser host splits into the bound inputs' exchange and symbol pins
|
|
92
|
+
* (wrunHostParamSetting), so the cloud pins the same market from it; the
|
|
93
|
+
* module's slot stays 0 on every host. */
|
|
94
|
+
function wrunHostedSymbolValue(param, settings) {
|
|
95
|
+
if (wrunHostParamAtDefault(param, settings))
|
|
96
|
+
return 0;
|
|
97
|
+
const picked = wrunHostParamSetting(param, settings);
|
|
98
|
+
return picked?.host === 'symbol' ? picked.text : 0;
|
|
99
|
+
}
|
|
100
|
+
/** The host-filled params by the names the kit generates for them
|
|
101
|
+
* (`market.tick_size()` declares `market_tick_size`, `market.price_precision()`
|
|
102
|
+
* `market_price_precision`, the market facts `market.kind()` /
|
|
103
|
+
* `market.point_value()` / `market.zone()` / `market.quote_is_usd()` the
|
|
104
|
+
* `market_<word>` names, `chart.interval_sec()` / `chart.bg_color()` /
|
|
105
|
+
* `chart.fg_color()` / `chart.up_color()` / `chart.down_color()` /
|
|
106
|
+
* `chart.grid_color()` the `chart_*` names; the extractor refuses any other
|
|
107
|
+
* param under those names). A declaration row carries no `host_fill` word, so
|
|
108
|
+
* the rebuild recovers it here: without it the host context could not fill
|
|
109
|
+
* the param and a hosted lane would evaluate the declared 0 (unavailable). */
|
|
110
|
+
const HOST_FILL_BY_GENERATED_NAME = {
|
|
111
|
+
market_tick_size: 'tick_size',
|
|
112
|
+
market_price_precision: 'price_precision',
|
|
113
|
+
// WRUN-GAPS-1005: the market's facts (the chart's codes, wrun-chart-market-facts.util).
|
|
114
|
+
market_kind: 'kind',
|
|
115
|
+
market_point_value: 'point_value',
|
|
116
|
+
market_zone: 'zone',
|
|
117
|
+
market_quote_is_usd: 'quote_is_usd',
|
|
118
|
+
market_session_open: 'session_open',
|
|
119
|
+
chart_interval_sec: 'interval_sec',
|
|
120
|
+
chart_bg_color: 'bg_color',
|
|
121
|
+
chart_fg_color: 'fg_color',
|
|
122
|
+
// WRUN-STYLE TH-candle-colors: the chart's candle and grid colours, read
|
|
123
|
+
// once at createScript like bg / fg.
|
|
124
|
+
chart_up_color: 'up_color',
|
|
125
|
+
chart_down_color: 'down_color',
|
|
126
|
+
chart_grid_color: 'grid_color',
|
|
127
|
+
};
|
|
128
|
+
/** A declaration's default as the sheet number: a toggle 1/0, a colour its
|
|
129
|
+
* packed number, a symbol or a text 0 (the module's slot), anything else
|
|
130
|
+
* Number(). */
|
|
131
|
+
function declaredDefault(type, raw) {
|
|
132
|
+
if (type === 'boolean')
|
|
133
|
+
return raw === true || raw === 1 || raw === '1' || raw === 'true' ? 1 : 0;
|
|
134
|
+
if (type === 'color') {
|
|
135
|
+
const color = typeof raw === 'string' ? parseWrunColor(raw) : undefined;
|
|
136
|
+
return color === undefined ? 0 : packWrunColor(color);
|
|
137
|
+
}
|
|
138
|
+
if (type === 'symbol' || type === 'text')
|
|
139
|
+
return 0;
|
|
140
|
+
const numeric = typeof raw === 'number' ? raw : typeof raw === 'string' ? Number(raw) : Number.NaN;
|
|
141
|
+
return Number.isFinite(numeric) ? numeric : 0;
|
|
142
|
+
}
|
|
143
|
+
/** A colour-array row's member params (C1: "a `color[]` row carries
|
|
144
|
+
* `members: string[]`; the hosted map holds one packed colour per member
|
|
145
|
+
* name"): one `color` param per member name, in element order, under the
|
|
146
|
+
* row's key (`color_array`), its default element i of the row's default
|
|
147
|
+
* packed. The same shape the sheet declares, so wrunParamValuesFromSettings
|
|
148
|
+
* reads member i at element i of the row's value exactly as the browser run
|
|
149
|
+
* does. A row without a usable member list (persisted before the row
|
|
150
|
+
* carried one) stands for no param: the host keeps the package defaults. */
|
|
151
|
+
function colorArrayMemberParams(key, row) {
|
|
152
|
+
const members = row.members;
|
|
153
|
+
if (!Array.isArray(members) || members.length === 0)
|
|
154
|
+
return [];
|
|
155
|
+
if (!members.every((member) => typeof member === 'string' && member !== '' && !isWrunStyleRowKey(member)))
|
|
156
|
+
return [];
|
|
157
|
+
const defaults = Array.isArray(row.defaultValue) ? row.defaultValue : [];
|
|
158
|
+
return members.map((member, at) => ({
|
|
159
|
+
name: member,
|
|
160
|
+
type: 'color',
|
|
161
|
+
default: declaredDefault('color', defaults[at]),
|
|
162
|
+
color_array: key,
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A sheet's `params` slice rebuilt from an overlay's declared inputs
|
|
167
|
+
* (`settings.scriptInputs`, buildWrunScriptInputs' flat list): the lane
|
|
168
|
+
* that holds no sheet (the cloud createScript runs in the worker, which
|
|
169
|
+
* never sees the registry's metadata) derives its numbers through the same
|
|
170
|
+
* function the run path uses. One row per typed param (composite members
|
|
171
|
+
* are rows of their own, so a range, list, session or unit arrives as its
|
|
172
|
+
* members; a select keeps its options and their labels, a multi its labels,
|
|
173
|
+
* one per bit); a colour-array row arrives as its member params (C1,
|
|
174
|
+
* colorArrayMemberParams); a virtual composite, a Style page row, a
|
|
175
|
+
* divider, a note and an om line-style knob (a select whose values are style
|
|
176
|
+
* names, never numbers) stand for no param and are left to the host's own
|
|
177
|
+
* defaults. A host-filled param keeps its `host_fill` word (by its generated
|
|
178
|
+
* name), so the host context fills it like the run path does. A text row
|
|
179
|
+
* (wrun-5) rebuilds its words, byte cap and line mode, so the lane caps and
|
|
180
|
+
* cleans the typed value exactly as the dialog did. A market picker keeps its
|
|
181
|
+
* declared market (`symbol_default`, the row's default), so a pick of that
|
|
182
|
+
* market rides as 0 like on the sheet.
|
|
183
|
+
*/
|
|
184
|
+
export function wrunSheetParamsFromDeclarations(declarations) {
|
|
185
|
+
if (!Array.isArray(declarations))
|
|
186
|
+
return [];
|
|
187
|
+
const params = [];
|
|
188
|
+
for (const row of declarations) {
|
|
189
|
+
if (!row || typeof row.name !== 'string' || row.name === '' || isWrunStyleRowKey(row.name))
|
|
190
|
+
continue;
|
|
191
|
+
if (row.type === 'color[]') {
|
|
192
|
+
params.push(...colorArrayMemberParams(row.name, row));
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (row.virtual === true || typeof row.type !== 'string' || !DECLARED_PARAM_TYPES.has(row.type))
|
|
196
|
+
continue;
|
|
197
|
+
const type = row.type;
|
|
198
|
+
const options = Array.isArray(row.options) ? row.options.map(Number) : undefined;
|
|
199
|
+
if (type === 'select' && options?.some((value) => !Number.isFinite(value)))
|
|
200
|
+
continue;
|
|
201
|
+
// The labels ride with the options: a choice persisted by its label (a
|
|
202
|
+
// preset's spelling) resolves to its value here as it does in the dialog.
|
|
203
|
+
const labels = Array.isArray(row.optionLabels) && row.optionLabels.every((label) => typeof label === 'string')
|
|
204
|
+
? row.optionLabels
|
|
205
|
+
: undefined;
|
|
206
|
+
const hostFill = HOST_FILL_BY_GENERATED_NAME[row.name];
|
|
207
|
+
const symbolDefault = type === 'symbol' && typeof row.defaultValue === 'string' && row.defaultValue.trim() !== ''
|
|
208
|
+
? row.defaultValue
|
|
209
|
+
: undefined;
|
|
210
|
+
params.push({
|
|
211
|
+
name: row.name,
|
|
212
|
+
type,
|
|
213
|
+
default: declaredDefault(type, row.defaultValue),
|
|
214
|
+
...(type === 'select' && options !== undefined && options.length > 0
|
|
215
|
+
? { options, ...(labels !== undefined ? { option_labels: labels } : {}) }
|
|
216
|
+
: {}),
|
|
217
|
+
// A multi's labels are its bits: the run reads a mask past them down to them (wrunMultiLabels).
|
|
218
|
+
...(type === 'multi' && labels !== undefined && labels.length > 0 ? { option_labels: labels } : {}),
|
|
219
|
+
...(type === 'symbol'
|
|
220
|
+
? { host: 'symbol', ...(symbolDefault !== undefined ? { symbol_default: symbolDefault } : {}) }
|
|
221
|
+
: {}),
|
|
222
|
+
...(type === 'text'
|
|
223
|
+
? {
|
|
224
|
+
text_default: typeof row.defaultValue === 'string' ? row.defaultValue : '',
|
|
225
|
+
max_bytes: wrunTextParamCap({ max_bytes: row.maxBytes }),
|
|
226
|
+
multiline: row.multiline === true,
|
|
227
|
+
}
|
|
228
|
+
: {}),
|
|
229
|
+
...(hostFill !== undefined ? { host_fill: hostFill, hidden: true } : {}),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
return params;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The param map a hosted lane sends (the alerts arm, the cloud createScript):
|
|
236
|
+
* the run path's own derivation over the sheet (packed finite numbers, sheet
|
|
237
|
+
* params only, never a Style page row or a virtual composite), or over the
|
|
238
|
+
* params rebuilt from the overlay's declared inputs when no sheet is at hand.
|
|
239
|
+
* A non-finite value is dropped (the host falls back to the package default).
|
|
240
|
+
* `host` is the chart market the overlay runs on (its tick size and price
|
|
241
|
+
* precision, its four facts): the host-filled params take their values from
|
|
242
|
+
* it, the way the browser run fills them, so a tick-based threshold or a
|
|
243
|
+
* market-kind branch evaluates like the chart; without it they ride at their
|
|
244
|
+
* declared default (0 = unavailable). A text
|
|
245
|
+
* param (wrun-5) rides as the chart's run value (the stored words plain and
|
|
246
|
+
* within max_bytes, else the declared words): the alerts engine and the
|
|
247
|
+
* cloud executor apply the plain-text rule and the byte cap again on their
|
|
248
|
+
* side and refuse a non-string by name, then serve the words through their
|
|
249
|
+
* text channel, so they never refuse what the chart runs. A colour array
|
|
250
|
+
* rides as its members' packed colours and a market picker as its
|
|
251
|
+
* `EXCHANGE:SYMBOL` text when the pick left its default and `serverCaps`
|
|
252
|
+
* admit the text, else 0 (C1 and its rollout rule, see the module header):
|
|
253
|
+
* the cloud pins the bound inputs to that market like the browser host does,
|
|
254
|
+
* and the alert arm refuses a moved market before this map reaches the
|
|
255
|
+
* alerts engine (wrunHostParamOverride). No caps (the default) is a server
|
|
256
|
+
* that admits no text.
|
|
257
|
+
*/
|
|
258
|
+
export function wrunHostedParamValues(settings, metadata, host, serverCaps = []) {
|
|
259
|
+
const sheet = metadata !== undefined && Array.isArray(metadata.params)
|
|
260
|
+
? metadata
|
|
261
|
+
: { params: wrunSheetParamsFromDeclarations(settings?.scriptInputs) };
|
|
262
|
+
return wrunHostedParamsOf(sheet, settings, wrunParamValuesFromSettings(sheet, settings, host), serverCaps);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The hosted param map (wrunHostedParamValues) over numbers already derived from the same settings
|
|
266
|
+
* (wrunParamValuesFromSettings): a run that derived its values stamps what it computed without
|
|
267
|
+
* deriving them twice. Text params read the settings, a market picker its pick while `serverCaps`
|
|
268
|
+
* admit the text (C1: its `EXCHANGE:SYMBOL` text when off its default, else 0,
|
|
269
|
+
* wrunHostedSymbolValue) and its number otherwise (0, the map before C1), numbers the values (a
|
|
270
|
+
* colour array's members included), a non-finite one dropped. The one per-param rule every hosted
|
|
271
|
+
* map passes through: the cloud createScript (with its socket's caps), Run once in Cloud, the alert
|
|
272
|
+
* arm and the browser run's arm identity (wrun-overlay-run.util, these three with none) all read
|
|
273
|
+
* it, so they agree on every param under the same caps.
|
|
274
|
+
*/
|
|
275
|
+
export function wrunHostedParamsOf(sheet, settings, values, serverCaps = []) {
|
|
276
|
+
const flat = settings !== null && typeof settings === 'object' ? settings : undefined;
|
|
277
|
+
const symbolText = wrunServerAdmitsSymbolText(serverCaps);
|
|
278
|
+
const params = {};
|
|
279
|
+
for (const param of sheet.params ?? []) {
|
|
280
|
+
if (isWrunTextParam(param)) {
|
|
281
|
+
params[param.name] = wrunHostedTextValue(param, flat?.[param.name]);
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (param.host === 'symbol' && symbolText) {
|
|
285
|
+
params[param.name] = wrunHostedSymbolValue(param, settings);
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
const value = values[param.name];
|
|
289
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
290
|
+
params[param.name] = value;
|
|
291
|
+
}
|
|
292
|
+
return params;
|
|
293
|
+
}
|
|
294
|
+
/** The declared params of an overlay's persisted rows (`settings.scriptInputs`), as the map
|
|
295
|
+
* rebuilds them (wrunSheetParamsFromDeclarations). */
|
|
296
|
+
function declaredParamsOf(settings) {
|
|
297
|
+
return wrunSheetParamsFromDeclarations(settings?.scriptInputs);
|
|
298
|
+
}
|
|
299
|
+
/** A stored setting in the dialog's storage type for its control, holding what the browser run reads
|
|
300
|
+
* from it (`value`, wrunParamValuesFromSettings over the same param): a toggle its boolean, a select
|
|
301
|
+
* its option, a time, a multi or any other number the number the run takes. So a shape the dialog
|
|
302
|
+
* never writes (a time in epoch milliseconds or as a date text, a multi as a list of bit indexes or
|
|
303
|
+
* with bits past its labels, a toggle as an on or off word, a select by its label or by an index past
|
|
304
|
+
* its options) reaches the kit as the value the browser runs with, never one the kit reads another
|
|
305
|
+
* way or refuses. A colour and a market pick ride as stored: the kit reads their spellings the
|
|
306
|
+
* browser's way (a colour word or packed number; the market text a pick pins). No setting is no
|
|
307
|
+
* value. */
|
|
308
|
+
function wrunHostedStoredValue(param, raw, value) {
|
|
309
|
+
if (raw === undefined)
|
|
310
|
+
return undefined;
|
|
311
|
+
switch (wrunParamControlType(param)) {
|
|
312
|
+
case 'color':
|
|
313
|
+
case 'symbol':
|
|
314
|
+
return raw;
|
|
315
|
+
case 'boolean':
|
|
316
|
+
return value !== 0;
|
|
317
|
+
case 'select':
|
|
318
|
+
return String(value);
|
|
319
|
+
default:
|
|
320
|
+
return value;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* The settings record of an overlay (C4): for each sheet param its declared inputs stand for (the
|
|
325
|
+
* params the map rebuilds, wrunSheetParamsFromDeclarations: never a Style page row, a virtual
|
|
326
|
+
* composite or a line-style knob), the value the overlay holds in the dialog's storage type, read
|
|
327
|
+
* the browser run's way (wrunHostedStoredValue), so the kit resolves every slot to the browser's init
|
|
328
|
+
* arg whatever shape the setting was stored in. A colour array rides as its row's colour list under
|
|
329
|
+
* the row's key (every `color[]` row the overlay holds, members named or not): kscript-backend lays
|
|
330
|
+
* element i onto the sheet's member i before the kit resolves the params (wrunSharedSettings), the
|
|
331
|
+
* browser run's own read. A text param rides as the words the chart runs with (wrunHostedTextValue:
|
|
332
|
+
* the stored words plain and within the row's byte cap, else the declared words), so the cloud never
|
|
333
|
+
* refuses words the chart draws. A host-filled param rides in the host fills (wrunHostedHostFill)
|
|
334
|
+
* instead, and a param the overlay holds no value for is absent: the cloud resolves it at the
|
|
335
|
+
* sheet's own default, as the browser run does.
|
|
336
|
+
*/
|
|
337
|
+
export function wrunHostedSettingsRecord(settings) {
|
|
338
|
+
const flat = isPlainRecord(settings) ? settings : undefined;
|
|
339
|
+
const params = declaredParamsOf(settings);
|
|
340
|
+
const values = wrunParamValuesFromSettings({ params }, flat);
|
|
341
|
+
const record = {};
|
|
342
|
+
const hold = (name, value) => {
|
|
343
|
+
if (value !== undefined && !Object.hasOwn(record, name))
|
|
344
|
+
record[name] = value;
|
|
345
|
+
};
|
|
346
|
+
for (const param of params) {
|
|
347
|
+
if (param.host_fill !== undefined)
|
|
348
|
+
continue;
|
|
349
|
+
if (param.color_array !== undefined)
|
|
350
|
+
hold(param.color_array, flat?.[param.color_array]);
|
|
351
|
+
else if (isWrunTextParam(param))
|
|
352
|
+
record[param.name] = wrunHostedTextValue(param, flat?.[param.name]);
|
|
353
|
+
else
|
|
354
|
+
hold(param.name, wrunHostedStoredValue(param, flat?.[param.name], values[param.name]));
|
|
355
|
+
}
|
|
356
|
+
// A colour array persisted before its row named its members stands for no rebuilt param; the
|
|
357
|
+
// cloud lays it out by its own sheet all the same.
|
|
358
|
+
const rows = settings?.scriptInputs;
|
|
359
|
+
for (const row of Array.isArray(rows) ? rows : []) {
|
|
360
|
+
if (isPlainRecord(row) && row.type === 'color[]' && typeof row.name === 'string' && row.name !== '') {
|
|
361
|
+
hold(row.name, flat?.[row.name]);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return record;
|
|
365
|
+
}
|
|
366
|
+
/** A settings-record session's `changeSettings` patch (C5): the record of the settings asked for,
|
|
367
|
+
* whole, and `null` for every name the record the cloud holds has and the asked one lacks (a value
|
|
368
|
+
* the settings dropped: kscript-backend resets a null param to its default, a null colour array's
|
|
369
|
+
* members to theirs). The cloud merges the patch over its record, so the two end equal. */
|
|
370
|
+
export function wrunHostedSettingsPatch(held, asked) {
|
|
371
|
+
const patch = wrunHostedSettingsRecord(asked);
|
|
372
|
+
for (const name of Object.keys(wrunHostedSettingsRecord(held))) {
|
|
373
|
+
if (!Object.hasOwn(patch, name))
|
|
374
|
+
patch[name] = null;
|
|
375
|
+
}
|
|
376
|
+
return patch;
|
|
377
|
+
}
|
|
378
|
+
/** Each host-fill word and the chart context key it packs from (paramRunValue's reads), in the kit's
|
|
379
|
+
* order: the market's tick size and decimals, the chart's interval seconds and five colours, the
|
|
380
|
+
* market's five facts. */
|
|
381
|
+
export const WRUN_HOST_FILL_WORDS = [
|
|
382
|
+
['tick_size', 'tickSize'],
|
|
383
|
+
['price_precision', 'pricePrecision'],
|
|
384
|
+
['interval_sec', 'intervalSec'],
|
|
385
|
+
['bg_color', 'bgColor'],
|
|
386
|
+
['fg_color', 'fgColor'],
|
|
387
|
+
['up_color', 'upColor'],
|
|
388
|
+
['down_color', 'downColor'],
|
|
389
|
+
['grid_color', 'gridColor'],
|
|
390
|
+
['kind', 'kind'],
|
|
391
|
+
['point_value', 'pointValue'],
|
|
392
|
+
['zone', 'zone'],
|
|
393
|
+
['quote_is_usd', 'quoteIsUsd'],
|
|
394
|
+
['session_open', 'sessionOpen'],
|
|
395
|
+
];
|
|
396
|
+
/** The host fills of a chart context (`wrunHostFill`, the pane's market and chart words, packed the
|
|
397
|
+
* way the browser run fills them) by host-fill word: finite numbers only, in the kit's order; none
|
|
398
|
+
* (undefined) for no context or a context holding none. */
|
|
399
|
+
export function wrunHostedHostFill(context) {
|
|
400
|
+
if (context === undefined)
|
|
401
|
+
return undefined;
|
|
402
|
+
const fill = {};
|
|
403
|
+
for (const [word, key] of WRUN_HOST_FILL_WORDS) {
|
|
404
|
+
const value = context[key];
|
|
405
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
406
|
+
fill[word] = value;
|
|
407
|
+
}
|
|
408
|
+
return Object.keys(fill).length > 0 ? fill : undefined;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* A hosted overlay's createScript settings under its socket's server caps (C4 and its rollout
|
|
412
|
+
* amendment): to a server whose hello admitted the settings record (`wrun-settings-v1`) the record
|
|
413
|
+
* (wrunHostedSettingsRecord) and the chart context's host fills beside it (`hostFill`, always an
|
|
414
|
+
* object: `{}` when no context is known, since its presence is what marks the create as a record);
|
|
415
|
+
* to any other the numeric param map with the context folded in (wrunHostedParamValues, the market
|
|
416
|
+
* text by its own cap) and no `hostFill`, exactly as before. The kScript socket worker's one call.
|
|
417
|
+
*/
|
|
418
|
+
export function wrunHostedCreateSettings(settings, host, serverCaps = []) {
|
|
419
|
+
if (!wrunServerAdmitsSettings(serverCaps)) {
|
|
420
|
+
return { settings: wrunHostedParamValues(settings, undefined, host, serverCaps) };
|
|
421
|
+
}
|
|
422
|
+
return { settings: wrunHostedSettingsRecord(settings), hostFill: wrunHostedHostFill(host) ?? {} };
|
|
423
|
+
}
|
|
424
|
+
/** True when an overlay's declared inputs hold a market picker whose setting left its default: the
|
|
425
|
+
* one value of the hosted map the symbol-text cap changes (wrunHostedSymbolValue). The kScript
|
|
426
|
+
* socket worker keys a hosted session's caps on it (needsRecreation): a createScript built before
|
|
427
|
+
* its socket's hello landed sent such a pick as 0, and only an overlay holding one recreates once
|
|
428
|
+
* the hello admits the text. */
|
|
429
|
+
export function wrunHostedSymbolPicked(settings) {
|
|
430
|
+
return declaredParamsOf(settings).some((param) => param.host === 'symbol' && wrunHostedSymbolValue(param, settings) !== 0);
|
|
431
|
+
}
|
|
432
|
+
/** Each chart-colour host fill and the `wrunHostFill` key it packs from (paramRunValue's reads), in
|
|
433
|
+
* the fixed order. */
|
|
434
|
+
const CHART_COLOR_HOST_FILLS = [
|
|
435
|
+
['bg_color', 'bgColor'],
|
|
436
|
+
['fg_color', 'fgColor'],
|
|
437
|
+
['up_color', 'upColor'],
|
|
438
|
+
['down_color', 'downColor'],
|
|
439
|
+
['grid_color', 'gridColor'],
|
|
440
|
+
];
|
|
441
|
+
/** The packed chart colours (their `wrunHostFill` keys) the hosted map of an overlay's declared
|
|
442
|
+
* inputs carries, in the fixed order: one per chart-colour host fill its rows declare
|
|
443
|
+
* (`chart.bg_color()`, `chart.fg_color()`, `chart.up_color()`, `chart.down_color()`,
|
|
444
|
+
* `chart.grid_color()`, recovered by the names the kit generates, as the map rebuilds them); none
|
|
445
|
+
* for an overlay that reads no chart colour. The theme pass reruns a sheet by the same host-fill
|
|
446
|
+
* words (wrun-chart-context-theme.util), and the kScript socket worker keys a hosted session on
|
|
447
|
+
* these colours only (needsRecreation). */
|
|
448
|
+
export function wrunHostedChartColorKeys(settings) {
|
|
449
|
+
const read = new Set(declaredParamsOf(settings).map((param) => param.host_fill));
|
|
450
|
+
return CHART_COLOR_HOST_FILLS.filter(([word]) => read.has(word)).map(([, key]) => key);
|
|
451
|
+
}
|
|
452
|
+
/** The key the main thread puts the chart's coin under, beside a hosted
|
|
453
|
+
* overlay's settings and their `wrunHostFill` (technical-script
|
|
454
|
+
* getReqPayload). The kScript socket worker lifts the coin to the
|
|
455
|
+
* createScript payload's top-level `coin`, the one place the cloud's planner
|
|
456
|
+
* reads it from, and never sends the key itself. */
|
|
457
|
+
export const WRUN_CHART_COIN_KEY = 'wrunChartCoin';
|
|
458
|
+
/** The chart's coin as a hosted run sends it (Run once's rule over the chart
|
|
459
|
+
* metadata's `coin`): a non-empty string, else none. The cloud plans an
|
|
460
|
+
* implied volatility or skew input without a market pin on it and refuses
|
|
461
|
+
* that input by name when the coin is unknown. */
|
|
462
|
+
export function wrunChartCoin(value) {
|
|
463
|
+
return typeof value === 'string' && value !== '' ? value : undefined;
|
|
464
|
+
}
|
|
465
|
+
/** The fact lists this client sends and a refusal may ask for (the `wrunFacts` list keys), in their
|
|
466
|
+
* fixed order. The session type is no list: it always rides, so no refusal names it. */
|
|
467
|
+
export const WRUN_HOSTED_FACT_KINDS = ['etfFlowTickers', 'etfFunds'];
|
|
468
|
+
/** The lists a refusal's `needsFacts` (`details.wrunRefusal.needsFacts` on the cloud's error frame
|
|
469
|
+
* for a list an input reads that was absent) names and this client knows, once each, in the fixed
|
|
470
|
+
* order: none for a value that is not an array; an unknown name is dropped. */
|
|
471
|
+
export function readWrunNeededFacts(value) {
|
|
472
|
+
if (!Array.isArray(value))
|
|
473
|
+
return [];
|
|
474
|
+
return WRUN_HOSTED_FACT_KINDS.filter((kind) => value.includes(kind));
|
|
475
|
+
}
|
|
476
|
+
/** The key the main thread puts a hosted overlay's facts under, beside its settings (technical-script
|
|
477
|
+
* getReqPayload), only beside the hosted wire cap: the chart's session type and lane fills always, the ETF lists
|
|
478
|
+
* (through wrun-etf-funds.util) only for a sheet that reads an ETF source. The kScript socket
|
|
479
|
+
* worker lifts them to the createScript payload's `wrunFacts`, the one place the cloud reads them
|
|
480
|
+
* from, and never sends the key itself. */
|
|
481
|
+
export const WRUN_HOSTED_FACTS_KEY = 'wrunHostedFacts';
|
|
482
|
+
function isPlainRecord(value) {
|
|
483
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
484
|
+
}
|
|
485
|
+
/** Non-empty string tickers, once each, in order; none (undefined) for no such entry. */
|
|
486
|
+
function readTickers(value) {
|
|
487
|
+
if (!Array.isArray(value))
|
|
488
|
+
return undefined;
|
|
489
|
+
const tickers = [];
|
|
490
|
+
for (const ticker of value) {
|
|
491
|
+
if (typeof ticker === 'string' && ticker !== '' && !tickers.includes(ticker))
|
|
492
|
+
tickers.push(ticker);
|
|
493
|
+
}
|
|
494
|
+
return tickers.length > 0 ? tickers : undefined;
|
|
495
|
+
}
|
|
496
|
+
/** Funds with a non-empty string ticker (its issuer when that is a non-empty string), once per
|
|
497
|
+
* ticker, in order; none (undefined) for no such entry. */
|
|
498
|
+
function readFunds(value) {
|
|
499
|
+
if (!Array.isArray(value))
|
|
500
|
+
return undefined;
|
|
501
|
+
const funds = [];
|
|
502
|
+
for (const entry of value) {
|
|
503
|
+
if (!isPlainRecord(entry))
|
|
504
|
+
continue;
|
|
505
|
+
const { ticker, issuer } = entry;
|
|
506
|
+
if (typeof ticker !== 'string' || ticker === '' || funds.some((fund) => fund.ticker === ticker))
|
|
507
|
+
continue;
|
|
508
|
+
funds.push(typeof issuer === 'string' && issuer !== '' ? { ticker, issuer } : { ticker });
|
|
509
|
+
}
|
|
510
|
+
return funds.length > 0 ? funds : undefined;
|
|
511
|
+
}
|
|
512
|
+
/** One of the two session words; none (undefined) for anything else. */
|
|
513
|
+
function readSessionType(value) {
|
|
514
|
+
return value === 'regular' || value === 'extended' ? value : undefined;
|
|
515
|
+
}
|
|
516
|
+
/** The lane fills when both are finite numbers; none (undefined) otherwise. */
|
|
517
|
+
function readLaneFills(value) {
|
|
518
|
+
if (!isPlainRecord(value))
|
|
519
|
+
return undefined;
|
|
520
|
+
const { kind, point_value: pointValue, zone } = value;
|
|
521
|
+
if (!(typeof pointValue === 'number' &&
|
|
522
|
+
Number.isFinite(pointValue) &&
|
|
523
|
+
typeof zone === 'number' &&
|
|
524
|
+
Number.isFinite(zone))) {
|
|
525
|
+
return undefined;
|
|
526
|
+
}
|
|
527
|
+
return typeof kind === 'number' && Number.isFinite(kind)
|
|
528
|
+
? { kind, point_value: pointValue, zone }
|
|
529
|
+
: { point_value: pointValue, zone };
|
|
530
|
+
}
|
|
531
|
+
/** The facts a carrier value holds, as the cloud receives them, in one fixed key order: each list
|
|
532
|
+
* shape-checked on its own (`readTickers`, `readFunds`) and present only when it holds an entry,
|
|
533
|
+
* the session type only when it is one of its two words, the lane fills only when the point value
|
|
534
|
+
* and the zone are finite numbers (the kind beside them when it is one too). A value that is not a
|
|
535
|
+
* record, or holds none of the four, reads as none (undefined): the wire never carries an empty list
|
|
536
|
+
* or an empty `wrunFacts`. */
|
|
537
|
+
export function readWrunHostedFacts(value) {
|
|
538
|
+
if (!isPlainRecord(value))
|
|
539
|
+
return undefined;
|
|
540
|
+
const etfFlowTickers = readTickers(value.etfFlowTickers);
|
|
541
|
+
const etfFunds = readFunds(value.etfFunds);
|
|
542
|
+
const sessionType = readSessionType(value.sessionType);
|
|
543
|
+
const hostFills = readLaneFills(value.hostFills);
|
|
544
|
+
if (etfFlowTickers === undefined && etfFunds === undefined && sessionType === undefined && hostFills === undefined) {
|
|
545
|
+
return undefined;
|
|
546
|
+
}
|
|
547
|
+
return {
|
|
548
|
+
...(etfFlowTickers ? { etfFlowTickers } : {}),
|
|
549
|
+
...(etfFunds ? { etfFunds } : {}),
|
|
550
|
+
...(sessionType ? { sessionType } : {}),
|
|
551
|
+
...(hostFills ? { hostFills } : {}),
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
/** A carrier value as session identity: the facts it holds, spelled exactly ('' for none), the
|
|
555
|
+
* session type included. Two settings whose identities differ ask for different hosted sessions:
|
|
556
|
+
* a list that landed or changed, or a chart flipped between Regular and Extended. */
|
|
557
|
+
export function wrunHostedFactsIdentity(value) {
|
|
558
|
+
const facts = readWrunHostedFacts(value);
|
|
559
|
+
return facts === undefined ? '' : JSON.stringify(facts);
|
|
560
|
+
}
|
|
561
|
+
/** The row label of a param as the settings dialog shows it (wrunRowLabel,
|
|
562
|
+
* formatWrunRowLabel): its `label`, else its name read as words
|
|
563
|
+
* (`show_labels` -> "Show labels"); a description is never a label (for a
|
|
564
|
+
* port it is the encoding legend written for agents). */
|
|
565
|
+
export function wrunParamRowLabel(param) {
|
|
566
|
+
return formatWrunRowLabel(wrunRowLabel({ name: param.name, label: param.label ?? '' }));
|
|
567
|
+
}
|
|
568
|
+
/** The alert arm's refusal only (C1 narrowed it): the first host-applied
|
|
569
|
+
* param the alerts engine cannot apply whose setting left its declared
|
|
570
|
+
* default, undefined when the arm may proceed. It is no hosted-lane rule any
|
|
571
|
+
* more: the cloud applies a timeframe pick (its select index over the
|
|
572
|
+
* sheet's `interval_param`) and a market pick (its text, wrunHostedSymbolValue)
|
|
573
|
+
* as the browser host does, so the Cloud dialog shows those rows like the
|
|
574
|
+
* browser one, with no lane hint. The alerts engine (kscript-alerts) still
|
|
575
|
+
* plans from the sheet's own pins: a source pick arms (it rides as its index
|
|
576
|
+
* into the nine source words, which the engine reads; hlcc4 is 8), a
|
|
577
|
+
* timeframe or symbol pick refuses, since the armed rule would silently
|
|
578
|
+
* evaluate another series than the chart draws. */
|
|
579
|
+
export function wrunHostParamOverride(metadata, settings) {
|
|
580
|
+
return (metadata.params ?? []).find((param) => param.host !== undefined && param.host !== 'source' && !wrunHostParamAtDefault(param, settings));
|
|
581
|
+
}
|
|
@@ -34,6 +34,14 @@ export interface WrunHostFillContext {
|
|
|
34
34
|
* it from wrunMarketFactsFor now; paramRunValue reads it once the chart's
|
|
35
35
|
* kit pin (0.65.0) has the `session_open` host_fill word. */
|
|
36
36
|
sessionOpen?: number;
|
|
37
|
+
/** UW-PARITY S8, the issuer's earnings facts (wrun-earnings-facts.util, the
|
|
38
|
+
* browser run alone): `market.earnings_next_ms()` and
|
|
39
|
+
* `market.earnings_prev_ms()` in epoch ms, `market.earnings_session()` +1
|
|
40
|
+
* before the open, -1 after the close; 0 for each one the chart does not
|
|
41
|
+
* know. */
|
|
42
|
+
earningsNextMs?: number;
|
|
43
|
+
earningsPrevMs?: number;
|
|
44
|
+
earningsSession?: number;
|
|
37
45
|
}
|
|
38
46
|
export declare function nonEmptyString(value: unknown): string | undefined;
|
|
39
47
|
export declare function finiteNumber(value: unknown): number | undefined;
|
|
@@ -129,6 +129,14 @@ function paramRunValue(param, flat, host) {
|
|
|
129
129
|
return finiteOr(finiteNumber(host?.quoteIsUsd), fallback);
|
|
130
130
|
if (param.host_fill === 'session_open')
|
|
131
131
|
return finiteOr(finiteNumber(host?.sessionOpen), fallback);
|
|
132
|
+
// The earnings words (om WRUN_EARNINGS_FACT_FILLS), read before the kit pin names them.
|
|
133
|
+
const fill = param.host_fill;
|
|
134
|
+
if (fill === 'earnings_next_ms')
|
|
135
|
+
return finiteOr(finiteNumber(host?.earningsNextMs), fallback);
|
|
136
|
+
if (fill === 'earnings_prev_ms')
|
|
137
|
+
return finiteOr(finiteNumber(host?.earningsPrevMs), fallback);
|
|
138
|
+
if (fill === 'earnings_session')
|
|
139
|
+
return finiteOr(finiteNumber(host?.earningsSession), fallback);
|
|
132
140
|
const raw = flat?.[param.name];
|
|
133
141
|
switch (param.type) {
|
|
134
142
|
case 'symbol':
|