@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,354 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The market facts a wrun indicator reads per bar (WRUN-SESSIONS contract
|
|
3
|
+
* C3): `time.trade_date` and `time.session`. Both are facts of the bar's
|
|
4
|
+
* market (exchange, symbol), its interval and its open time ONLY, never of
|
|
5
|
+
* the chart's RTH / extended mode, and every hour comes from the chart's own
|
|
6
|
+
* session definitions, the RTH window from the kScript engine's table (see
|
|
7
|
+
* NYMEX below).
|
|
8
|
+
*
|
|
9
|
+
* Calendar bars (an interval of one day or longer: 1D, 3D, 1W, 1M) read the
|
|
10
|
+
* UTC date of their open stamp and 1 on every market: the chart stamps them
|
|
11
|
+
* at 00:00 UTC of their trade date, an instant the intraday rules below would
|
|
12
|
+
* read as the previous New York evening (amendment 10-01). Intraday bars:
|
|
13
|
+
*
|
|
14
|
+
* - trade date, epoch SECONDS at 00:00 UTC of the bar's exchange trade date:
|
|
15
|
+
* - CME family (`isCmeGoverned`: CME, CBOT, NYMEX, COMEX and the GLOBEX
|
|
16
|
+
* alias): the chart's CME trade date, `cmeSessionBucketMs(t, 1d)`, so the
|
|
17
|
+
* 17:00 Chicago open belongs to the NEXT date;
|
|
18
|
+
* - US equities (`getMarketKind` 'tradfi'): the New York calendar date;
|
|
19
|
+
* - everything else (crypto, forex, HIP-3, Polymarket, ...): the UTC date.
|
|
20
|
+
* - session, 1 regular, 2 pre-market, 3 after-hours, 0 closed:
|
|
21
|
+
* - US equities: `resolveUsEquitySessionPhase`;
|
|
22
|
+
* - CME family: 0 while the weekly schedule says closed
|
|
23
|
+
* (`getGovernedFuturesScheduleStatusForSymbol`, which carries the 24/7
|
|
24
|
+
* roots); else 1 inside the engine's RTH window
|
|
25
|
+
* (`engineRthWindowForSymbol`, 09:30 to 16:15 New York on every mapped
|
|
26
|
+
* root; a root without a window is regular all session), 2 before its
|
|
27
|
+
* trade date's RTH window and 3 after it;
|
|
28
|
+
* - everything else: 1.
|
|
29
|
+
*
|
|
30
|
+
* The golden vectors every other host (kscript-alerts, kscript-backend, om)
|
|
31
|
+
* tests against are generated from this module:
|
|
32
|
+
* src/fixtures/wrun-session-facts/golden.json.
|
|
33
|
+
*
|
|
34
|
+
* NYMEX: the chart judges RTH there on the energy pit session, 09:00 to 14:30
|
|
35
|
+
* New York (rth-session.util `rthWindowForExchange`, the gateway's REGULAR
|
|
36
|
+
* window), but wrun and kScript session facts on NYMEX follow the kScript
|
|
37
|
+
* engine's table, 09:30 to 16:15, until a coordinated change moves the
|
|
38
|
+
* engine, the golden and the cloud lanes together. Moving this browser lane
|
|
39
|
+
* alone would split the browser and cloud runs of the same indicator.
|
|
40
|
+
*
|
|
41
|
+
* Cost: the definitions run at microseconds a call (the equities phase reads
|
|
42
|
+
* dayjs timezone parts, about 30 us), so a 50k-bar run cannot afford one per
|
|
43
|
+
* bar. Each is memoized on the grain it is constant on, always evaluated at
|
|
44
|
+
* the START of that grain so a result never depends on call order:
|
|
45
|
+
* - the venue-zone calendar day (Intl parts, host-independent: the dayjs
|
|
46
|
+
* drift caveat in rth-session.util never applies), once per local day;
|
|
47
|
+
* - the CME schedule per Chicago (weekday, hour): its boundaries are whole
|
|
48
|
+
* Chicago hours (16:00 and 17:00, the Saturday 02:00 to 04:00 window);
|
|
49
|
+
* - the equities phase per New York (weekday, half hour): its boundaries are
|
|
50
|
+
* 04:00, 09:30, 16:00 and 20:00;
|
|
51
|
+
* - the CME RTH window per (window, trade date).
|
|
52
|
+
* Both zones sit a whole number of hours off UTC, so a reader also keeps its
|
|
53
|
+
* last answer per UTC hour (CME: the trade date and the schedule bit) or half
|
|
54
|
+
* hour (equities), and a sorted walk pays the lookups once per grain, not per
|
|
55
|
+
* bar. The spec walks every minute of both 2026 DST weeks against the
|
|
56
|
+
* definitions themselves, so a boundary moved off those grains fails there,
|
|
57
|
+
* not in the field, and measures 50k one-minute bars from a cold module.
|
|
58
|
+
*
|
|
59
|
+
* Worker-safe: imports only the chart's session utils (no Vue, store, i18n).
|
|
60
|
+
*/
|
|
61
|
+
import { Intervals } from '../../constants/interval.constants.js';
|
|
62
|
+
import { cmeSessionBucketMs } from './cme-session-bucket.util.js';
|
|
63
|
+
import { isCmeGoverned } from './cme-realtime.util.js';
|
|
64
|
+
import { getMarketKind } from './marketKind.util.js';
|
|
65
|
+
import { getGovernedFuturesScheduleStatusForSymbol, GOVERNED_FUTURES_TIME_ZONE, isCmeAlwaysOnSymbol, } from './market-session-schedule.util.js';
|
|
66
|
+
import { engineRthWindowForSymbol, sessionWindowsInRange, } from './rth-session.util.js';
|
|
67
|
+
import { resolveUsEquitySessionPhase, US_EQUITIES_TIME_ZONE, } from './us-equities-session.util.js';
|
|
68
|
+
const MINUTE_MS = 60_000;
|
|
69
|
+
const HALF_HOUR_MS = 30 * MINUTE_MS;
|
|
70
|
+
const HOUR_MS = 60 * MINUTE_MS;
|
|
71
|
+
const DAY_MS = 24 * HOUR_MS;
|
|
72
|
+
const ONE_DAY_INTERVAL_MS = Intervals.map_unit['1d'];
|
|
73
|
+
/** The `time.session` codes (contract C3). */
|
|
74
|
+
export const WRUN_BAR_SESSION = Object.freeze({
|
|
75
|
+
closed: 0,
|
|
76
|
+
regular: 1,
|
|
77
|
+
premarket: 2,
|
|
78
|
+
afterHours: 3,
|
|
79
|
+
});
|
|
80
|
+
export function wrunBarFactsMarketOf(exchange) {
|
|
81
|
+
if (isCmeGoverned(exchange))
|
|
82
|
+
return 'cme';
|
|
83
|
+
return getMarketKind(exchange) === 'tradfi' ? 'us_equities' : 'utc';
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The venue of chart metadata (or a live context's market) at the series'
|
|
87
|
+
* bar interval: undefined unless exchange and symbol are non-empty strings and
|
|
88
|
+
* the interval is a positive number.
|
|
89
|
+
*/
|
|
90
|
+
export function wrunBarVenueOf(market, intervalMs) {
|
|
91
|
+
if (!market || typeof market !== 'object')
|
|
92
|
+
return undefined;
|
|
93
|
+
const { exchange, symbol } = market;
|
|
94
|
+
if (typeof exchange !== 'string' || exchange.length === 0)
|
|
95
|
+
return undefined;
|
|
96
|
+
if (typeof symbol !== 'string' || symbol.length === 0)
|
|
97
|
+
return undefined;
|
|
98
|
+
if (!Number.isFinite(intervalMs) || intervalMs <= 0)
|
|
99
|
+
return undefined;
|
|
100
|
+
return { exchange, symbol, intervalMs };
|
|
101
|
+
}
|
|
102
|
+
const NO_FACTS = Object.freeze({ tradeDateSec: Number.NaN, session: Number.NaN });
|
|
103
|
+
/** Every session code, indexable by its own value. */
|
|
104
|
+
const SESSION_CODES = [
|
|
105
|
+
WRUN_BAR_SESSION.closed,
|
|
106
|
+
WRUN_BAR_SESSION.regular,
|
|
107
|
+
WRUN_BAR_SESSION.premarket,
|
|
108
|
+
WRUN_BAR_SESSION.afterHours,
|
|
109
|
+
];
|
|
110
|
+
const floorTo = (value, step) => value - (((value % step) + step) % step);
|
|
111
|
+
const ZONE_DAYS_MAX = 4096;
|
|
112
|
+
function zoneClock(zone) {
|
|
113
|
+
return {
|
|
114
|
+
formatter: new Intl.DateTimeFormat('en-US', {
|
|
115
|
+
timeZone: zone,
|
|
116
|
+
hourCycle: 'h23',
|
|
117
|
+
year: 'numeric',
|
|
118
|
+
month: 'numeric',
|
|
119
|
+
day: 'numeric',
|
|
120
|
+
hour: 'numeric',
|
|
121
|
+
minute: 'numeric',
|
|
122
|
+
second: 'numeric',
|
|
123
|
+
}),
|
|
124
|
+
days: new Map(),
|
|
125
|
+
last: null,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const newYorkClock = zoneClock(US_EQUITIES_TIME_ZONE);
|
|
129
|
+
const chicagoClock = zoneClock(GOVERNED_FUTURES_TIME_ZONE);
|
|
130
|
+
/** The wall clock `tMs` reads in the zone, as if it were UTC (whole seconds). */
|
|
131
|
+
function wallAsUtcMs(clock, tMs) {
|
|
132
|
+
let year = 1970;
|
|
133
|
+
let month = 1;
|
|
134
|
+
let day = 1;
|
|
135
|
+
let hour = 0;
|
|
136
|
+
let minute = 0;
|
|
137
|
+
let second = 0;
|
|
138
|
+
for (const part of clock.formatter.formatToParts(tMs)) {
|
|
139
|
+
switch (part.type) {
|
|
140
|
+
case 'year':
|
|
141
|
+
year = Number(part.value);
|
|
142
|
+
break;
|
|
143
|
+
case 'month':
|
|
144
|
+
month = Number(part.value);
|
|
145
|
+
break;
|
|
146
|
+
case 'day':
|
|
147
|
+
day = Number(part.value);
|
|
148
|
+
break;
|
|
149
|
+
case 'hour':
|
|
150
|
+
// Some ICU builds render midnight as 24 even under h23.
|
|
151
|
+
hour = Number(part.value) % 24;
|
|
152
|
+
break;
|
|
153
|
+
case 'minute':
|
|
154
|
+
minute = Number(part.value);
|
|
155
|
+
break;
|
|
156
|
+
case 'second':
|
|
157
|
+
second = Number(part.value);
|
|
158
|
+
break;
|
|
159
|
+
default:
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return Date.UTC(year, month - 1, day, hour, minute, second);
|
|
164
|
+
}
|
|
165
|
+
function offsetAtMs(clock, tMs) {
|
|
166
|
+
return wallAsUtcMs(clock, tMs) - Math.floor(tMs / 1000) * 1000;
|
|
167
|
+
}
|
|
168
|
+
/** The instant whose wall clock reads `wallMs` (as if UTC): two-pass, exact off the transition hour. */
|
|
169
|
+
function wallToUtcMs(clock, wallMs) {
|
|
170
|
+
const first = wallMs - offsetAtMs(clock, wallMs);
|
|
171
|
+
return wallMs - offsetAtMs(clock, first);
|
|
172
|
+
}
|
|
173
|
+
function zoneDayOf(clock, tMs) {
|
|
174
|
+
const last = clock.last;
|
|
175
|
+
if (last !== null && tMs >= last.startMs && tMs < last.endMs)
|
|
176
|
+
return last;
|
|
177
|
+
const wall = wallAsUtcMs(clock, tMs);
|
|
178
|
+
const dateMs = floorTo(wall, DAY_MS);
|
|
179
|
+
let day = clock.days.get(dateMs);
|
|
180
|
+
if (day === undefined) {
|
|
181
|
+
// Local midnight is never inside a US transition hour (those run at 02:00).
|
|
182
|
+
const startMs = wallToUtcMs(clock, dateMs);
|
|
183
|
+
const endMs = wallToUtcMs(clock, dateMs + DAY_MS);
|
|
184
|
+
const startOffsetMs = dateMs - startMs;
|
|
185
|
+
day = {
|
|
186
|
+
startMs,
|
|
187
|
+
endMs,
|
|
188
|
+
dateMs,
|
|
189
|
+
weekday: new Date(dateMs).getUTCDay(),
|
|
190
|
+
offsetMs: offsetAtMs(clock, endMs - 1) === startOffsetMs ? startOffsetMs : Number.NaN,
|
|
191
|
+
};
|
|
192
|
+
if (clock.days.size >= ZONE_DAYS_MAX)
|
|
193
|
+
clock.days.clear();
|
|
194
|
+
clock.days.set(dateMs, day);
|
|
195
|
+
}
|
|
196
|
+
clock.last = day;
|
|
197
|
+
return day;
|
|
198
|
+
}
|
|
199
|
+
/** Wall-clock ms since local midnight of `day` (the day holding `tMs`). */
|
|
200
|
+
function wallSinceMidnightMs(clock, day, tMs) {
|
|
201
|
+
const offsetMs = Number.isNaN(day.offsetMs) ? offsetAtMs(clock, tMs) : day.offsetMs;
|
|
202
|
+
return tMs + offsetMs - day.dateMs;
|
|
203
|
+
}
|
|
204
|
+
// ─── US equities ─────────────────────────────────────────────────────────────
|
|
205
|
+
const PHASE_CODE = Object.freeze({
|
|
206
|
+
regular: WRUN_BAR_SESSION.regular,
|
|
207
|
+
pre: WRUN_BAR_SESSION.premarket,
|
|
208
|
+
after: WRUN_BAR_SESSION.afterHours,
|
|
209
|
+
closed: WRUN_BAR_SESSION.closed,
|
|
210
|
+
});
|
|
211
|
+
const HALF_HOURS_PER_DAY = 48;
|
|
212
|
+
/** `resolveUsEquitySessionPhase` per New York (weekday, half hour); -1 = not read yet. */
|
|
213
|
+
const equityPhaseByWeekHalfHour = new Int8Array(7 * HALF_HOURS_PER_DAY).fill(-1);
|
|
214
|
+
/** The phase code `resolveUsEquitySessionPhase` gives the bar's New York (weekday, half hour). */
|
|
215
|
+
function usEquitySession(day, tMs) {
|
|
216
|
+
const sinceMidnightMs = wallSinceMidnightMs(newYorkClock, day, tMs);
|
|
217
|
+
const key = day.weekday * HALF_HOURS_PER_DAY + Math.floor(sinceMidnightMs / HALF_HOUR_MS);
|
|
218
|
+
let session = equityPhaseByWeekHalfHour[key];
|
|
219
|
+
if (session === -1) {
|
|
220
|
+
session = PHASE_CODE[resolveUsEquitySessionPhase(tMs - (sinceMidnightMs % HALF_HOUR_MS))];
|
|
221
|
+
equityPhaseByWeekHalfHour[key] = session;
|
|
222
|
+
}
|
|
223
|
+
return session;
|
|
224
|
+
}
|
|
225
|
+
function usEquityFactsResolver() {
|
|
226
|
+
// New York's offset is whole hours, so one UTC half hour is one New York (date, weekday, half
|
|
227
|
+
// hour): one answer for every bar inside it.
|
|
228
|
+
let slotMs = Number.NaN;
|
|
229
|
+
let answer = NO_FACTS;
|
|
230
|
+
return (tMs) => {
|
|
231
|
+
const barSlotMs = floorTo(tMs, HALF_HOUR_MS);
|
|
232
|
+
if (barSlotMs !== slotMs) {
|
|
233
|
+
const day = zoneDayOf(newYorkClock, tMs);
|
|
234
|
+
answer = Object.freeze({ tradeDateSec: day.dateMs / 1000, session: usEquitySession(day, tMs) });
|
|
235
|
+
slotMs = barSlotMs;
|
|
236
|
+
}
|
|
237
|
+
return answer;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
// ─── CME family ──────────────────────────────────────────────────────────────
|
|
241
|
+
const HOURS_PER_DAY = 24;
|
|
242
|
+
/** The schedule's open bit per Chicago (weekday, hour), one table per schedule; -1 = not read yet. */
|
|
243
|
+
const globexOpenByWeekHour = new Int8Array(7 * HOURS_PER_DAY).fill(-1);
|
|
244
|
+
const alwaysOnOpenByWeekHour = new Int8Array(7 * HOURS_PER_DAY).fill(-1);
|
|
245
|
+
function cmeScheduleOpen(symbol, alwaysOn, tMs) {
|
|
246
|
+
const day = zoneDayOf(chicagoClock, tMs);
|
|
247
|
+
const sinceMidnightMs = wallSinceMidnightMs(chicagoClock, day, tMs);
|
|
248
|
+
const key = day.weekday * HOURS_PER_DAY + Math.floor(sinceMidnightMs / HOUR_MS);
|
|
249
|
+
const table = alwaysOn ? alwaysOnOpenByWeekHour : globexOpenByWeekHour;
|
|
250
|
+
let open = table[key];
|
|
251
|
+
if (open === -1) {
|
|
252
|
+
open = getGovernedFuturesScheduleStatusForSymbol(symbol, tMs - (sinceMidnightMs % HOUR_MS)).open ? 1 : 0;
|
|
253
|
+
table[key] = open;
|
|
254
|
+
}
|
|
255
|
+
return open === 1;
|
|
256
|
+
}
|
|
257
|
+
const TRADE_DATE_WINDOWS_MAX = 4096;
|
|
258
|
+
/** Each RTH window object's window per trade date (null: no window opens on that date). */
|
|
259
|
+
const rthWindowByTradeDate = new WeakMap();
|
|
260
|
+
/**
|
|
261
|
+
* The RTH window of the CME trade date `tradeDateMs` (00:00Z label): the
|
|
262
|
+
* calendar-day window whose open carries that trade date. The 09:30 to 16:15
|
|
263
|
+
* New York window sits inside one trade date (the 17:00 Chicago roll is
|
|
264
|
+
* after its close), so exactly one window qualifies.
|
|
265
|
+
*/
|
|
266
|
+
function rthWindowOfTradeDate(window, tradeDateMs) {
|
|
267
|
+
let byTradeDate = rthWindowByTradeDate.get(window);
|
|
268
|
+
if (byTradeDate === undefined) {
|
|
269
|
+
byTradeDate = new Map();
|
|
270
|
+
rthWindowByTradeDate.set(window, byTradeDate);
|
|
271
|
+
}
|
|
272
|
+
const cached = byTradeDate.get(tradeDateMs);
|
|
273
|
+
if (cached !== undefined)
|
|
274
|
+
return cached;
|
|
275
|
+
const found = sessionWindowsInRange(window, tradeDateMs - DAY_MS, tradeDateMs + 2 * DAY_MS).find((candidate) => cmeSessionBucketMs(candidate.openMs, ONE_DAY_INTERVAL_MS) === tradeDateMs) ?? null;
|
|
276
|
+
if (byTradeDate.size >= TRADE_DATE_WINDOWS_MAX)
|
|
277
|
+
byTradeDate.clear();
|
|
278
|
+
byTradeDate.set(tradeDateMs, found);
|
|
279
|
+
return found;
|
|
280
|
+
}
|
|
281
|
+
function cmeFactsResolver(symbol) {
|
|
282
|
+
const alwaysOn = isCmeAlwaysOnSymbol(symbol);
|
|
283
|
+
const window = engineRthWindowForSymbol(symbol);
|
|
284
|
+
// Per UTC hour: `cmeSessionBucketMs` reads the 1h source row holding the bar, so the trade date
|
|
285
|
+
// is one per UTC hour, and the schedule's grain (a Chicago hour) is one UTC hour too.
|
|
286
|
+
let hourMs = Number.NaN;
|
|
287
|
+
let open = false;
|
|
288
|
+
let tradeDateMs = Number.NaN;
|
|
289
|
+
// Per trade date: its RTH window and one read-only answer per session code.
|
|
290
|
+
let rthTradeDateMs = Number.NaN;
|
|
291
|
+
let rth = null;
|
|
292
|
+
let answers = [];
|
|
293
|
+
return (tMs) => {
|
|
294
|
+
const barHourMs = floorTo(tMs, HOUR_MS);
|
|
295
|
+
if (barHourMs !== hourMs) {
|
|
296
|
+
hourMs = barHourMs;
|
|
297
|
+
open = cmeScheduleOpen(symbol, alwaysOn, tMs);
|
|
298
|
+
const barTradeDateMs = cmeSessionBucketMs(tMs, ONE_DAY_INTERVAL_MS);
|
|
299
|
+
if (barTradeDateMs !== tradeDateMs) {
|
|
300
|
+
tradeDateMs = barTradeDateMs;
|
|
301
|
+
answers = SESSION_CODES.map((session) => Object.freeze({ tradeDateSec: barTradeDateMs / 1000, session }));
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (!open)
|
|
305
|
+
return answers[WRUN_BAR_SESSION.closed];
|
|
306
|
+
// `isWithinRthWindow` fails open for a root without a window: regular all session.
|
|
307
|
+
if (window === null)
|
|
308
|
+
return answers[WRUN_BAR_SESSION.regular];
|
|
309
|
+
if (rthTradeDateMs !== tradeDateMs) {
|
|
310
|
+
rth = rthWindowOfTradeDate(window, tradeDateMs);
|
|
311
|
+
rthTradeDateMs = tradeDateMs;
|
|
312
|
+
}
|
|
313
|
+
// No window on the trade date is unreachable with the uniform window; read it like a root without one.
|
|
314
|
+
if (rth === null || (tMs >= rth.openMs && tMs < rth.closeMs))
|
|
315
|
+
return answers[WRUN_BAR_SESSION.regular];
|
|
316
|
+
return answers[tMs < rth.openMs ? WRUN_BAR_SESSION.premarket : WRUN_BAR_SESSION.afterHours];
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
// ─── Everything else, and every calendar bar ─────────────────────────────────
|
|
320
|
+
function utcFactsResolver() {
|
|
321
|
+
let dayMs = Number.NaN;
|
|
322
|
+
let answer = NO_FACTS;
|
|
323
|
+
return (tMs) => {
|
|
324
|
+
const barDayMs = floorTo(tMs, DAY_MS);
|
|
325
|
+
if (barDayMs !== dayMs) {
|
|
326
|
+
answer = Object.freeze({ tradeDateSec: barDayMs / 1000, session: WRUN_BAR_SESSION.regular });
|
|
327
|
+
dayMs = barDayMs;
|
|
328
|
+
}
|
|
329
|
+
return answer;
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
// ─── The resolver ────────────────────────────────────────────────────────────
|
|
333
|
+
/**
|
|
334
|
+
* The facts reader for one series: its rule is decided once (a calendar bar
|
|
335
|
+
* reads its stamp's UTC date on every market, an intraday bar its market's
|
|
336
|
+
* rule), then every call reads one bar open time (UTC ms). The row builders
|
|
337
|
+
* bind one per build and call it per row. The answer objects are shared and
|
|
338
|
+
* frozen.
|
|
339
|
+
*/
|
|
340
|
+
export function wrunBarSessionFactsResolver(venue) {
|
|
341
|
+
const market = wrunBarFactsMarketOf(venue.exchange);
|
|
342
|
+
const facts = venue.intervalMs >= ONE_DAY_INTERVAL_MS
|
|
343
|
+
? utcFactsResolver()
|
|
344
|
+
: market === 'cme'
|
|
345
|
+
? cmeFactsResolver(venue.symbol)
|
|
346
|
+
: market === 'us_equities'
|
|
347
|
+
? usEquityFactsResolver()
|
|
348
|
+
: utcFactsResolver();
|
|
349
|
+
return (barOpenMs) => (Number.isFinite(barOpenMs) ? facts(barOpenMs) : NO_FACTS);
|
|
350
|
+
}
|
|
351
|
+
/** One bar's facts (a one-off read; hot loops bind `wrunBarSessionFactsResolver` once). */
|
|
352
|
+
export function wrunBarSessionFacts(venue, barOpenMs) {
|
|
353
|
+
return wrunBarSessionFactsResolver(venue)(barOpenMs);
|
|
354
|
+
}
|
|
@@ -4672,6 +4672,16 @@ function adaptWrunDrawing(drawing, pane, look) {
|
|
|
4672
4672
|
const { declaration, sheetId, presentation } = look;
|
|
4673
4673
|
if (drawing.kind === 'card' || drawing.kind === 'ladder' || drawing.kind === 'feed' || drawing.kind === 'meter') {
|
|
4674
4674
|
const props = { ...drawing.props };
|
|
4675
|
+
if (drawing.kind === 'feed') {
|
|
4676
|
+
// A feed's lines scroll past the pane (the engine's props `scroll`), and a
|
|
4677
|
+
// frame's markets name them for the row click (UW-PARITY H4): the engine
|
|
4678
|
+
// reads them as `lineKeys`, one per line as written.
|
|
4679
|
+
const markets = props.markets;
|
|
4680
|
+
delete props.markets;
|
|
4681
|
+
props.scroll = true;
|
|
4682
|
+
if (Array.isArray(markets))
|
|
4683
|
+
props.lineKeys = markets;
|
|
4684
|
+
}
|
|
4675
4685
|
const words = declaration;
|
|
4676
4686
|
// The widget look (DW01 DW04 DW05 DW06 DW11 DW38): the engine `style`
|
|
4677
4687
|
// block from the sheet words (a ladder's own style), then the record
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE reader from persisted overlay settings to the WRUN wire tuple
|
|
3
|
+
* `{package, version}`.
|
|
4
|
+
*
|
|
5
|
+
* Three wire hops consume this exact narrowing — the capability MINT (primary
|
|
6
|
+
* ensure + the once-only FORBIDDEN heal in data-fetching) and the backend
|
|
7
|
+
* createScript payload (kscript-ws worker) — and the mint's tuple MUST equal
|
|
8
|
+
* the payload's tuple byte-for-byte: the backend refuses a createScript whose
|
|
9
|
+
* `wrun` differs from the capability's signed claim. Open-coding the guard at
|
|
10
|
+
* each site is how the two sides drift (the settingsToSave/initializeOverlay
|
|
11
|
+
* incident class), so every consumer calls this instead.
|
|
12
|
+
*
|
|
13
|
+
* Returns null for anything malformed (absent ref, non-string fields, empty
|
|
14
|
+
* or whitespace-only values, over-cap lengths — the gateway trims and caps
|
|
15
|
+
* the same way, so a value this returns would otherwise 400 as an UNTYPED
|
|
16
|
+
* error and be misread as a transient outage). Callers treat null as "not a
|
|
17
|
+
* wrun overlay" / deterministic invalid, never as retryable.
|
|
18
|
+
*/
|
|
19
|
+
export interface WrunWireRef {
|
|
20
|
+
package: string;
|
|
21
|
+
version: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function readWrunWireRef(settings: unknown): WrunWireRef | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const WRUN_PACKAGE_MAX = 128;
|
|
2
|
+
const WRUN_VERSION_MAX = 64;
|
|
3
|
+
export function readWrunWireRef(settings) {
|
|
4
|
+
const ref = settings?.wrunRef;
|
|
5
|
+
if (!ref || typeof ref !== 'object')
|
|
6
|
+
return null;
|
|
7
|
+
if (typeof ref.package !== 'string' || typeof ref.version !== 'string')
|
|
8
|
+
return null;
|
|
9
|
+
const pkg = ref.package.trim();
|
|
10
|
+
const version = ref.version.trim();
|
|
11
|
+
if (!pkg || !version)
|
|
12
|
+
return null;
|
|
13
|
+
if (pkg.length > WRUN_PACKAGE_MAX || version.length > WRUN_VERSION_MAX)
|
|
14
|
+
return null;
|
|
15
|
+
return { package: pkg, version };
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe arithmetic expression evaluator using a recursive descent parser.
|
|
3
|
+
* Only supports: numbers (including scientific notation), +, -, *, /, parentheses.
|
|
4
|
+
* Returns NaN for invalid expressions. Returns Infinity for division by zero.
|
|
5
|
+
*
|
|
6
|
+
* Grammar:
|
|
7
|
+
* expression ::= term (('+' | '-') term)*
|
|
8
|
+
* term ::= factor (('*' | '/') factor)*
|
|
9
|
+
* factor ::= ('+' | '-')? atom
|
|
10
|
+
* atom ::= NUMBER | '(' expression ')'
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Safely evaluate a mathematical expression string containing only
|
|
14
|
+
* numbers, operators (+, -, *, /), parentheses, and whitespace.
|
|
15
|
+
* Returns NaN for malformed or empty expressions.
|
|
16
|
+
* Returns Infinity/-Infinity for division by zero (matches JS behavior).
|
|
17
|
+
*/
|
|
18
|
+
export declare function safeMathEval(expression: string): number;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe arithmetic expression evaluator using a recursive descent parser.
|
|
3
|
+
* Only supports: numbers (including scientific notation), +, -, *, /, parentheses.
|
|
4
|
+
* Returns NaN for invalid expressions. Returns Infinity for division by zero.
|
|
5
|
+
*
|
|
6
|
+
* Grammar:
|
|
7
|
+
* expression ::= term (('+' | '-') term)*
|
|
8
|
+
* term ::= factor (('*' | '/') factor)*
|
|
9
|
+
* factor ::= ('+' | '-')? atom
|
|
10
|
+
* atom ::= NUMBER | '(' expression ')'
|
|
11
|
+
*/
|
|
12
|
+
function tokenize(expr) {
|
|
13
|
+
const tokens = [];
|
|
14
|
+
let i = 0;
|
|
15
|
+
while (i < expr.length) {
|
|
16
|
+
const ch = expr[i];
|
|
17
|
+
// Skip whitespace
|
|
18
|
+
if (ch === ' ' || ch === '\t') {
|
|
19
|
+
i++;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
// Operators and parentheses
|
|
23
|
+
if (ch === '+' || ch === '-' || ch === '*' || ch === '/' || ch === '(' || ch === ')') {
|
|
24
|
+
tokens.push({ type: 'op', value: ch });
|
|
25
|
+
i++;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
// Numbers: digits, decimal point, scientific notation
|
|
29
|
+
if ((ch >= '0' && ch <= '9') || ch === '.') {
|
|
30
|
+
let num = '';
|
|
31
|
+
while (i < expr.length && ((expr[i] >= '0' && expr[i] <= '9') || expr[i] === '.')) {
|
|
32
|
+
num += expr[i];
|
|
33
|
+
i++;
|
|
34
|
+
}
|
|
35
|
+
// Scientific notation (e.g., 1e-7, 2.5E+3)
|
|
36
|
+
if (i < expr.length && (expr[i] === 'e' || expr[i] === 'E')) {
|
|
37
|
+
num += expr[i];
|
|
38
|
+
i++;
|
|
39
|
+
if (i < expr.length && (expr[i] === '+' || expr[i] === '-')) {
|
|
40
|
+
num += expr[i];
|
|
41
|
+
i++;
|
|
42
|
+
}
|
|
43
|
+
while (i < expr.length && expr[i] >= '0' && expr[i] <= '9') {
|
|
44
|
+
num += expr[i];
|
|
45
|
+
i++;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const value = Number(num);
|
|
49
|
+
if (isNaN(value))
|
|
50
|
+
return [{ type: 'eof' }];
|
|
51
|
+
tokens.push({ type: 'number', value });
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
// Any other character is invalid
|
|
55
|
+
return [{ type: 'eof' }];
|
|
56
|
+
}
|
|
57
|
+
tokens.push({ type: 'eof' });
|
|
58
|
+
return tokens;
|
|
59
|
+
}
|
|
60
|
+
class Parser {
|
|
61
|
+
tokens;
|
|
62
|
+
pos = 0;
|
|
63
|
+
failed = false;
|
|
64
|
+
constructor(tokens) {
|
|
65
|
+
this.tokens = tokens;
|
|
66
|
+
}
|
|
67
|
+
peek() {
|
|
68
|
+
return this.tokens[this.pos] ?? { type: 'eof' };
|
|
69
|
+
}
|
|
70
|
+
consume() {
|
|
71
|
+
return this.tokens[this.pos++] ?? { type: 'eof' };
|
|
72
|
+
}
|
|
73
|
+
// expression ::= term (('+' | '-') term)*
|
|
74
|
+
parseExpression() {
|
|
75
|
+
let result = this.parseTerm();
|
|
76
|
+
while (!this.failed) {
|
|
77
|
+
const tok = this.peek();
|
|
78
|
+
if (tok.type === 'op' && (tok.value === '+' || tok.value === '-')) {
|
|
79
|
+
this.consume();
|
|
80
|
+
const right = this.parseTerm();
|
|
81
|
+
result = tok.value === '+' ? result + right : result - right;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
// term ::= factor (('*' | '/') factor)*
|
|
90
|
+
parseTerm() {
|
|
91
|
+
let result = this.parseFactor();
|
|
92
|
+
while (!this.failed) {
|
|
93
|
+
const tok = this.peek();
|
|
94
|
+
if (tok.type === 'op' && (tok.value === '*' || tok.value === '/')) {
|
|
95
|
+
this.consume();
|
|
96
|
+
const right = this.parseFactor();
|
|
97
|
+
result = tok.value === '*' ? result * right : result / right;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
// factor ::= ('+' | '-')? atom
|
|
106
|
+
parseFactor() {
|
|
107
|
+
const tok = this.peek();
|
|
108
|
+
if (tok.type === 'op' && (tok.value === '+' || tok.value === '-')) {
|
|
109
|
+
this.consume();
|
|
110
|
+
const value = this.parseFactor();
|
|
111
|
+
return tok.value === '-' ? -value : value;
|
|
112
|
+
}
|
|
113
|
+
return this.parseAtom();
|
|
114
|
+
}
|
|
115
|
+
// atom ::= NUMBER | '(' expression ')'
|
|
116
|
+
parseAtom() {
|
|
117
|
+
const tok = this.peek();
|
|
118
|
+
if (tok.type === 'number') {
|
|
119
|
+
this.consume();
|
|
120
|
+
return tok.value;
|
|
121
|
+
}
|
|
122
|
+
if (tok.type === 'op' && tok.value === '(') {
|
|
123
|
+
this.consume();
|
|
124
|
+
const result = this.parseExpression();
|
|
125
|
+
const closing = this.peek();
|
|
126
|
+
if (closing.type === 'op' && closing.value === ')') {
|
|
127
|
+
this.consume();
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
// Missing closing paren
|
|
131
|
+
this.failed = true;
|
|
132
|
+
return NaN;
|
|
133
|
+
}
|
|
134
|
+
// Unexpected token
|
|
135
|
+
this.failed = true;
|
|
136
|
+
return NaN;
|
|
137
|
+
}
|
|
138
|
+
parse() {
|
|
139
|
+
const result = this.parseExpression();
|
|
140
|
+
// Ensure entire input was consumed
|
|
141
|
+
if (this.peek().type !== 'eof' || this.failed) {
|
|
142
|
+
return NaN;
|
|
143
|
+
}
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Safely evaluate a mathematical expression string containing only
|
|
149
|
+
* numbers, operators (+, -, *, /), parentheses, and whitespace.
|
|
150
|
+
* Returns NaN for malformed or empty expressions.
|
|
151
|
+
* Returns Infinity/-Infinity for division by zero (matches JS behavior).
|
|
152
|
+
*/
|
|
153
|
+
export function safeMathEval(expression) {
|
|
154
|
+
if (!expression || !expression.trim()) {
|
|
155
|
+
return NaN;
|
|
156
|
+
}
|
|
157
|
+
const tokens = tokenize(expression);
|
|
158
|
+
const parser = new Parser(tokens);
|
|
159
|
+
return parser.parse();
|
|
160
|
+
}
|