@orangecharts/wrun-chart-host 0.2.0 → 0.4.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 +22 -8
- 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/scriptEditor/builtin-script-snippets.d.ts +133 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -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 +163 -5
- package/dist/host-ports.types.d.ts +431 -0
- package/dist/host-ports.types.js +1 -0
- package/dist/index.d.ts +138 -0
- package/dist/index.js +138 -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/date-labelled-interval.leaf.d.ts +15 -0
- package/dist/utility/chart/date-labelled-interval.leaf.js +19 -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/indicator-run-interval.util.d.ts +130 -0
- package/dist/utility/chart/indicator-run-interval.util.js +268 -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/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/window-geometry.leaf.d.ts +119 -0
- package/dist/utility/chart/window-geometry.leaf.js +391 -0
- package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
- package/dist/utility/chart/window-owner.leaf.js +24 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -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/html-escape.leaf.d.ts +11 -0
- package/dist/utility/html-escape.leaf.js +20 -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 +58 -0
- package/dist/utility/wrun/sources/lanes/option_daily.js +111 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +21 -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 +215 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +477 -0
- package/dist/utility/wrun/sources/registry.d.ts +21 -0
- package/dist/utility/wrun/sources/registry.js +237 -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 +55 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +126 -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 +62 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +147 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +70 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +144 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +309 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +350 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +576 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +275 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +207 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +450 -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-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-frames.d.ts +20 -1
- package/dist/utility/wrun/wrun-frames.js +103 -49
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +27 -0
- 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 +49 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +115 -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-panel-mount.lazy.d.ts +10 -0
- package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +377 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +2251 -0
- 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-pause-dim.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-pause-dim.util.js +153 -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-plot-gate.types.d.ts +23 -0
- package/dist/utility/wrun/wrun-plot-gate.types.js +7 -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 +41 -1
- package/dist/utility/wrun/wrun-refusal.util.js +69 -2
- 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-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-run-interval-projection.types.d.ts +14 -0
- package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -0
- package/dist/utility/wrun/wrun-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-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,576 @@
|
|
|
1
|
+
import { wrunOptionsStopSeed, wrunRefusalSeedOf } from '../wrun-refusal.util.js';
|
|
2
|
+
import { wrunPollLaneByKey, wrunPollLaneGlobalClasses, wrunPollLanes, wrunPollLanesOfClass } from './registry.js';
|
|
3
|
+
import { refuseWrunPollInput, WRUN_POLL_LANE_ID_PREFIX, } from './wrun-poll-lane.types.js';
|
|
4
|
+
import { wrunLaneChainPlaneOf } from './wrun-row-lane.types.js';
|
|
5
|
+
import { WRUN_DAILY_LANE_INTERVAL_KEY, wrunDailyLaneFetchFrom, wrunDailyLaneFetchTo, wrunDailyLaneReconcileFrom, wrunDailyLaneReconcileTo, } from '../wrun-daily-lane.util.js';
|
|
6
|
+
import { assertWrunOpraLaneReadable, wrunOpraLanePayloadFields } from '../wrun-opra-lane.util.js';
|
|
7
|
+
import { wrunHostGridAsks, wrunHostGridFetchTo, wrunLandScalarRowsOnHostBars } from '../wrun-tier-grid.util.js';
|
|
8
|
+
/**
|
|
9
|
+
* The static plan: every input whose class the registry serves, in declaration order, with the
|
|
10
|
+
* lane serving its field and the field's column. Refused by name: a celled input (poll lanes
|
|
11
|
+
* are scalar) and a field no lane of the class serves (the message lists the served ones).
|
|
12
|
+
* Empty when the sheet reads no registry class.
|
|
13
|
+
*/
|
|
14
|
+
export function planWrunPollLaneInputs(metadata) {
|
|
15
|
+
const planned = [];
|
|
16
|
+
if (wrunPollLanes().length === 0)
|
|
17
|
+
return planned;
|
|
18
|
+
const inputs = [...metadata.inputs].sort((a, b) => a.index - b.index);
|
|
19
|
+
for (const input of inputs) {
|
|
20
|
+
const source = metadata.inputSources[input.name];
|
|
21
|
+
if (!source)
|
|
22
|
+
continue;
|
|
23
|
+
const lanes = wrunPollLanesOfClass(source.source);
|
|
24
|
+
if (lanes.length === 0)
|
|
25
|
+
continue;
|
|
26
|
+
const label = `Input '${input.name}' (${source.source})`;
|
|
27
|
+
if (input.cellType === 'array') {
|
|
28
|
+
throw new Error(`${label} is celled: ${source.source} serves one scalar per bar, a scalar input`);
|
|
29
|
+
}
|
|
30
|
+
const field = source.field ?? '';
|
|
31
|
+
const lane = lanes.find((candidate) => Object.prototype.hasOwnProperty.call(candidate.fields, field));
|
|
32
|
+
if (lane === undefined) {
|
|
33
|
+
const served = lanes.flatMap((candidate) => Object.keys(candidate.fields));
|
|
34
|
+
throw new Error(`${label}: unknown ${source.source} field '${String(source.field)}' (the served fields: ${served.join(', ')})`);
|
|
35
|
+
}
|
|
36
|
+
planned.push({ inputIndex: input.index, inputName: input.name, source, lane, column: lane.fields[field] });
|
|
37
|
+
}
|
|
38
|
+
return planned;
|
|
39
|
+
}
|
|
40
|
+
/** A value's canonical text: object keys sorted at every depth, `undefined` members dropped (the instance key's
|
|
41
|
+
* suffix, here and for the row lanes). */
|
|
42
|
+
export function stableJson(value) {
|
|
43
|
+
if (Array.isArray(value))
|
|
44
|
+
return `[${value.map((item) => stableJson(item)).join(',')}]`;
|
|
45
|
+
if (value !== null && typeof value === 'object') {
|
|
46
|
+
const record = value;
|
|
47
|
+
const members = Object.keys(record)
|
|
48
|
+
.filter((key) => record[key] !== undefined)
|
|
49
|
+
.sort()
|
|
50
|
+
.map((key) => `${JSON.stringify(key)}:${stableJson(record[key])}`);
|
|
51
|
+
return `{${members.join(',')}}`;
|
|
52
|
+
}
|
|
53
|
+
return JSON.stringify(value) ?? 'null';
|
|
54
|
+
}
|
|
55
|
+
/** The id of the lane instance `extras` names: `poll:<laneKey>` when the ask carries no extras,
|
|
56
|
+
* else the extras' canonical text appended, so equal asks are ONE instance whatever order
|
|
57
|
+
* their fields were written in and different asks never collide. */
|
|
58
|
+
export function wrunPollLaneInstanceKey(laneKey, extras) {
|
|
59
|
+
const named = Object.keys(extras).some((key) => extras[key] !== undefined);
|
|
60
|
+
return `${WRUN_POLL_LANE_ID_PREFIX}${laneKey}${named ? stableJson(extras) : ''}`;
|
|
61
|
+
}
|
|
62
|
+
/** Why a lane reading the chart's market is not served on an index-mode chart, as its refusal
|
|
63
|
+
* says it: such a chart serves candles, time and the global series (named by class). */
|
|
64
|
+
export function wrunPollLaneIndexModeReason() {
|
|
65
|
+
const served = wrunPollLaneGlobalClasses();
|
|
66
|
+
const native = wrunPollLaneNativeRowsClasses();
|
|
67
|
+
const own = native.length > 0 ? `, the series of its own market read from another plane (${native.join(', ')})` : '';
|
|
68
|
+
const serves = served.length > 0
|
|
69
|
+
? `candles, time${own} and the series that name their own subject (${served.join(', ')})`
|
|
70
|
+
: `candles${own === '' ? ' and time' : `, time${own}`}`;
|
|
71
|
+
return `is not served on this chart: it reads the chart's own market, and a stock, forex, commodity or DEX chart serves ${serves}`;
|
|
72
|
+
}
|
|
73
|
+
/** The classes of the per-bar native-rows lanes (`nativeRows`), served on index-mode charts too, once each,
|
|
74
|
+
* in file order. */
|
|
75
|
+
function wrunPollLaneNativeRowsClasses() {
|
|
76
|
+
const classes = [];
|
|
77
|
+
for (const lane of wrunPollLanes()) {
|
|
78
|
+
if (lane.nativeRows === true && !classes.includes(lane.sourceClass))
|
|
79
|
+
classes.push(lane.sourceClass);
|
|
80
|
+
}
|
|
81
|
+
return classes;
|
|
82
|
+
}
|
|
83
|
+
/** Whether a lane is served on an index-mode chart: a `global` one (its own subject) or a `nativeRows` one
|
|
84
|
+
* (the chart's own market read from another plane, on the native-rows path). */
|
|
85
|
+
function wrunPollLaneServedOnIndexMode(lane) {
|
|
86
|
+
return lane.global === true || lane.nativeRows === true;
|
|
87
|
+
}
|
|
88
|
+
/** Why an `opra` lane is not served on a chart whose options ride no OPRA plane, as its refusal says it. */
|
|
89
|
+
const WRUN_POLL_OPRA_UNADMITTED_REASON = "is not served on this chart: it reads US options data, which a US stock or ETF chart (its underlying's options) and an OPRA option contract chart serve";
|
|
90
|
+
/** The technical words of an OPRA lane a known stop keeps off the chart (Copy details), by the stop's reason. */
|
|
91
|
+
export function wrunOpraPlaneStopDetail(stop) {
|
|
92
|
+
return stop === 'flag-off'
|
|
93
|
+
? 'is not served for this account yet: the opra flag is off, so no US options data is read on any chart'
|
|
94
|
+
: 'is not served on this chart: an index chart does not ride the OPRA plane yet, so no US options data is read for it';
|
|
95
|
+
}
|
|
96
|
+
/** The chart's OPRA plane facts, off the predicates the run injects (`isOpraPlaneExchange`: absent, no chart rides
|
|
97
|
+
* the plane; `opraPlaneStop`, asked only off the plane). */
|
|
98
|
+
export function wrunChartOpraPlane(exchange, facts) {
|
|
99
|
+
if (facts?.isOpraPlaneExchange?.(exchange) === true)
|
|
100
|
+
return { onPlane: true };
|
|
101
|
+
const stop = facts?.opraPlaneStop?.(exchange);
|
|
102
|
+
return stop !== undefined ? { onPlane: false, stop } : { onPlane: false };
|
|
103
|
+
}
|
|
104
|
+
/** The fills a scalar input reads on every bar of a feed the chart does not serve (`missing: "nan"` or `"zero"`). */
|
|
105
|
+
const WRUN_POLL_LANE_UNSERVED_FILLS = Object.freeze(['nan', 'zero']);
|
|
106
|
+
/**
|
|
107
|
+
* The ONE rule for an input of a lane the chart does not serve, both planners' (`planWrunPollLanes` with
|
|
108
|
+
* `WRUN_POLL_LANE_UNSERVED_FILLS`, wrun-row-lanes.util `planWrunRowLanes` with a celled input's `empty`), whatever keeps
|
|
109
|
+
* it unserved (an index-mode chart, an OPRA lane off the plane, a chain lane stopped off it, a chart with no option
|
|
110
|
+
* chain): an input that declared one of `fills` is dropped from planning and named in `missing` under its feed, one
|
|
111
|
+
* entry per feed with its inputs in declaration order (the run draws, the row builder hands it an empty lane, a note
|
|
112
|
+
* says which feed and why); any other refuses by name (the default `carry` policy has nothing to carry). Throws, or
|
|
113
|
+
* records the note.
|
|
114
|
+
*
|
|
115
|
+
* The words: a known stop (`stop`) says that reason, the note and the refusal alike (`options-stopped`), never "this
|
|
116
|
+
* market has no such feed"; a chart with no option chain (`noChain`) puts the chain decision's own words in the note's
|
|
117
|
+
* details under the market's note (an options feed is missing on every market alike, a crypto one too), and an input
|
|
118
|
+
* with no fill refuses with that decision itself (`no-options` / `chain`); any other is the feed-missing record, saying
|
|
119
|
+
* "it comes from crypto markets" only on a chart provably no crypto venue (`cryptoVenue` false).
|
|
120
|
+
*/
|
|
121
|
+
export function wrunUnservedLaneInput(missing, input, fills, why, cryptoVenue) {
|
|
122
|
+
const fill = typeof input.missing === 'string' && fills.includes(input.missing) ? input.missing : undefined;
|
|
123
|
+
if (fill === undefined) {
|
|
124
|
+
if ('noChain' in why)
|
|
125
|
+
throw why.noChain;
|
|
126
|
+
return refuseWrunPollInput(input, why.words, why.stop !== undefined
|
|
127
|
+
? wrunOptionsStopSeed(why.stop, { severity: 'paused' })
|
|
128
|
+
: {
|
|
129
|
+
cls: 'feed-missing',
|
|
130
|
+
variant: cryptoVenue === false ? 'crypto-only' : 'market-paused',
|
|
131
|
+
params: { feed: input.feed },
|
|
132
|
+
severity: 'paused',
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const said = 'noChain' in why ? why.noChain.message : `Input '${input.inputName}' (${input.sourceClass}) ${why.words}`;
|
|
136
|
+
const details = `${said}; it declares missing: "${fill}", so it reads ${fill === 'empty' ? 'an empty block' : 'that fill'} on every bar`;
|
|
137
|
+
const entry = missing.get(input.feed);
|
|
138
|
+
if (entry !== undefined) {
|
|
139
|
+
entry.inputNames.push(input.inputName);
|
|
140
|
+
entry.details = `${entry.details}\n${details}`;
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const stop = 'stop' in why ? why.stop : undefined;
|
|
144
|
+
missing.set(input.feed, {
|
|
145
|
+
inputNames: [input.inputName],
|
|
146
|
+
feed: input.feed,
|
|
147
|
+
variant: !('noChain' in why) && cryptoVenue === false ? 'crypto-only' : 'market',
|
|
148
|
+
details,
|
|
149
|
+
...(stop !== undefined ? { stop } : {}),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Whether a lane's refusal says the chart has no option chain: its record's seed is `no-options` / `chain` (the chain
|
|
154
|
+
* decision's `no-chain`, opra-option-lanes.util `wrunLaneChainRefusalSeed`, and the OPRA-only lanes' "OPRA lists no
|
|
155
|
+
* options here"), read off the seed, never the words. Such a chart (a LINK perp, a forex pair, a stock listing no
|
|
156
|
+
* options) does not serve the feed: both planners hand the refusal to `wrunUnservedLaneInput`, so a declared fill reads.
|
|
157
|
+
*/
|
|
158
|
+
export function wrunLaneNoChainRefusal(error) {
|
|
159
|
+
const seed = wrunRefusalSeedOf(error);
|
|
160
|
+
return error instanceof Error && seed?.cls === 'no-options' && seed.variant === 'chain';
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* A chain lane's input before its chain is resolved, both planners' one rule: where the chart's options list on OPRA
|
|
164
|
+
* (riding the plane, or kept off it by a known stop) the OPRA wall first (`opra-official-only:<class>`), every chain it
|
|
165
|
+
* would read there being OPRA's; then, kept off the plane by a known stop (the `opra` flag dark, an index chart), why
|
|
166
|
+
* the input is unserved (the stop's words and the stop, for `wrunUnservedLaneInput`), so no chain is resolved past the
|
|
167
|
+
* stop. Undefined: the lane resolves its chain (its instance then meets its own plane's wall,
|
|
168
|
+
* `assertWrunLaneChainPlaneReadable`).
|
|
169
|
+
*/
|
|
170
|
+
export function wrunChainLaneStop(plane, run, ctx) {
|
|
171
|
+
if (plane.onPlane || plane.stop !== undefined)
|
|
172
|
+
assertWrunOpraLaneReadable(run, ctx);
|
|
173
|
+
return plane.stop === undefined ? undefined : { words: wrunOpraPlaneStopDetail(plane.stop), stop: plane.stop };
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Why a poll lane that is no chain lane is not served on the chart, or undefined: an `opra` lane (after the OPRA wall,
|
|
177
|
+
* on any chart) off the plane when the run judges the plane (the stop's words when a known stop keeps the chart's
|
|
178
|
+
* options off it, else `WRUN_POLL_OPRA_UNADMITTED_REASON`), and a lane reading the chart's own market on an index-mode
|
|
179
|
+
* chart (`wrunPollLaneIndexModeReason`).
|
|
180
|
+
*/
|
|
181
|
+
function wrunPollLaneUnserved(lane, plane, indexMode, run, ctx) {
|
|
182
|
+
if (lane.opra === true) {
|
|
183
|
+
assertWrunOpraLaneReadable(run, ctx);
|
|
184
|
+
if (run?.isOpraPlaneExchange !== undefined && !plane.onPlane) {
|
|
185
|
+
return plane.stop !== undefined
|
|
186
|
+
? { words: wrunOpraPlaneStopDetail(plane.stop), stop: plane.stop }
|
|
187
|
+
: { words: WRUN_POLL_OPRA_UNADMITTED_REASON };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return indexMode && !wrunPollLaneServedOnIndexMode(lane) ? { words: wrunPollLaneIndexModeReason() } : undefined;
|
|
191
|
+
}
|
|
192
|
+
function wrunPollLanePlanResult(lanes, missingFeeds) {
|
|
193
|
+
const result = [...lanes];
|
|
194
|
+
Object.defineProperty(result, 'lanes', { value: lanes, enumerable: false });
|
|
195
|
+
Object.defineProperty(result, 'missingFeeds', { value: missingFeeds, enumerable: false });
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* The run's plan against the chart, before any fetch: every registry input's `plan()` in
|
|
200
|
+
* declaration order (the first refusal by name wins, like every other pre-fetch refusal),
|
|
201
|
+
* grouped into lane instances by lane and payload extras. Empty when the sheet reads no
|
|
202
|
+
* registry class.
|
|
203
|
+
*
|
|
204
|
+
* On an index-mode chart (US stocks, forex, commodities, DEX: `isIndexModeExchange` answers for
|
|
205
|
+
* the chart's exchange) the chart's fetch answers nothing for a source other than candles asked
|
|
206
|
+
* on the chart's own exchange, so a lane that reads the chart's market is not served there (the
|
|
207
|
+
* capability evidence, never an empty window):
|
|
208
|
+
* - an input of such a lane that declares `missing: "nan"` or `"zero"` is dropped from planning
|
|
209
|
+
* (its lane's `plan` never runs, no fetch) and named in `missingFeeds` under its lane key: the
|
|
210
|
+
* row builder hands it an empty lane, so it reads its fill on every bar and the run draws;
|
|
211
|
+
* - any other input of such a lane (the default `carry` policy has nothing to carry) refuses by
|
|
212
|
+
* name (`wrunPollLaneIndexModeReason`), seeded `feed-missing` with its lane key.
|
|
213
|
+
* Both say "it comes from crypto markets" only when the chart is provably no crypto venue
|
|
214
|
+
* (`isCryptoVenueExchange` answers false; a DEX pool is index-mode AND a crypto venue), the
|
|
215
|
+
* neutral market words otherwise.
|
|
216
|
+
*
|
|
217
|
+
* A `global` lane (a series naming its own subject: a publisher's series, a token's supply, a
|
|
218
|
+
* venue's asset) is planned there like anywhere; its asks ride the fetch's native-rows path
|
|
219
|
+
* (`wrunPollLaneFetchOptions`), so the asked window stands and the control's own rows return
|
|
220
|
+
* instead of the chart's span re-stamped onto its sparse bars, and its daily landing finds the
|
|
221
|
+
* day's first bar on a session grid (wrun-daily-lane.util). The chart's index-mode verdict
|
|
222
|
+
* reaches each lane's `plan` as `ctx.indexMode`, the venue verdict as `ctx.cryptoVenue`.
|
|
223
|
+
*
|
|
224
|
+
* A `nativeRows` lane (a per-bar series of the chart's own market read from another plane: a stock
|
|
225
|
+
* chart's US options) is planned there too: its asks ride the native-rows path and land on the host
|
|
226
|
+
* bar grid (`barGrid`).
|
|
227
|
+
*
|
|
228
|
+
* An `opra` lane (US options data) is refused by name before its lane's `plan` runs for a run that may
|
|
229
|
+
* not read the OPRA plane (`mayReadOpra` over `run`: an official package always, a draft or community
|
|
230
|
+
* package only under the `opra-user-scripts` flag; absent reads closed): `opra-official-only:<class>`.
|
|
231
|
+
* It is served only where the chart's options ride the plane (`run.isOpraPlaneExchange`): on any other chart
|
|
232
|
+
* an input of it that declared a missing fill is dropped like an index-mode one, any other refuses by name.
|
|
233
|
+
* A chart whose options list on OPRA but ride no plane for a known reason (`run.opraPlaneStop`: the `opra`
|
|
234
|
+
* flag dark, `flag-off`; an index chart the router sends no OPRA read for, `chart-kind`) says that reason in the
|
|
235
|
+
* note and in the refusal (`options-stopped`), never "this market has no such feed".
|
|
236
|
+
* The run's facts reach an `opra` lane's `plan` as `ctx.official` and `ctx.opraUserScripts`.
|
|
237
|
+
*
|
|
238
|
+
* A `chain` lane (the chart's options chain on whichever plane it lists on) is admitted on every chart its options are
|
|
239
|
+
* not stopped on: its `plan` resolves the chain through the one chain resolver. It meets the OPRA wall before its
|
|
240
|
+
* `plan` runs where the chart's options list on OPRA (every chain it reads there is OPRA's), and each instance then
|
|
241
|
+
* meets its own plane's wall (`assertWrunLaneChainPlaneReadable`: OPRA's, the CME display wall, none for a crypto
|
|
242
|
+
* chain). On a chart whose options list on OPRA but ride no plane for a known reason (`run.opraPlaneStop`) it keeps an
|
|
243
|
+
* `opra` lane's rules (`wrunChainLaneStop`, the row lanes' one rule): a declared fill drops the input with the stop's
|
|
244
|
+
* note, any other input refuses with it, and no chain is resolved past the stop. Its context carries the run's OPRA
|
|
245
|
+
* facts (the chain decision's `auto` reads them), the chart's category, the plane verdict (`opraPlane`: a lane reading
|
|
246
|
+
* by coin there reads no chain directory) and the plan's `runScope` (its inputs share one chart resolution).
|
|
247
|
+
*
|
|
248
|
+
* A chart with no option chain (a LINK perp, a forex pair, a stock listing no options) does not serve an options feed:
|
|
249
|
+
* an input whose lane's `plan` refuses so (`wrunLaneNoChainRefusal`: the record's `no-options` / `chain`) meets the
|
|
250
|
+
* same rule as an input an index-mode chart does not serve (`wrunUnservedLaneInput`), its note naming the feed with the
|
|
251
|
+
* chain decision's words, its refusal the decision's own.
|
|
252
|
+
*
|
|
253
|
+
* An input the market leaves undemanded (its `needed_by` leaves the market out, wrunSheetWithLaneDemand) is planned
|
|
254
|
+
* nowhere, before all of the above: no wall, no admission, no `plan`, no fetch, no note; the row builder reads its
|
|
255
|
+
* fill on every bar.
|
|
256
|
+
*
|
|
257
|
+
* The predicates are injected (the run pass hands the chart's own `checkIsIndexMode` and its
|
|
258
|
+
* crypto-venue rule), so this module, which the row builder imports, stays off those modules'
|
|
259
|
+
* import graphs; without one no chart reads as index-mode, and without the other the venue is
|
|
260
|
+
* unknown (the neutral words).
|
|
261
|
+
*/
|
|
262
|
+
export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = () => false, isCryptoVenueExchange, run) {
|
|
263
|
+
const instances = new Map();
|
|
264
|
+
const missing = new Map();
|
|
265
|
+
const indexModeChart = isIndexModeExchange(chart.exchange);
|
|
266
|
+
const cryptoVenue = isCryptoVenueExchange?.(chart.exchange);
|
|
267
|
+
// The chart's category (pb-common `Category`), handed on when the chart holds one.
|
|
268
|
+
const category = typeof chart.category === 'number' ? { category: chart.category } : {};
|
|
269
|
+
// The chart's OPRA plane facts, read once (`wrunChartOpraPlane`, the row lanes' planner reads them the same way):
|
|
270
|
+
// whether its options ride the plane, and off it the known reason a chart whose options list on OPRA rides none.
|
|
271
|
+
const plane = wrunChartOpraPlane(chart.exchange, run);
|
|
272
|
+
// One object per plan: the inputs of this run share a chain lane's resolutions by it.
|
|
273
|
+
const runScope = {};
|
|
274
|
+
for (const planned of planWrunPollLaneInputs(metadata)) {
|
|
275
|
+
if (planned.source.undemanded === true)
|
|
276
|
+
continue;
|
|
277
|
+
const chainLane = planned.lane.chain !== undefined;
|
|
278
|
+
const ctx = {
|
|
279
|
+
coin: chart.coin,
|
|
280
|
+
exchange: chart.exchange,
|
|
281
|
+
symbol: chart.symbol,
|
|
282
|
+
...category,
|
|
283
|
+
intervalMs: chart.intervalMs,
|
|
284
|
+
inputName: planned.inputName,
|
|
285
|
+
sourceClass: planned.lane.sourceClass,
|
|
286
|
+
indexMode: indexModeChart,
|
|
287
|
+
cryptoVenue,
|
|
288
|
+
// The run's OPRA facts reach the plan of a lane that reads OPRA (`opra`) or may (a `chain` lane: its chain
|
|
289
|
+
// decision's `auto` reads them), the lanes the decision concerns; every other lane's context is as it always
|
|
290
|
+
// was. Absent reads closed.
|
|
291
|
+
...(run !== undefined && (planned.lane.opra === true || chainLane)
|
|
292
|
+
? { official: run.official === true, opraUserScripts: run.opraUserScripts === true }
|
|
293
|
+
: {}),
|
|
294
|
+
...(chainLane ? { runScope, opraPlane: plane.onPlane } : {}),
|
|
295
|
+
};
|
|
296
|
+
const unserved = {
|
|
297
|
+
inputName: planned.inputName,
|
|
298
|
+
sourceClass: planned.lane.sourceClass,
|
|
299
|
+
feed: planned.lane.laneKey,
|
|
300
|
+
missing: planned.source.missing,
|
|
301
|
+
};
|
|
302
|
+
// A chain lane meets the OPRA wall where the chart's options list on OPRA, and stops before its chain is resolved
|
|
303
|
+
// where a known stop keeps them off the plane (`wrunChainLaneStop`, the row lanes' one rule); any other lane is
|
|
304
|
+
// served by its own plane and the chart's mode. An input the chart does not serve meets the one rule both planners
|
|
305
|
+
// keep (`wrunUnservedLaneInput`: a declared fill drops it with a note, any other refuses by name).
|
|
306
|
+
const why = chainLane
|
|
307
|
+
? wrunChainLaneStop(plane, run, ctx)
|
|
308
|
+
: wrunPollLaneUnserved(planned.lane, plane, indexModeChart, run, ctx);
|
|
309
|
+
if (why !== undefined) {
|
|
310
|
+
wrunUnservedLaneInput(missing, unserved, WRUN_POLL_LANE_UNSERVED_FILLS, why, cryptoVenue);
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
let answered;
|
|
314
|
+
try {
|
|
315
|
+
answered = await planned.lane.plan(planned.source, ctx);
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
// A chart with no option chain does not serve the feed (`wrunLaneNoChainRefusal`): the same one rule.
|
|
319
|
+
if (!wrunLaneNoChainRefusal(error))
|
|
320
|
+
throw error;
|
|
321
|
+
wrunUnservedLaneInput(missing, unserved, WRUN_POLL_LANE_UNSERVED_FILLS, { noChain: error }, cryptoVenue);
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
const extras = {};
|
|
325
|
+
for (const [key, value] of Object.entries(answered ?? {}))
|
|
326
|
+
if (value !== undefined)
|
|
327
|
+
extras[key] = value;
|
|
328
|
+
// A chain instance meets its own plane's wall, by the exchange its chain lists on.
|
|
329
|
+
if (chainLane) {
|
|
330
|
+
assertWrunLaneChainPlaneReadable(wrunPollLaneChainPlane(planned.lane, extras), wrunPollLaneChainExchange(planned.lane, extras), run, ctx);
|
|
331
|
+
}
|
|
332
|
+
const key = wrunPollLaneInstanceKey(planned.lane.laneKey, extras);
|
|
333
|
+
let instance = instances.get(key);
|
|
334
|
+
if (instance === undefined) {
|
|
335
|
+
instance = {
|
|
336
|
+
key,
|
|
337
|
+
sourceClass: planned.lane.sourceClass,
|
|
338
|
+
laneKey: planned.lane.laneKey,
|
|
339
|
+
extras,
|
|
340
|
+
inputIndexes: [],
|
|
341
|
+
};
|
|
342
|
+
instances.set(key, instance);
|
|
343
|
+
}
|
|
344
|
+
instance.inputIndexes.push(planned.inputIndex);
|
|
345
|
+
}
|
|
346
|
+
return wrunPollLanePlanResult([...instances.values()], [...missing.values()]);
|
|
347
|
+
}
|
|
348
|
+
/** The lane instances of `planWrunPollLanes` alone (the array every caller that plans no notes
|
|
349
|
+
* reads): the same plan, the same refusals by name, an input that declared a missing fill on an
|
|
350
|
+
* index-mode chart dropped. */
|
|
351
|
+
export async function planWrunPollLaneInstances(metadata, chart, isIndexModeExchange, isCryptoVenueExchange, run) {
|
|
352
|
+
return (await planWrunPollLanes(metadata, chart, isIndexModeExchange, isCryptoVenueExchange, run)).lanes;
|
|
353
|
+
}
|
|
354
|
+
// ---------------------------------------------------------------------------
|
|
355
|
+
// A chain lane's plane per instance (`WrunPollLane.chain`, the row lanes' mark): the run's and the live tick's rule
|
|
356
|
+
// ---------------------------------------------------------------------------
|
|
357
|
+
/** The record seed of the CME display wall on a chain instance's CME chain (the display wall's own record). */
|
|
358
|
+
const WRUN_CME_WALL_SEED = Object.freeze({ cls: 'cme-wall' });
|
|
359
|
+
/**
|
|
360
|
+
* A chain instance against its own plane's wall, by the plane and the exchange its chain lists on: an OPRA chain the
|
|
361
|
+
* OPRA wall (`mayReadOpra`), a CME chain the CME display wall (OpenMarket's own packages only, the run door's rule on
|
|
362
|
+
* a CME chart, kscript-venue-policy.util; the `opra-user-scripts` flag never opens it), a crypto chain (`plain`)
|
|
363
|
+
* none. The row lanes keep the same rule (wrun-row-lanes.util), in the same words.
|
|
364
|
+
*/
|
|
365
|
+
export function assertWrunLaneChainPlaneReadable(plane, exchange, run, ctx) {
|
|
366
|
+
if (plane === 'opra')
|
|
367
|
+
assertWrunOpraLaneReadable(run, ctx);
|
|
368
|
+
if (plane === 'cme' && run?.official !== true) {
|
|
369
|
+
refuseWrunPollInput(ctx, `reads CME options data (${exchange}), which is open to OpenMarket's own Indicators only: a package you wrote ` +
|
|
370
|
+
'or added from the community cannot read it yet', WRUN_CME_WALL_SEED);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/** The exchange a chain-lane instance's chain lists on (the payload field its `chain` names); '' for any other lane
|
|
374
|
+
* or a payload naming none. */
|
|
375
|
+
export function wrunPollLaneChainExchange(lane, extras) {
|
|
376
|
+
const exchange = lane.chain === undefined ? undefined : extras[lane.chain.exchangeField];
|
|
377
|
+
return typeof exchange === 'string' ? exchange : '';
|
|
378
|
+
}
|
|
379
|
+
/** The plane a chain-lane instance reads, by its chain's exchange (`wrunLaneChainPlaneOf`, off the governed exchange
|
|
380
|
+
* sets); undefined for any other lane (its plane, if any, is its descriptor's `opra`). */
|
|
381
|
+
export function wrunPollLaneChainPlane(lane, extras) {
|
|
382
|
+
return lane.chain === undefined ? undefined : wrunLaneChainPlaneOf(wrunPollLaneChainExchange(lane, extras));
|
|
383
|
+
}
|
|
384
|
+
/** Whether one poll-lane instance reads the OPRA plane (the provenance stamp and the legend note follow it): every
|
|
385
|
+
* instance of an `opra` lane, a chain lane's whose chain lists on OPRA. */
|
|
386
|
+
export function wrunPollLaneInstanceReadsOpra(lane, extras) {
|
|
387
|
+
return lane.opra === true || wrunPollLaneChainPlane(lane, extras) === 'opra';
|
|
388
|
+
}
|
|
389
|
+
/** The governed exchange a chain-lane instance reads beside its chart's own market (the exchange its served access,
|
|
390
|
+
* and so its delayed window and its gate session, is read under): its chain's when a gate governs it (OPRA, a CME
|
|
391
|
+
* Group exchange); null for a crypto chain and for any other lane. */
|
|
392
|
+
export function wrunPollLaneChainGovernedExchange(lane, extras) {
|
|
393
|
+
const plane = wrunPollLaneChainPlane(lane, extras);
|
|
394
|
+
return plane === 'opra' || plane === 'cme' ? wrunPollLaneChainExchange(lane, extras) : null;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* A chain instance's ask (the full run's and the reconcile's, re-read on every ask): its payload with the fields its
|
|
398
|
+
* plane names beside it. An OPRA chain names the plane and its routed tier (`wrunOpraLanePayloadFields`: Door C judges
|
|
399
|
+
* it an OPRA ask, the legend names a delayed tier); a CME chain its routed tier alone (`servedTier`, so no source cache
|
|
400
|
+
* serves one tier's rows to the other; the chart's own badge names the delay); a crypto chain nothing. Any other
|
|
401
|
+
* lane's payload as it is. `tierOf` is the routing's rule (governed-route.util `governedMarketDataTier`), handed in so
|
|
402
|
+
* this module stays off the routing graph, and asked only for a governed exchange: it answers delayed for any
|
|
403
|
+
* exchange no gate governs.
|
|
404
|
+
*/
|
|
405
|
+
export function wrunPollLaneChainAsk(lane, extras, tierOf) {
|
|
406
|
+
const plane = wrunPollLaneChainPlane(lane, extras);
|
|
407
|
+
if (plane !== 'opra' && plane !== 'cme')
|
|
408
|
+
return extras;
|
|
409
|
+
const servedTier = tierOf(wrunPollLaneChainExchange(lane, extras));
|
|
410
|
+
return plane === 'opra' ? { ...extras, ...wrunOpraLanePayloadFields(servedTier) } : { ...extras, servedTier };
|
|
411
|
+
}
|
|
412
|
+
/** The first poll-lane instance of a session whose acquisition moved since the run planned it (its lane's
|
|
413
|
+
* `acquisitionMoved` over the run's record of it, else over the instance's payload), or undefined: the live tick
|
|
414
|
+
* rebuilds the session then, as for a row lane's (wrun-row-lanes.util `wrunRowLaneMovedInstance`). */
|
|
415
|
+
export function wrunPollLaneMovedInstance(instances, acquisition) {
|
|
416
|
+
for (const instance of instances ?? []) {
|
|
417
|
+
const moved = wrunPollLaneByKey(instance.laneKey)?.acquisitionMoved;
|
|
418
|
+
if (moved !== undefined && moved(acquisition[instance.key] ?? instance.extras))
|
|
419
|
+
return instance.key;
|
|
420
|
+
}
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Whether a lane must answer rows for the package: true when any input reading it (`reads`)
|
|
425
|
+
* rides the default carry policy (an absent series has nothing to carry, so an empty lane
|
|
426
|
+
* refuses loud); when every such input declares `missing: "nan"` or `"zero"` the lane stays
|
|
427
|
+
* quiet and the inputs read that fill. The funding lane's rule, for any lane.
|
|
428
|
+
*/
|
|
429
|
+
export function wrunLaneRowsRequired(metadata, reads) {
|
|
430
|
+
return metadata.inputs.some((input) => {
|
|
431
|
+
const source = metadata.inputSources[input.name];
|
|
432
|
+
if (!source || !reads(input, source))
|
|
433
|
+
return false;
|
|
434
|
+
return source.missing === undefined || source.missing === 'carry';
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
/** `wrunLaneRowsRequired` for one registry lane instance (the inputs it serves). */
|
|
438
|
+
export function wrunPollLaneRequired(metadata, instance) {
|
|
439
|
+
return wrunLaneRowsRequired(metadata, (input) => instance.inputIndexes.includes(input.index));
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* The first input of a lane instance, in declaration order, that rides the default carry policy
|
|
443
|
+
* and whose column holds NO finite value anywhere in the lane's answer (`rows`: the full answer,
|
|
444
|
+
* a daily lane's lookback included, so a series printed once before the chart window passes);
|
|
445
|
+
* undefined when every such input has one. A `null` cell is no value, never 0 (the controls lay
|
|
446
|
+
* `null` where the gateway has none), and a 0 is a value.
|
|
447
|
+
*
|
|
448
|
+
* The empty-answer rule (`wrunPollLaneRequired`) counts rows; this is the same rule per field. A
|
|
449
|
+
* lane can answer a row for every bar and no value for one field (Bitfinex publishes the margin
|
|
450
|
+
* rate for `fUSD` and `fETH`, not `fBTC`; a token's supply row leaves a field the gateway does
|
|
451
|
+
* not hold for it unset): under `carry` the input would read NaN on every bar with no message.
|
|
452
|
+
* An input declaring `missing: "nan"` or `"zero"` has said what an absent value reads as and
|
|
453
|
+
* stays quiet.
|
|
454
|
+
*/
|
|
455
|
+
export function wrunPollLaneValuelessInput(metadata, instance, lane, rows) {
|
|
456
|
+
if (rows.length === 0)
|
|
457
|
+
return undefined;
|
|
458
|
+
const valued = new Map();
|
|
459
|
+
const columnHasValue = (column) => {
|
|
460
|
+
let has = valued.get(column);
|
|
461
|
+
if (has === undefined) {
|
|
462
|
+
has = rows.some((row) => {
|
|
463
|
+
const cell = row[column];
|
|
464
|
+
return cell !== null && cell !== undefined && Number.isFinite(Number(cell));
|
|
465
|
+
});
|
|
466
|
+
valued.set(column, has);
|
|
467
|
+
}
|
|
468
|
+
return has;
|
|
469
|
+
};
|
|
470
|
+
const inputs = [...metadata.inputs].sort((a, b) => a.index - b.index);
|
|
471
|
+
for (const input of inputs) {
|
|
472
|
+
if (!instance.inputIndexes.includes(input.index))
|
|
473
|
+
continue;
|
|
474
|
+
const source = metadata.inputSources[input.name];
|
|
475
|
+
if (!source || (source.missing !== undefined && source.missing !== 'carry'))
|
|
476
|
+
continue;
|
|
477
|
+
const field = source.field ?? '';
|
|
478
|
+
if (!Object.prototype.hasOwnProperty.call(lane.fields, field))
|
|
479
|
+
continue;
|
|
480
|
+
if (!columnHasValue(lane.fields[field]))
|
|
481
|
+
return { inputName: input.name, field };
|
|
482
|
+
}
|
|
483
|
+
return undefined;
|
|
484
|
+
}
|
|
485
|
+
/** The interval a lane's asks name (the fetch's `interval` option): its fixed one, `1d` for a
|
|
486
|
+
* daily join that names none, undefined for the chart's own. */
|
|
487
|
+
export function wrunPollLaneFetchInterval(lane) {
|
|
488
|
+
if (lane.interval !== undefined)
|
|
489
|
+
return lane.interval;
|
|
490
|
+
return lane.join === 'bar' ? undefined : WRUN_DAILY_LANE_INTERVAL_KEY;
|
|
491
|
+
}
|
|
492
|
+
/** The fetch options a lane's asks carry (the full run's and the reconcile's alike): its
|
|
493
|
+
* interval (`wrunPollLaneFetchInterval`) and, for a `global` or a `nativeRows` lane, the native-rows
|
|
494
|
+
* path (the asked window stands and the control's own rows return on an index-mode chart too).
|
|
495
|
+
* Undefined when the ask carries neither (the chart's own interval, the chart's own market). */
|
|
496
|
+
export function wrunPollLaneFetchOptions(lane) {
|
|
497
|
+
const interval = wrunPollLaneFetchInterval(lane);
|
|
498
|
+
const options = {};
|
|
499
|
+
if (interval !== undefined)
|
|
500
|
+
options.interval = interval;
|
|
501
|
+
if (wrunPollLaneServedOnIndexMode(lane))
|
|
502
|
+
options.nativeRows = true;
|
|
503
|
+
return Object.keys(options).length === 0 ? undefined : options;
|
|
504
|
+
}
|
|
505
|
+
/** Where the full run's ask opens for a chart window opening at `fromTs`: there for a `bar`
|
|
506
|
+
* join, at the first row's day (its `lookbackDays` earlier) for a daily one. */
|
|
507
|
+
export function wrunPollLaneFetchFrom(lane, fromTs) {
|
|
508
|
+
return lane.join === 'bar' ? fromTs : wrunDailyLaneFetchFrom(fromTs, lane.join.lookbackDays);
|
|
509
|
+
}
|
|
510
|
+
/** Where the full run's ask closes for a chart whose last bar opens at `lastBarTs` on a grid of
|
|
511
|
+
* `intervalMs`: at that open for a `bar` join, at that bar's END for a host-grid one (`barGrid`: its
|
|
512
|
+
* rows are a tier's buckets, the forming bar's included); for a daily one at that open on an intraday or
|
|
513
|
+
* daily chart and at the bar's END on a coarser one (`wrunDailyLaneFetchTo`: the forming week
|
|
514
|
+
* or month holds days after its open). */
|
|
515
|
+
export function wrunPollLaneFetchTo(lane, lastBarTs, intervalMs, nowMs) {
|
|
516
|
+
if (lane.join !== 'bar')
|
|
517
|
+
return wrunDailyLaneFetchTo(lastBarTs, intervalMs, nowMs);
|
|
518
|
+
return lane.barGrid !== undefined ? wrunHostGridFetchTo(lastBarTs, intervalMs) : lastBarTs;
|
|
519
|
+
}
|
|
520
|
+
/** Where a reconcile's ask closes for a chart-bar window closing at `toTs`: there for a `bar`
|
|
521
|
+
* join; for a daily one the day after the clock's day when the window closed before it on a
|
|
522
|
+
* chart coarser than a day (`wrunDailyLaneReconcileTo`, the forming bar of a session grid). */
|
|
523
|
+
export function wrunPollLaneReconcileTo(lane, toTs, intervalMs, nowMs) {
|
|
524
|
+
return lane.join === 'bar' ? toTs : wrunDailyLaneReconcileTo(toTs, intervalMs, nowMs);
|
|
525
|
+
}
|
|
526
|
+
/** Where a reconcile's ask (and its answer's authority) opens for the chart-bar window opening
|
|
527
|
+
* at `fromTs`, in a session whose first row is `sessionFirstRowTs`: at `fromTs` for a `bar`
|
|
528
|
+
* join; for a daily one where the full run's ask would open for that window (its day, the
|
|
529
|
+
* lane's `lookbackDays` earlier), never before the session's own full run opened
|
|
530
|
+
* (`wrunDailyLaneReconcileFrom`). A daily row is often published after its stamp date (a daily
|
|
531
|
+
* rate the next business day, a monthly series weeks later), so the lane's lookback is the
|
|
532
|
+
* publication-lag horizon: a reconcile that opened at the window's own day never fetched such
|
|
533
|
+
* a row, and the live tail kept a value a fresh full run no longer showed. */
|
|
534
|
+
export function wrunPollLaneReconcileFrom(lane, fromTs, sessionFirstRowTs) {
|
|
535
|
+
if (lane.join === 'bar')
|
|
536
|
+
return fromTs;
|
|
537
|
+
return wrunDailyLaneReconcileFrom(fromTs, sessionFirstRowTs, lane.join.lookbackDays);
|
|
538
|
+
}
|
|
539
|
+
/** The payload field a host-grid lane's ask names its backend tier in (`WrunPollLaneBarGrid.tiers`, a tier's
|
|
540
|
+
* `key`): the K control asks that tier. */
|
|
541
|
+
export const WRUN_POLL_LANE_TIER_FIELD = 'tier';
|
|
542
|
+
/**
|
|
543
|
+
* A lane's rows over a chart window, landed on the host bars when it is a host-grid lane (`barGrid`): its asks
|
|
544
|
+
* under the tier rule (`wrunHostGridAsks` over the window's host bars: one per run of bars on a tier, the
|
|
545
|
+
* tier's key in its extras as `tier`), each answer landed by the lane's landing (`wrunLandScalarRowsOnHostBars`:
|
|
546
|
+
* a flow summed per bar, a snapshot's newest sealed row, sealed by its ask's tier), ascending. A bar no tier
|
|
547
|
+
* retains asks nothing and reads no row. Any other lane is asked once over `[fromTs, toTs]` (`fallback`), its
|
|
548
|
+
* rows as they come. `ask` is the caller's fetch (the full run's, a reconcile's).
|
|
549
|
+
*/
|
|
550
|
+
export async function fetchWrunPollLaneHostGridRows(lane, extras, window, fallback, ask) {
|
|
551
|
+
const grid = lane.barGrid;
|
|
552
|
+
if (grid === undefined)
|
|
553
|
+
return ask(extras, fallback.fromTs, fallback.toTs);
|
|
554
|
+
const { asks } = wrunHostGridAsks({
|
|
555
|
+
tiers: grid.tiers,
|
|
556
|
+
barOpens: window.barOpens,
|
|
557
|
+
intervalMs: window.intervalMs,
|
|
558
|
+
nowMs: window.nowMs,
|
|
559
|
+
});
|
|
560
|
+
const answers = await Promise.all(asks.map(async (gridAsk) => {
|
|
561
|
+
const askExtras = gridAsk.tier === undefined ? extras : { ...extras, [WRUN_POLL_LANE_TIER_FIELD]: gridAsk.tier.key };
|
|
562
|
+
const rows = await ask(askExtras, gridAsk.fromMs, gridAsk.toMs);
|
|
563
|
+
return wrunLandScalarRowsOnHostBars(rows, grid.landing, {
|
|
564
|
+
intervalMs: window.intervalMs,
|
|
565
|
+
barGrid: window.barGrid,
|
|
566
|
+
tierMs: gridAsk.tier?.ms,
|
|
567
|
+
nowMs: window.nowMs,
|
|
568
|
+
});
|
|
569
|
+
}));
|
|
570
|
+
const byBar = new Map();
|
|
571
|
+
for (const landed of answers) {
|
|
572
|
+
for (const row of landed)
|
|
573
|
+
byBar.set(Number(row[0]), row);
|
|
574
|
+
}
|
|
575
|
+
return [...byBar.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
|
|
576
|
+
}
|