@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,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A source lane's answer the data plane REFUSED BY NAME: a backend switch that keeps a read off (the OPTION_PRINT_AGG
|
|
3
|
+
* flow scope reads while `read.option_print_scopes` is off), or a series the data plane holds for a configured list
|
|
4
|
+
* only (OPTION_UNDERLYING_STATS's ten-minute rows). The same ask is refused again until the plane changes, so it is
|
|
5
|
+
* no transport failure to retry:
|
|
6
|
+
*
|
|
7
|
+
* - the worker twin that met the refusal ends its stream with an error whose text carries the mark and a stable code
|
|
8
|
+
* (`wrunLaneRefusedText`), and the main thread reads the code back off whatever error wraps that text on its way
|
|
9
|
+
* (`wrunLaneRefusedCodeOf`: the transport keeps the worker's words);
|
|
10
|
+
* - the run degrades the lane under its name, terminally (the chip says the source is missing and no ladder re-asks
|
|
11
|
+
* it), in the record its lane declares for the code (`WrunPollLane.refusedAnswers`) when it declares one;
|
|
12
|
+
* - a live reconcile reads it as an answer with no new rows: its window covered, the held rows kept, no warning, so
|
|
13
|
+
* the session never widens its window or warns on every poll.
|
|
14
|
+
*
|
|
15
|
+
* Import-free: the worker twins and the main thread read the same mark.
|
|
16
|
+
*/
|
|
17
|
+
/** The mark a named refusal's text carries before its code. */
|
|
18
|
+
export const WRUN_LANE_REFUSED_MARK = 'wrun-lane-refused:';
|
|
19
|
+
const WRUN_LANE_REFUSED_RE = /wrun-lane-refused:([a-z0-9][a-z0-9-]*)/;
|
|
20
|
+
/** The text a worker twin ends a refused read with: the mark, the code (lower case, digits and dashes), the detail. */
|
|
21
|
+
export function wrunLaneRefusedText(code, detail) {
|
|
22
|
+
return `${WRUN_LANE_REFUSED_MARK}${code}${detail === '' ? '' : ` ${detail}`}`;
|
|
23
|
+
}
|
|
24
|
+
/** The code of a named refusal an error (or its text) carries, or undefined for any other failure. */
|
|
25
|
+
export function wrunLaneRefusedCodeOf(error) {
|
|
26
|
+
let text = error;
|
|
27
|
+
if (error !== null && typeof error === 'object')
|
|
28
|
+
text = error.message;
|
|
29
|
+
if (typeof text !== 'string')
|
|
30
|
+
return undefined;
|
|
31
|
+
return WRUN_LANE_REFUSED_RE.exec(text)?.[1];
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
|
|
2
|
+
/** The largest param value the planner reads as a lookback (the kit's LOOKBACK_PARAM_CAP): a bigger number is a
|
|
3
|
+
* threshold or a size, never a window. */
|
|
4
|
+
export declare const WRUN_LANE_WARMUP_LOOKBACK_CAP = 500;
|
|
5
|
+
/**
|
|
6
|
+
* The cloud's warm-up for a sheet under the run's param values, in chart bars: the kit planner's rule (see the file
|
|
7
|
+
* comment), clamped to `cap`, the `chart-cloud` profile's `caps.warmupBars` (Infinity is no cap). Never below 0.
|
|
8
|
+
*/
|
|
9
|
+
export declare function wrunLaneWarmupBars(sheet: Pick<WrunIndicatorMetadata, 'params' | 'warmup_bars' | 'warmup'> & {
|
|
10
|
+
boxes?: unknown;
|
|
11
|
+
segments?: unknown;
|
|
12
|
+
}, paramValues: Readonly<Record<string, number>>, cap: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* The open of the first bar a run evaluates with `bars` of warm-up before the window opening at `fromMs`: `bars` chart
|
|
15
|
+
* intervals back, or `bars` calendar bars on a 1M, 3M, 6M or 1Y chart (the kit's `evaluateFromMs`). Clock time, as the
|
|
16
|
+
* cloud counts it: a venue's closed hours inside the span hold no candle, so a session market evaluates fewer rows.
|
|
17
|
+
*/
|
|
18
|
+
export declare function wrunLaneWarmupFromMs(fromMs: number, bars: number, intervalMs: number): number;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The warm-up depth a wrun run evaluates before its first landed bar, one number for both lanes (WRUN parity rows 53
|
|
3
|
+
* and 4; Kyle 2026-10-13: the LONGER depth, the cloud's, on both).
|
|
4
|
+
*
|
|
5
|
+
* The cloud plans every chart create through the kit's planner under the `chart-cloud` profile (kscript-backend
|
|
6
|
+
* `wrunSharedWarmupBars`: `planWrunRun(...).warmup.bars`; its docs/wrun-lane.md, "Warm-up"): the sheet's
|
|
7
|
+
* `warmup_bars` (2 when absent), every window-like param's current value (finite, at most 500) and the largest box or
|
|
8
|
+
* segment offset, plus one; never below the sheet's scaled `warmup` window; clamped to the profile's
|
|
9
|
+
* `caps.warmupBars`. Every ask of that run (the chart's candles, each leg, each lane) starts that many chart bars
|
|
10
|
+
* before the window (`warmup.evaluateFromMs`), and the rows before the window warm the module without shipping. The
|
|
11
|
+
* browser lane evaluated from the chart's first loaded bar instead, so its left edge was cold where the cloud's was
|
|
12
|
+
* warm: RSI's first 14 rows, a 1h-pinned RSI on a 5m chart ready six hours later (its `overbought` 70 is window-like
|
|
13
|
+
* to the planner, so W is 71 five-minute bars), and a strategy whose first bar was 22 bars later.
|
|
14
|
+
*
|
|
15
|
+
* This file is the one derivation the browser reads. The run pass (wrun-overlay-run.util) asks every lane and leg from
|
|
16
|
+
* `wrunLaneWarmupFromMs` and evaluates the chart's candles in that span first as a hidden head that never lands; the
|
|
17
|
+
* strategy's broker feed reads the same head, so the Strategy Tester's first bar is the cloud's. The kit keeps its
|
|
18
|
+
* `planWarmup` inside `planWrunRun`, which validates the whole sheet against a full context and throws for anything
|
|
19
|
+
* the profile refuses, so the rule is mirrored here over the run's own param values (`wrunParamValuesFromSettings`
|
|
20
|
+
* in wrun-param-values.util: the numbers the cloud's createScript packs) and pinned against the kit's planner by
|
|
21
|
+
* tests/utility/wrun/wrun-lane-warmup.util.spec.ts: a kit that changes its rule turns that spec red.
|
|
22
|
+
*/
|
|
23
|
+
import { calendarMonthsOfMs } from '../chart/calendar-interval.util.js';
|
|
24
|
+
/** The planner's warm-up when the sheet declares no `warmup_bars` (the kit's default). */
|
|
25
|
+
const WRUN_LANE_WARMUP_DEFAULT_BARS = 2;
|
|
26
|
+
/** The largest param value the planner reads as a lookback (the kit's LOOKBACK_PARAM_CAP): a bigger number is a
|
|
27
|
+
* threshold or a size, never a window. */
|
|
28
|
+
export const WRUN_LANE_WARMUP_LOOKBACK_CAP = 500;
|
|
29
|
+
/** Param types the planner never reads as a lookback (the kit's NON_WINDOW_PARAM_TYPES). */
|
|
30
|
+
const NON_WINDOW_PARAM_TYPES = new Set([
|
|
31
|
+
'select',
|
|
32
|
+
'boolean',
|
|
33
|
+
'color',
|
|
34
|
+
'multi',
|
|
35
|
+
'time',
|
|
36
|
+
'price',
|
|
37
|
+
'text',
|
|
38
|
+
]);
|
|
39
|
+
function isRecord(value) {
|
|
40
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
41
|
+
}
|
|
42
|
+
const finiteOf = (value) => typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
43
|
+
/** A param the planner reads as a lookback: no style knob, host fill or session, and a numeric type (none declared
|
|
44
|
+
* reads as a number). */
|
|
45
|
+
function isWindowLikeParam(param) {
|
|
46
|
+
if (param.style !== undefined || param.host_fill !== undefined || param.session !== undefined)
|
|
47
|
+
return false;
|
|
48
|
+
return typeof param.type !== 'string' || !NON_WINDOW_PARAM_TYPES.has(param.type);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The cloud's warm-up for a sheet under the run's param values, in chart bars: the kit planner's rule (see the file
|
|
52
|
+
* comment), clamped to `cap`, the `chart-cloud` profile's `caps.warmupBars` (Infinity is no cap). Never below 0.
|
|
53
|
+
*/
|
|
54
|
+
export function wrunLaneWarmupBars(sheet, paramValues, cap) {
|
|
55
|
+
let bars = finiteOf(sheet.warmup_bars) ?? WRUN_LANE_WARMUP_DEFAULT_BARS;
|
|
56
|
+
const params = (Array.isArray(sheet.params) ? sheet.params : []).filter(isRecord);
|
|
57
|
+
for (const param of params) {
|
|
58
|
+
if (!isWindowLikeParam(param))
|
|
59
|
+
continue;
|
|
60
|
+
const value = typeof param.name === 'string' ? paramValues[param.name] : undefined;
|
|
61
|
+
if (value === undefined || !Number.isFinite(value) || value > WRUN_LANE_WARMUP_LOOKBACK_CAP)
|
|
62
|
+
continue;
|
|
63
|
+
bars = Math.max(bars, Math.ceil(value));
|
|
64
|
+
}
|
|
65
|
+
for (const key of ['boxes', 'segments']) {
|
|
66
|
+
const declared = sheet[key];
|
|
67
|
+
for (const decl of Array.isArray(declared) ? declared : []) {
|
|
68
|
+
if (!isRecord(decl))
|
|
69
|
+
continue;
|
|
70
|
+
for (const offset of [decl.x_from, decl.x_to]) {
|
|
71
|
+
const at = finiteOf(offset);
|
|
72
|
+
if (at !== undefined)
|
|
73
|
+
bars = Math.max(bars, Math.abs(at));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
bars = Math.ceil(bars) + 1;
|
|
78
|
+
const warmup = sheet.warmup;
|
|
79
|
+
if (isRecord(warmup)) {
|
|
80
|
+
let sum = 0;
|
|
81
|
+
for (const term of Array.isArray(warmup.terms) ? warmup.terms : []) {
|
|
82
|
+
if (!isRecord(term) || typeof term.param !== 'string')
|
|
83
|
+
continue;
|
|
84
|
+
const multiplier = finiteOf(term.multiplier);
|
|
85
|
+
if (multiplier === undefined)
|
|
86
|
+
continue;
|
|
87
|
+
if (params.find((param) => param.name === term.param)?.type === 'text')
|
|
88
|
+
continue;
|
|
89
|
+
const value = paramValues[term.param];
|
|
90
|
+
if (value === undefined || !Number.isFinite(value))
|
|
91
|
+
continue;
|
|
92
|
+
sum += value * multiplier;
|
|
93
|
+
}
|
|
94
|
+
bars = Math.max(bars, finiteOf(warmup.min) ?? 0, Math.ceil(sum) + (finiteOf(warmup.plus) ?? 0));
|
|
95
|
+
}
|
|
96
|
+
return Math.max(0, Math.min(bars, cap));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The open of the first bar a run evaluates with `bars` of warm-up before the window opening at `fromMs`: `bars` chart
|
|
100
|
+
* intervals back, or `bars` calendar bars on a 1M, 3M, 6M or 1Y chart (the kit's `evaluateFromMs`). Clock time, as the
|
|
101
|
+
* cloud counts it: a venue's closed hours inside the span hold no candle, so a session market evaluates fewer rows.
|
|
102
|
+
*/
|
|
103
|
+
export function wrunLaneWarmupFromMs(fromMs, bars, intervalMs) {
|
|
104
|
+
if (!(bars > 0) || !(intervalMs > 0))
|
|
105
|
+
return fromMs;
|
|
106
|
+
const months = calendarMonthsOfMs(intervalMs);
|
|
107
|
+
if (months === null)
|
|
108
|
+
return fromMs - bars * intervalMs;
|
|
109
|
+
const at = new Date(fromMs);
|
|
110
|
+
const month = at.getUTCMonth();
|
|
111
|
+
return Date.UTC(at.getUTCFullYear(), month - (month % months) - bars * months, 1);
|
|
112
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { WrunLegCandleClose, WrunLegCandleOpen, WrunLegRowBounds } from '@orangecharts/indicator-kit/host';
|
|
2
|
+
import { type WrunChartSession } from './wrun-source-rows.util.js';
|
|
3
|
+
/** How long after a US listing's candle closes the gateway's rows hold all of it: its candles are
|
|
4
|
+
* built from Polygon's minute bars, which land after their minute ends, and the closing auction
|
|
5
|
+
* joins the session's last minute only once the 16:00 bar has landed, after 16:01 New York
|
|
6
|
+
* (docs/features/data/rth-eth-sessions.md, "Closing auction"). The live tick re-asks a stock leg
|
|
7
|
+
* this long after a close, so the confirmed read takes the whole candle. */
|
|
8
|
+
export declare const WRUN_US_EQUITIES_CLOSE_SETTLE_MS = 180000;
|
|
9
|
+
/** What a leg's close reads: its span and, for another market, that market. */
|
|
10
|
+
export interface WrunLegCloseLeg {
|
|
11
|
+
legMs: number;
|
|
12
|
+
market?: {
|
|
13
|
+
exchange?: string;
|
|
14
|
+
} | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** The session the chart fetches a US listing's candles on, as the shared host's session calendar
|
|
17
|
+
* reads it: 'extended' only while the chart runs its extended session (`isEquityExtendedSession`,
|
|
18
|
+
* the fetch's own decider), else 'regular', an unset session included (the browser never leaves it
|
|
19
|
+
* unstated; the package reads an unstated session as open plus the span). */
|
|
20
|
+
export declare function wrunChartSessionType(sessionType: unknown): 'regular' | 'extended';
|
|
21
|
+
/** The chart's session as the row builder reads it (`WrunChartSourceRows.session`): the chart's
|
|
22
|
+
* exchange and the session word of its `sessionType`. */
|
|
23
|
+
export declare function wrunChartSession(exchange: string | undefined, sessionType: unknown): WrunChartSession;
|
|
24
|
+
/** Whether the gateway builds this leg's bars on the CME session lattice. */
|
|
25
|
+
export declare function wrunLegRidesCmeSession(leg: WrunLegCloseLeg, chartExchange: string | undefined): boolean;
|
|
26
|
+
/** How long after a close the leg's venue holds the whole candle (the module doc): a US listing's
|
|
27
|
+
* `WRUN_US_EQUITIES_CLOSE_SETTLE_MS` where its candles close with the session, 0 for every other
|
|
28
|
+
* leg (its live feed seals a candle at its close). */
|
|
29
|
+
export declare function wrunLegCloseSettleMs(leg: WrunLegCloseLeg, chartExchange: string | undefined, sessionType?: unknown): number;
|
|
30
|
+
/** The leg's candle closes for the leg core (`closeMs`): the CME session lattice's, else a US
|
|
31
|
+
* listing's session closes on a regular-session chart (the chart's `sessionType`); undefined where
|
|
32
|
+
* they are open plus the span. */
|
|
33
|
+
export declare function wrunLegCandleClose(leg: WrunLegCloseLeg, chartExchange: string | undefined, sessionType?: unknown): WrunLegCandleClose | undefined;
|
|
34
|
+
/** The leg's candle opens for the leg core (`candleOpenMs`), undefined where a candle trades from
|
|
35
|
+
* its stamp: a CME daily, 3d or weekly candle stamped at its trade date trades from the session
|
|
36
|
+
* open before it. */
|
|
37
|
+
export declare function wrunLegCandleOpen(leg: WrunLegCloseLeg, chartExchange: string | undefined): WrunLegCandleOpen | undefined;
|
|
38
|
+
/** The chart's primary row bounds for the leg core (`rowBounds`), undefined where a row spans
|
|
39
|
+
* [label, label + P): a calendar row (1M 3M 6M 1Y, any market) runs from its label to its calendar
|
|
40
|
+
* end (`wrunCalendarRowBounds`); a row of a market the gateway builds on the CME session lattice,
|
|
41
|
+
* at a lattice interval, runs from its session open to its bar end (a daily row labelled Sep 30
|
|
42
|
+
* runs from Sep 29 22:00Z to Sep 30 22:00Z under daylight time; the Tuesday after Labor Day from
|
|
43
|
+
* the Sunday open). A label the lattice does not book keeps [label, label + P). The row builder
|
|
44
|
+
* reads the same answer through `wrunSessionClock`. */
|
|
45
|
+
export declare function wrunPrimaryRowBounds(chartExchange: string | undefined, intervalMs: number): WrunLegRowBounds | undefined;
|
|
46
|
+
/** The label of the primary row holding `instantMs` where a calendar labels the rows: its calendar
|
|
47
|
+
* bar on a calendar chart (March 10 is the March 1 row), the row whose session holds it on the CME
|
|
48
|
+
* session lattice; undefined elsewhere, where the caller keeps its own grid. */
|
|
49
|
+
export declare function wrunPrimaryRowHoldingMs(chartExchange: string | undefined, intervalMs: number, instantMs: number): number | undefined;
|
|
50
|
+
/** The close of the leg's bar holding `nowMs` where its venue closes bars off the plain grid,
|
|
51
|
+
* undefined elsewhere or once that bar has closed (the caller keeps its own grid, a wake no later
|
|
52
|
+
* than the next close): on the CME session lattice the lattice bar's end; on a US listing on a
|
|
53
|
+
* regular-session chart (the chart's `sessionType`) the stock's close (`wrunLegCandleClose`) of
|
|
54
|
+
* the candle the chart's live boundary rule keys now to (`liveBucketStartMs`: the trade date for a
|
|
55
|
+
* day, the Monday for a week, the 09:30 New York lattice from 45m to 12h), and off the session on
|
|
56
|
+
* that lattice the first candle of the next session. */
|
|
57
|
+
export declare function wrunLegBarCloseAt(leg: WrunLegCloseLeg, chartExchange: string | undefined, nowMs: number, sessionType?: unknown): number | undefined;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When a pinned leg's candle closes on the chart, when it starts trading, and where the chart's own
|
|
3
|
+
* rows run. The rule is the shared host's session calendar (`@orangecharts/indicator-kit/host`,
|
|
4
|
+
* session-calendar.ts, om #1907): the browser's own rule moved into the package (Amendment 11,
|
|
5
|
+
* browser wins), so it lives once and both chart hosts run it. The row builder takes its answers
|
|
6
|
+
* for a whole plan (`wrunSessionClock`, through `WrunChartSourceRows.session`); this module hands
|
|
7
|
+
* the same rule leg by leg to the browser paths that read a leg outside the aligner: the run pass's
|
|
8
|
+
* closed-candle cut and intrabar head, the live tick's cuts, revision checks, wake and coverage.
|
|
9
|
+
* Each wrapper composes the package's exports and holds no calendar of its own:
|
|
10
|
+
*
|
|
11
|
+
* - The CME session lattice (`isCmeSessionLatticeExchange`, `isCmeSessionLatticeIntervalMs`): a
|
|
12
|
+
* leg whose venue (its pinned exchange, else the chart's) the gateway builds on it closes each
|
|
13
|
+
* candle at `cmeSessionBarEndMs` (a 3d group at the 17:00 Chicago open after its last trade date,
|
|
14
|
+
* a fall-back Sunday bar an hour late), or at open plus the span for a stamp the lattice books no
|
|
15
|
+
* row to (a regular-hours leg's 09:30 New York bar); a daily, 3d or weekly candle stamped at its
|
|
16
|
+
* trade date trades from the session open before it (`cmeSessionBarOpenMs`), and a primary row
|
|
17
|
+
* there runs from that open to its bar end.
|
|
18
|
+
* - A US listing (`wrunCalendarOfVenue` "us_equities": NYSE, NASDAQ, CBOE, POLYGON) on a
|
|
19
|
+
* regular-session chart: a candle closes with its session (`wrunMarketLegCandleClose` on a New
|
|
20
|
+
* York stock: the daily at 16:00 New York, the week with its last session), read on the gateway's
|
|
21
|
+
* fixed 09:30 to 16:00 window (`regularWindowClose`: an NYSE early close keeps its after-hours
|
|
22
|
+
* prints until 16:00, so its candle closes there, never before its last print). An
|
|
23
|
+
* extended-hours chart fetches every print, so every leg there keeps open plus the span.
|
|
24
|
+
* - Every other leg (US_STOCKS among them, for now) keeps the leg core's open plus the span.
|
|
25
|
+
*
|
|
26
|
+
* What the browser still owns: the chart's session word (`wrunChartSessionType`: regular unless the
|
|
27
|
+
* chart runs its extended session, never unstated), a calendar row's bounds on every market (1M 3M
|
|
28
|
+
* 6M 1Y, `wrunCalendarRowBounds`, and the calendar bar holding an instant), and the live tick's
|
|
29
|
+
* timing: the gateway's rows hold a stock candle whole only minutes after its close (Polygon's
|
|
30
|
+
* minute bars land after their minute, the closing auction joins the session's last minute once
|
|
31
|
+
* the 16:00 bar has landed), so the live tick re-asks a stock leg `WRUN_US_EQUITIES_CLOSE_SETTLE_MS`
|
|
32
|
+
* after a close (`wrunLegCloseSettleMs`), and the pinned-close timer wakes at the close of the leg's
|
|
33
|
+
* bar holding now on the chart's live boundary rule (`wrunLegBarCloseAt`).
|
|
34
|
+
*
|
|
35
|
+
* Synchronous: every wrapper reads the loaded shared host (`wrunChartHostEnv().sharedHost()`), which each own-run
|
|
36
|
+
* entry loads before its first use.
|
|
37
|
+
*/
|
|
38
|
+
import { barStartMs, isCalendarIntervalMs } from '../chart/calendar-interval.util.js';
|
|
39
|
+
import { liveBucketStartMs } from '../chart/live-bucket.util.js';
|
|
40
|
+
import { isEquityExtendedSession } from '../chart/us-equities-session.util.js';
|
|
41
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
42
|
+
import { wrunCalendarRowBounds } from './wrun-source-rows.util.js';
|
|
43
|
+
const DAY_MS = 86_400_000;
|
|
44
|
+
/** How long after a US listing's candle closes the gateway's rows hold all of it: its candles are
|
|
45
|
+
* built from Polygon's minute bars, which land after their minute ends, and the closing auction
|
|
46
|
+
* joins the session's last minute only once the 16:00 bar has landed, after 16:01 New York
|
|
47
|
+
* (docs/features/data/rth-eth-sessions.md, "Closing auction"). The live tick re-asks a stock leg
|
|
48
|
+
* this long after a close, so the confirmed read takes the whole candle. */
|
|
49
|
+
export const WRUN_US_EQUITIES_CLOSE_SETTLE_MS = 180_000;
|
|
50
|
+
/** The venue a leg's bars come from: its pinned exchange, else the chart's. */
|
|
51
|
+
function legExchangeOf(leg, chartExchange) {
|
|
52
|
+
return leg.market?.exchange ?? chartExchange;
|
|
53
|
+
}
|
|
54
|
+
/** The session the chart fetches a US listing's candles on, as the shared host's session calendar
|
|
55
|
+
* reads it: 'extended' only while the chart runs its extended session (`isEquityExtendedSession`,
|
|
56
|
+
* the fetch's own decider), else 'regular', an unset session included (the browser never leaves it
|
|
57
|
+
* unstated; the package reads an unstated session as open plus the span). */
|
|
58
|
+
export function wrunChartSessionType(sessionType) {
|
|
59
|
+
return isEquityExtendedSession(sessionType) ? 'extended' : 'regular';
|
|
60
|
+
}
|
|
61
|
+
/** The chart's session as the row builder reads it (`WrunChartSourceRows.session`): the chart's
|
|
62
|
+
* exchange and the session word of its `sessionType`. */
|
|
63
|
+
export function wrunChartSession(exchange, sessionType) {
|
|
64
|
+
return { ...(exchange !== undefined ? { exchange } : {}), sessionType: wrunChartSessionType(sessionType) };
|
|
65
|
+
}
|
|
66
|
+
/** Whether the gateway builds this leg's bars on the CME session lattice. */
|
|
67
|
+
export function wrunLegRidesCmeSession(leg, chartExchange) {
|
|
68
|
+
const host = wrunChartHostEnv().sharedHost();
|
|
69
|
+
return (host.isCmeSessionLatticeExchange(legExchangeOf(leg, chartExchange)) && host.isCmeSessionLatticeIntervalMs(leg.legMs));
|
|
70
|
+
}
|
|
71
|
+
/** A US listing's candle close on a regular-session chart (the module doc): undefined on an
|
|
72
|
+
* extended-hours chart and on every other venue. */
|
|
73
|
+
function stockLegCandleClose(leg, chartExchange, sessionType) {
|
|
74
|
+
if (!(Number.isFinite(leg.legMs) && leg.legMs > 0) || wrunChartSessionType(sessionType) !== 'regular') {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const host = wrunChartHostEnv().sharedHost();
|
|
78
|
+
if (host.wrunCalendarOfVenue(legExchangeOf(leg, chartExchange)) !== 'us_equities')
|
|
79
|
+
return undefined;
|
|
80
|
+
const stock = { kind: host.WRUN_MARKET_KIND_STOCK, zone: host.WRUN_MARKET_ZONE_NEW_YORK };
|
|
81
|
+
const close = host.wrunMarketLegCandleClose(stock, leg.legMs);
|
|
82
|
+
return close === undefined ? undefined : host.regularWindowClose(close, leg.legMs);
|
|
83
|
+
}
|
|
84
|
+
/** How long after a close the leg's venue holds the whole candle (the module doc): a US listing's
|
|
85
|
+
* `WRUN_US_EQUITIES_CLOSE_SETTLE_MS` where its candles close with the session, 0 for every other
|
|
86
|
+
* leg (its live feed seals a candle at its close). */
|
|
87
|
+
export function wrunLegCloseSettleMs(leg, chartExchange, sessionType) {
|
|
88
|
+
return stockLegCandleClose(leg, chartExchange, sessionType) === undefined ? 0 : WRUN_US_EQUITIES_CLOSE_SETTLE_MS;
|
|
89
|
+
}
|
|
90
|
+
/** The leg's candle closes for the leg core (`closeMs`): the CME session lattice's, else a US
|
|
91
|
+
* listing's session closes on a regular-session chart (the chart's `sessionType`); undefined where
|
|
92
|
+
* they are open plus the span. */
|
|
93
|
+
export function wrunLegCandleClose(leg, chartExchange, sessionType) {
|
|
94
|
+
if (!wrunLegRidesCmeSession(leg, chartExchange))
|
|
95
|
+
return stockLegCandleClose(leg, chartExchange, sessionType);
|
|
96
|
+
const { legMs } = leg;
|
|
97
|
+
const { cmeSessionBarEndMs } = wrunChartHostEnv().sharedHost();
|
|
98
|
+
return (openMs) => cmeSessionBarEndMs(openMs, legMs) ?? openMs + legMs;
|
|
99
|
+
}
|
|
100
|
+
/** When the lattice bar stamped `stampMs` starts trading: its session open, or the stamp for a
|
|
101
|
+
* stamp the lattice does not book. */
|
|
102
|
+
function sessionOpenMs(host, stampMs, intervalMs) {
|
|
103
|
+
return host.cmeSessionBucketMs(stampMs, intervalMs) === stampMs
|
|
104
|
+
? (host.cmeSessionBarOpenMs(stampMs, intervalMs) ?? stampMs)
|
|
105
|
+
: stampMs;
|
|
106
|
+
}
|
|
107
|
+
/** The leg's candle opens for the leg core (`candleOpenMs`), undefined where a candle trades from
|
|
108
|
+
* its stamp: a CME daily, 3d or weekly candle stamped at its trade date trades from the session
|
|
109
|
+
* open before it. */
|
|
110
|
+
export function wrunLegCandleOpen(leg, chartExchange) {
|
|
111
|
+
if (!wrunLegRidesCmeSession(leg, chartExchange))
|
|
112
|
+
return undefined;
|
|
113
|
+
const { legMs } = leg;
|
|
114
|
+
const host = wrunChartHostEnv().sharedHost();
|
|
115
|
+
return (stampMs) => sessionOpenMs(host, stampMs, legMs);
|
|
116
|
+
}
|
|
117
|
+
/** The chart's primary row bounds for the leg core (`rowBounds`), undefined where a row spans
|
|
118
|
+
* [label, label + P): a calendar row (1M 3M 6M 1Y, any market) runs from its label to its calendar
|
|
119
|
+
* end (`wrunCalendarRowBounds`); a row of a market the gateway builds on the CME session lattice,
|
|
120
|
+
* at a lattice interval, runs from its session open to its bar end (a daily row labelled Sep 30
|
|
121
|
+
* runs from Sep 29 22:00Z to Sep 30 22:00Z under daylight time; the Tuesday after Labor Day from
|
|
122
|
+
* the Sunday open). A label the lattice does not book keeps [label, label + P). The row builder
|
|
123
|
+
* reads the same answer through `wrunSessionClock`. */
|
|
124
|
+
export function wrunPrimaryRowBounds(chartExchange, intervalMs) {
|
|
125
|
+
const calendar = wrunCalendarRowBounds(intervalMs);
|
|
126
|
+
if (calendar !== undefined)
|
|
127
|
+
return calendar;
|
|
128
|
+
if (!wrunLegRidesCmeSession({ legMs: intervalMs }, chartExchange))
|
|
129
|
+
return undefined;
|
|
130
|
+
const host = wrunChartHostEnv().sharedHost();
|
|
131
|
+
return (rowOpenMs) => {
|
|
132
|
+
const closeMs = host.cmeSessionBarEndMs(rowOpenMs, intervalMs);
|
|
133
|
+
if (closeMs === null)
|
|
134
|
+
return { openMs: rowOpenMs, closeMs: rowOpenMs + intervalMs };
|
|
135
|
+
return { openMs: Math.min(rowOpenMs, sessionOpenMs(host, rowOpenMs, intervalMs)), closeMs };
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** The label of the primary row holding `instantMs` where a calendar labels the rows: its calendar
|
|
139
|
+
* bar on a calendar chart (March 10 is the March 1 row), the row whose session holds it on the CME
|
|
140
|
+
* session lattice; undefined elsewhere, where the caller keeps its own grid. */
|
|
141
|
+
export function wrunPrimaryRowHoldingMs(chartExchange, intervalMs, instantMs) {
|
|
142
|
+
if (isCalendarIntervalMs(intervalMs))
|
|
143
|
+
return barStartMs(instantMs, intervalMs);
|
|
144
|
+
if (!wrunLegRidesCmeSession({ legMs: intervalMs }, chartExchange))
|
|
145
|
+
return undefined;
|
|
146
|
+
return wrunChartHostEnv().sharedHost().cmeSessionBucketMs(instantMs, intervalMs) ?? undefined;
|
|
147
|
+
}
|
|
148
|
+
/** The open of the first US equities session after `instantMs` (the NYSE calendar the stock
|
|
149
|
+
* close reads), undefined when none opens within a week. */
|
|
150
|
+
function nextUsEquitiesOpenMs(instantMs) {
|
|
151
|
+
for (let day = 0; day <= 7; day += 1) {
|
|
152
|
+
const session = wrunChartHostEnv()
|
|
153
|
+
.sharedHost()
|
|
154
|
+
.wrunUsEquitiesSession(instantMs + day * DAY_MS);
|
|
155
|
+
if (session !== null && session.openMs > instantMs)
|
|
156
|
+
return session.openMs;
|
|
157
|
+
}
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
/** The close of the leg's bar holding `nowMs` where its venue closes bars off the plain grid,
|
|
161
|
+
* undefined elsewhere or once that bar has closed (the caller keeps its own grid, a wake no later
|
|
162
|
+
* than the next close): on the CME session lattice the lattice bar's end; on a US listing on a
|
|
163
|
+
* regular-session chart (the chart's `sessionType`) the stock's close (`wrunLegCandleClose`) of
|
|
164
|
+
* the candle the chart's live boundary rule keys now to (`liveBucketStartMs`: the trade date for a
|
|
165
|
+
* day, the Monday for a week, the 09:30 New York lattice from 45m to 12h), and off the session on
|
|
166
|
+
* that lattice the first candle of the next session. */
|
|
167
|
+
export function wrunLegBarCloseAt(leg, chartExchange, nowMs, sessionType) {
|
|
168
|
+
const host = wrunChartHostEnv().sharedHost();
|
|
169
|
+
if (wrunLegRidesCmeSession(leg, chartExchange)) {
|
|
170
|
+
const barMs = host.cmeSessionBucketMs(nowMs, leg.legMs);
|
|
171
|
+
const endMs = barMs === null ? null : host.cmeSessionBarEndMs(barMs, leg.legMs);
|
|
172
|
+
return endMs !== null && endMs > nowMs ? endMs : undefined;
|
|
173
|
+
}
|
|
174
|
+
const close = stockLegCandleClose(leg, chartExchange, sessionType);
|
|
175
|
+
if (close === undefined)
|
|
176
|
+
return undefined;
|
|
177
|
+
const venue = { exchange: legExchangeOf(leg, chartExchange), sessionType };
|
|
178
|
+
let stampMs = liveBucketStartMs(nowMs, leg.legMs, venue);
|
|
179
|
+
if (stampMs === null) {
|
|
180
|
+
const openMs = nextUsEquitiesOpenMs(nowMs);
|
|
181
|
+
stampMs = openMs === undefined ? null : liveBucketStartMs(openMs, leg.legMs, venue);
|
|
182
|
+
}
|
|
183
|
+
if (stampMs === null)
|
|
184
|
+
return undefined;
|
|
185
|
+
const endMs = host.wrunLegCandleCloseMs(stampMs, leg.legMs, close);
|
|
186
|
+
return endMs > nowMs ? endMs : undefined;
|
|
187
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the chart fetches an interval-pinned leg from, through the shared host's leg core
|
|
3
|
+
* (`@orangecharts/indicator-kit/host` through the seam, the om SDK's wrun-legs.ts): never re-derived
|
|
4
|
+
* here.
|
|
5
|
+
*
|
|
6
|
+
* - A candle leg (a period leg's scalar views, a `candles` stream) asks from the earliest start
|
|
7
|
+
* its readings plan, `wrunLegFetchStart` per input over the window's head and the run's clock:
|
|
8
|
+
* two leg spans before the head on a leg coarser than the chart, one on an equal or finer
|
|
9
|
+
* leg, N more for view `offset` N, and `bars` deepening it from the leg bucket holding now; a
|
|
10
|
+
* `candles` input read with view "forming" (the live candle) asks two leg spans before the
|
|
11
|
+
* bucket holding now (`candles_forming`), one read with view "forming_open" (the open of the
|
|
12
|
+
* candle holding each row) one leg span before the head's leg bucket (`candles_forming_open`),
|
|
13
|
+
* both through now.
|
|
14
|
+
* - A candle leg coarser than the chart also asks a warm-up floor, `WRUN_COARSER_LEG_WARMUP_CANDLES`
|
|
15
|
+
* leg candles before the head (a 1h or 4h leg on a 1m chart otherwise holds only the few
|
|
16
|
+
* candles of the chart's own window), cut silently at the history wall: the floor is the
|
|
17
|
+
* chart's depth, never an input's ask, so it adds no legend note and the readings' own ask
|
|
18
|
+
* (`askedFromTs`, the om daemon's rule) is unchanged. A leg read only by streams (a `candles`,
|
|
19
|
+
* `oi_candles` or `volume_profile_candles` backlog, the live candle of view "forming", the open
|
|
20
|
+
* of view "forming_open") reads no candle before its readings' ask and asks no floor: a profile
|
|
21
|
+
* stream's candles carry whole row sets.
|
|
22
|
+
* - The chart's history wall (the TSDB gateway's per-interval reach, `historyReachMs`: 15,000
|
|
23
|
+
* bars at most intervals, 25,000 at 1h and 50,000 at 30m, now minus that many leg spans) clamps
|
|
24
|
+
* each ask through `wrunServedLegStart`: the leg is asked from the first whole candle at or
|
|
25
|
+
* after the wall, a run is never refused for depth, and an input that asked for more history
|
|
26
|
+
* than the wall serves gets the core's note as a legend warning row.
|
|
27
|
+
* - An own-market `forming` view's pre-roll: the primary rows from the head's leg bucket open
|
|
28
|
+
* (`wrunLegFetchStart` reading "forming", the om daemon's primary fetch rule) up to the head,
|
|
29
|
+
* folded into the head's bucket so the first rows read the whole bucket, not NaN.
|
|
30
|
+
*
|
|
31
|
+
* Pure (no store, no fetch): the run pass calls it before any lane fetch, and the leg corpus
|
|
32
|
+
* replay drives it with the corpus's own clocks.
|
|
33
|
+
*/
|
|
34
|
+
import type { RuntimeDiagnostic } from '../../interfaces/kscript-diagnostics.interface.js';
|
|
35
|
+
import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
|
|
36
|
+
import type { WrunLegReading } from '@orangecharts/indicator-kit/host';
|
|
37
|
+
import { type WrunSharedHostModule } from '../../host-env.js';
|
|
38
|
+
import type { WrunAlignClock, WrunPinnedLeg, WrunPinnedWire } from './wrun-source-rows.util.js';
|
|
39
|
+
/** One input's reading of a candle leg: what the leg is fetched for. */
|
|
40
|
+
export interface WrunLegFetchRead {
|
|
41
|
+
inputName: string;
|
|
42
|
+
reading: WrunLegReading;
|
|
43
|
+
bars?: number;
|
|
44
|
+
offset?: number;
|
|
45
|
+
}
|
|
46
|
+
/** A leg ask the history wall cut: the input, the leg and the core's note naming the served
|
|
47
|
+
* start. */
|
|
48
|
+
export interface WrunClampedLeg {
|
|
49
|
+
inputName: string;
|
|
50
|
+
intervalKey: string;
|
|
51
|
+
note: string;
|
|
52
|
+
}
|
|
53
|
+
export interface WrunLegFetchPlan {
|
|
54
|
+
/** Where the readings ask from, before the wall (the earliest `wrunLegFetchStart`). */
|
|
55
|
+
askedFromTs: number;
|
|
56
|
+
/** Where the leg is fetched from: the earliest served start over the readings and the
|
|
57
|
+
* warm-up floor. */
|
|
58
|
+
fromTs: number;
|
|
59
|
+
/** The readings the wall cut, each with its note. */
|
|
60
|
+
clamped: WrunClampedLeg[];
|
|
61
|
+
/** The warm-up floor's served start on a leg coarser than the chart (absent on an equal or
|
|
62
|
+
* finer leg, an odds leg, or a leg read for its live candle alone). */
|
|
63
|
+
warmUpFromTs?: number;
|
|
64
|
+
/** An intrabar plan the wall cuts: where the wall serves the leg from (the ask itself goes out
|
|
65
|
+
* whole, `planWrunIntrabarLegFetch`); absent when the wall cuts nothing. */
|
|
66
|
+
wallFromTs?: number;
|
|
67
|
+
}
|
|
68
|
+
/** The leg candles a candle leg coarser than the chart asks before the window's head: a reading
|
|
69
|
+
* seeded on the first candle it sees (an EMA over 1h closes on a 1m chart, whose window holds
|
|
70
|
+
* about ten of them) then starts from history instead of the head (A23). The wall still cuts
|
|
71
|
+
* it, silently. */
|
|
72
|
+
export declare const WRUN_COARSER_LEG_WARMUP_CANDLES = 200;
|
|
73
|
+
/** The chart's history wall for a leg asked at its own interval: now minus the gateway's reach
|
|
74
|
+
* at that interval. The free row is the reach every viewer has (free and plus share one row
|
|
75
|
+
* since tsdb-gateway cee00f2), so the clamp never asks past what a viewer is served. */
|
|
76
|
+
export declare function wrunChartLegReachMs(intervalKey: string, nowMs: number): number;
|
|
77
|
+
/** The chart's clamp of one leg ask (`wrunServedLegStart`, the core's): where to ask, whether
|
|
78
|
+
* the wall cut candles off the plan, and the note naming the served start. `reachMs` defaults
|
|
79
|
+
* to the chart's gateway wall at the leg's interval. */
|
|
80
|
+
export declare function wrunChartLegServedStart(input: {
|
|
81
|
+
inputName: string;
|
|
82
|
+
leg: Pick<WrunPinnedLeg, 'intervalKey' | 'legMs'>;
|
|
83
|
+
nowMs: number;
|
|
84
|
+
askedStartMs: number;
|
|
85
|
+
reachMs?: number;
|
|
86
|
+
}): ReturnType<WrunSharedHostModule['wrunServedLegStart']>;
|
|
87
|
+
/** The readings of a candle leg (`kind` absent: a period leg's scalar views, the `candles`
|
|
88
|
+
* streams and the live-candle readings it serves), in input order. An own-market `forming`
|
|
89
|
+
* view folds the primary rows, whose head bucket the pre-roll fetch covers
|
|
90
|
+
* (`planWrunFormingPreRoll`); the leg's own series keeps the confirmed two-span pre-roll for it
|
|
91
|
+
* (the om daemon's rule). */
|
|
92
|
+
export declare function wrunLegFetchReads(metadata: WrunIndicatorMetadata, leg: WrunPinnedLeg, wires: ReadonlyMap<number, WrunPinnedWire>): WrunLegFetchRead[];
|
|
93
|
+
/** A candle leg's fetch window start: every reading's `wrunLegFetchStart` over the head and the
|
|
94
|
+
* clock, each clamped at the wall (`wrunServedLegStart`), the earliest served start asked; on a
|
|
95
|
+
* leg coarser than the chart, no later than the warm-up floor (`WRUN_COARSER_LEG_WARMUP_CANDLES`
|
|
96
|
+
* leg candles before the head, cut at the wall without a note). An odds leg keeps its readings'
|
|
97
|
+
* ask (its fetch seeds and gap-fills the market's own history), and so does a leg every reading of
|
|
98
|
+
* which is a stream's (a `candles` or lane stream backlog, the live candle alone, the open of the
|
|
99
|
+
* candle holding each row): a stream reads nothing before its own ask. `reachMs` defaults to the chart's gateway
|
|
100
|
+
* wall at the leg's interval. */
|
|
101
|
+
export declare function planWrunLegFetch(input: {
|
|
102
|
+
leg: Pick<WrunPinnedLeg, 'intervalKey' | 'legMs'> & Partial<Pick<WrunPinnedLeg, 'odds'>>;
|
|
103
|
+
reads: readonly WrunLegFetchRead[];
|
|
104
|
+
clock: WrunAlignClock;
|
|
105
|
+
headMs: number;
|
|
106
|
+
reachMs?: number;
|
|
107
|
+
}): WrunLegFetchPlan;
|
|
108
|
+
/** An intrabar leg's fetch, kScript's ltf() rule: the chart's window whole from its head (an
|
|
109
|
+
* exact slice of each row needs no pre-roll), never clamped before the ask. The engine asks an
|
|
110
|
+
* ltf() source over the window it runs and the gateway trims a request straddling the viewer's
|
|
111
|
+
* history wall to the entitled suffix, so the twin asks that same request: the same chunking (a
|
|
112
|
+
* window past KSCRIPT_SOURCE_CHUNK_MAX_PIECES goes out as one request, the original's shape,
|
|
113
|
+
* where a pre-clamp at the free wall left ~60 pieces that outlived the source deadline) and the
|
|
114
|
+
* history the viewer is entitled to (all of it on an account the wall does not cut). The wall's
|
|
115
|
+
* notes are planned here (`clamped`, the core's words; `wallFromTs`, where the wall serves from)
|
|
116
|
+
* and stand only when the answer starts at the wall (`wrunIntrabarServedNotes`). */
|
|
117
|
+
export declare function planWrunIntrabarLegFetch(input: {
|
|
118
|
+
leg: Pick<WrunPinnedLeg, 'intervalKey' | 'legMs' | 'inputIndexes'>;
|
|
119
|
+
metadata: WrunIndicatorMetadata;
|
|
120
|
+
clock: WrunAlignClock;
|
|
121
|
+
headMs: number;
|
|
122
|
+
reachMs?: number;
|
|
123
|
+
}): WrunLegFetchPlan;
|
|
124
|
+
/** The wall notes an intrabar ask keeps once answered (`planWrunIntrabarLegFetch`): the ask went
|
|
125
|
+
* out whole, so a note stands only when the answer starts at the wall the plan named (its first
|
|
126
|
+
* closed candle opens no earlier than `wallFromTs` less the slack), or answered nothing; an
|
|
127
|
+
* answer reaching past the wall (an account it does not cut) keeps none, as kScript's original
|
|
128
|
+
* says nothing there. */
|
|
129
|
+
export declare function wrunIntrabarServedNotes(plan: Pick<WrunLegFetchPlan, 'clamped' | 'wallFromTs'>, closedRows: ReadonlyArray<ArrayLike<number>>, legMs: number): WrunClampedLeg[];
|
|
130
|
+
/** The own-market `forming` pre-roll's ask: the earliest head bucket open over the views
|
|
131
|
+
* (`wrunLegFetchStart` reading "forming"), or undefined when nothing needs one (no such view,
|
|
132
|
+
* or every head bucket opens at the head). Undefined too when that bucket opens behind the
|
|
133
|
+
* wall (`reachMs`, default the chart's gateway wall at the chart interval): a bucket the
|
|
134
|
+
* gateway cannot serve whole stays NaN until a pan-back, never folded partial. */
|
|
135
|
+
export declare function planWrunFormingPreRoll(input: {
|
|
136
|
+
wires: ReadonlyMap<number, WrunPinnedWire>;
|
|
137
|
+
clock: WrunAlignClock;
|
|
138
|
+
headMs: number;
|
|
139
|
+
chartIntervalKey: string;
|
|
140
|
+
reachMs?: number;
|
|
141
|
+
}): number | undefined;
|
|
142
|
+
/** One warning row per input whose leg ask the history wall cut: the core's note (asked N
|
|
143
|
+
* candles from a date; history served from a date), the run drawn from what was served. */
|
|
144
|
+
export declare function wrunClampedLegDiagnostics(legs: ReadonlyArray<WrunClampedLeg>): RuntimeDiagnostic[];
|