@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,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The poll-lane registry of the browser lane: every `WrunPollLane` descriptor under
|
|
3
|
+
* `./lanes/`, listed by the generated index `./lanes/index.ts` (`WRUN_POLL_LANE_MODULES`,
|
|
4
|
+
* written by `node scripts/wrun-lane-index.mjs`, which lists every lane file of the folder), so
|
|
5
|
+
* no hand-kept list names a lane and no bundler glob is needed: the index is plain imports, so it
|
|
6
|
+
* holds in the app bundle, a worker bundle, the vitest node project and the chart-host package.
|
|
7
|
+
*
|
|
8
|
+
* The contract a lane file keeps is in `wrun-poll-lane.types.ts`. Checked here, once, when the
|
|
9
|
+
* module loads (a wrong descriptor fails every spec that reaches the registry, never a chart):
|
|
10
|
+
* - a file `lanes/<source_class>.ts` exports `lane` and/or `lanes`, every one declaring that
|
|
11
|
+
* class (`wrunPollLaneClassOfFile`: the template extractor lists the folder by file name);
|
|
12
|
+
* the folder holds lane files and their generated index only (`--check` fails a stale index);
|
|
13
|
+
* - `laneKey` is unique, lower snake case; a field of a class belongs to one lane; columns are
|
|
14
|
+
* positive integers; a fixed `interval` is one the chart's fetch knows;
|
|
15
|
+
* - a lane never serves a class the row builder serves itself, nor one a row lane serves, and holds
|
|
16
|
+
* no row lane's key (`row-lane-registry.ts`; this registry binds itself as that one's peer, so
|
|
17
|
+
* each refuses a clash with the other);
|
|
18
|
+
* - a `global` lane (served on index-mode charts too) joins daily;
|
|
19
|
+
* - a `nativeRows` lane (a series of the chart's own market read from another plane, served on index-mode
|
|
20
|
+
* charts too) is no `global` one and rides no own fetch; per bar it declares its host-grid landing (`barGrid`: a
|
|
21
|
+
* flow or a snapshot, its backend tiers each a positive width and retention), daily it keeps the daily landing
|
|
22
|
+
* (by UTC day, no `barGrid`);
|
|
23
|
+
* - `opra` is true or absent.
|
|
24
|
+
*
|
|
25
|
+
* The consumers read the lookups below at call time, so the one test hook
|
|
26
|
+
* (`__setWrunPollLanesForTest`) swaps the whole registry for a spec.
|
|
27
|
+
*/
|
|
28
|
+
// First: the lane modules evaluate before this module's other imports, the order the bundler glob gave them.
|
|
29
|
+
import { WRUN_POLL_LANE_MODULES } from './lanes/index.js';
|
|
30
|
+
import { Intervals } from '../../../constants/interval.constants.js';
|
|
31
|
+
import { WRUN_BROWSER_BUILTIN_SOURCE_CLASSES, wrunPollLaneClassOfFile } from '../wrun-browser-sources.leaf.js';
|
|
32
|
+
import { assertWrunHostGridLanding } from './host-grid-landing.js';
|
|
33
|
+
import { bindWrunRowLanePollPeers, wrunRowLaneByKey, wrunRowLaneOfClass } from './row-lane-registry.js';
|
|
34
|
+
const WRUN_POLL_LANE_KEY_RE = /^[a-z][a-z0-9_]*$/;
|
|
35
|
+
/** Refuse a malformed descriptor set by name (a programming error, never a user's). */
|
|
36
|
+
function assertWrunPollLanes(lanes) {
|
|
37
|
+
const keys = new Set();
|
|
38
|
+
const fieldOwners = new Map();
|
|
39
|
+
for (const lane of lanes) {
|
|
40
|
+
const who = `wrun poll lane '${String(lane?.laneKey)}'`;
|
|
41
|
+
if (typeof lane?.laneKey !== 'string' || !WRUN_POLL_LANE_KEY_RE.test(lane.laneKey)) {
|
|
42
|
+
throw new Error(`${who}: laneKey must be lower snake case (letters, digits, underscores)`);
|
|
43
|
+
}
|
|
44
|
+
if (keys.has(lane.laneKey))
|
|
45
|
+
throw new Error(`${who}: laneKey is declared twice`);
|
|
46
|
+
keys.add(lane.laneKey);
|
|
47
|
+
if (typeof lane.sourceClass !== 'string' || lane.sourceClass === '') {
|
|
48
|
+
throw new Error(`${who}: sourceClass is required`);
|
|
49
|
+
}
|
|
50
|
+
if (WRUN_BROWSER_BUILTIN_SOURCE_CLASSES.includes(lane.sourceClass)) {
|
|
51
|
+
throw new Error(`${who}: source class '${lane.sourceClass}' is served by the row builder itself`);
|
|
52
|
+
}
|
|
53
|
+
if (wrunRowLaneOfClass(lane.sourceClass) !== undefined) {
|
|
54
|
+
throw new Error(`${who}: source class '${lane.sourceClass}' is served by a row lane`);
|
|
55
|
+
}
|
|
56
|
+
if (wrunRowLaneByKey(lane.laneKey) !== undefined) {
|
|
57
|
+
throw new Error(`${who}: laneKey is declared twice (row and poll lanes share keys)`);
|
|
58
|
+
}
|
|
59
|
+
if (typeof lane.kType !== 'string' || lane.kType === '')
|
|
60
|
+
throw new Error(`${who}: kType is required`);
|
|
61
|
+
if (typeof lane.label !== 'string' || lane.label === '')
|
|
62
|
+
throw new Error(`${who}: label is required`);
|
|
63
|
+
if (typeof lane.plan !== 'function')
|
|
64
|
+
throw new Error(`${who}: plan is required`);
|
|
65
|
+
const fields = Object.entries(lane.fields ?? {});
|
|
66
|
+
if (fields.length === 0)
|
|
67
|
+
throw new Error(`${who}: at least one field is required`);
|
|
68
|
+
for (const [field, column] of fields) {
|
|
69
|
+
if (!Number.isInteger(column) || column < 1) {
|
|
70
|
+
throw new Error(`${who}: field '${field}' needs a lane row column of 1 or more (column 0 is the ts)`);
|
|
71
|
+
}
|
|
72
|
+
const owner = fieldOwners.get(`${lane.sourceClass}.${field}`);
|
|
73
|
+
if (owner !== undefined) {
|
|
74
|
+
throw new Error(`${who}: field '${lane.sourceClass}.${field}' is already served by lane '${owner}'`);
|
|
75
|
+
}
|
|
76
|
+
fieldOwners.set(`${lane.sourceClass}.${field}`, lane.laneKey);
|
|
77
|
+
}
|
|
78
|
+
if (lane.join !== 'bar') {
|
|
79
|
+
const join = lane.join;
|
|
80
|
+
if (join?.kind !== 'daily' || (join.landing !== 'sum' && join.landing !== 'last')) {
|
|
81
|
+
throw new Error(`${who}: join must be 'bar' or { kind: 'daily', landing: 'sum' | 'last' }`);
|
|
82
|
+
}
|
|
83
|
+
if (join.lookbackDays !== undefined &&
|
|
84
|
+
!(typeof join.lookbackDays === 'number' && Number.isFinite(join.lookbackDays) && join.lookbackDays >= 0)) {
|
|
85
|
+
throw new Error(`${who}: lookbackDays must be a number of days, 0 or more`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (lane.interval !== undefined && Intervals.map_unit[lane.interval] === undefined) {
|
|
89
|
+
throw new Error(`${who}: interval '${String(lane.interval)}' is not a chart interval`);
|
|
90
|
+
}
|
|
91
|
+
if (lane.global !== undefined && lane.global !== true) {
|
|
92
|
+
throw new Error(`${who}: global is true or absent`);
|
|
93
|
+
}
|
|
94
|
+
if (lane.global === true && lane.join === 'bar') {
|
|
95
|
+
throw new Error(`${who}: a global lane joins daily (its rows land by UTC day on any chart grid, a session chart's included)`);
|
|
96
|
+
}
|
|
97
|
+
assertWrunPollLaneHostGrid(who, lane);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** The per-bar native-rows rules of one lane (`nativeRows`, `barGrid`) and its `opra` mark. */
|
|
101
|
+
function assertWrunPollLaneHostGrid(who, lane) {
|
|
102
|
+
if (lane.opra !== undefined && lane.opra !== true)
|
|
103
|
+
throw new Error(`${who}: opra is true or absent`);
|
|
104
|
+
if (lane.nativeRows !== undefined && lane.nativeRows !== true) {
|
|
105
|
+
throw new Error(`${who}: nativeRows is true or absent`);
|
|
106
|
+
}
|
|
107
|
+
if (lane.nativeRows === true) {
|
|
108
|
+
if (lane.global === true) {
|
|
109
|
+
throw new Error(`${who}: a global lane rides the native-rows path already (nativeRows names its own market)`);
|
|
110
|
+
}
|
|
111
|
+
if (lane.fetch !== undefined)
|
|
112
|
+
throw new Error(`${who}: a lane with its own fetch rides no native-rows path`);
|
|
113
|
+
// A per-bar lane lands itself on the host bar grid; a daily one keeps the daily rule (by UTC day, any grid).
|
|
114
|
+
if (lane.join === 'bar' && lane.barGrid === undefined) {
|
|
115
|
+
throw new Error(`${who}: a per-bar nativeRows lane declares barGrid (its rows land on the host bar grid)`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (lane.barGrid === undefined)
|
|
119
|
+
return;
|
|
120
|
+
if (lane.nativeRows !== true)
|
|
121
|
+
throw new Error(`${who}: barGrid lands a nativeRows lane's rows (declare nativeRows)`);
|
|
122
|
+
if (lane.join !== 'bar') {
|
|
123
|
+
throw new Error(`${who}: barGrid lands a per-bar lane's rows (a daily lane lands by UTC day, the daily rule)`);
|
|
124
|
+
}
|
|
125
|
+
assertWrunHostGridLanding(who, lane.barGrid);
|
|
126
|
+
}
|
|
127
|
+
/** The lanes of the listed modules (index key `./lanes/<file>.ts` -> module), in file order, each
|
|
128
|
+
* file checked against its name and the whole set against the registry's rules. Exported for the spec. */
|
|
129
|
+
export function wrunPollLanesOfModules(modules) {
|
|
130
|
+
const lanes = [];
|
|
131
|
+
for (const path of Object.keys(modules).sort()) {
|
|
132
|
+
const fileClass = wrunPollLaneClassOfFile(path);
|
|
133
|
+
const exported = [...(modules[path].lane ? [modules[path].lane] : []), ...(modules[path].lanes ?? [])];
|
|
134
|
+
if (fileClass === undefined || exported.length === 0) {
|
|
135
|
+
throw new Error(`wrun poll lane file '${path}': a lane file is named after its source class (<source_class>.ts) and exports 'lane' or 'lanes'`);
|
|
136
|
+
}
|
|
137
|
+
for (const lane of exported) {
|
|
138
|
+
if (lane.sourceClass !== fileClass) {
|
|
139
|
+
throw new Error(`wrun poll lane file '${path}' declares source class '${String(lane.sourceClass)}': a lane file is named after the class its lanes serve (${String(lane.sourceClass)}.ts)`);
|
|
140
|
+
}
|
|
141
|
+
lanes.push(lane);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
assertWrunPollLanes(lanes);
|
|
145
|
+
return lanes;
|
|
146
|
+
}
|
|
147
|
+
function indexWrunPollLanes(lanes) {
|
|
148
|
+
const byKey = new Map();
|
|
149
|
+
const byClass = new Map();
|
|
150
|
+
for (const lane of lanes) {
|
|
151
|
+
byKey.set(lane.laneKey, lane);
|
|
152
|
+
const ofClass = byClass.get(lane.sourceClass);
|
|
153
|
+
if (ofClass === undefined)
|
|
154
|
+
byClass.set(lane.sourceClass, [lane]);
|
|
155
|
+
else
|
|
156
|
+
ofClass.push(lane);
|
|
157
|
+
}
|
|
158
|
+
return { lanes, byKey, byClass };
|
|
159
|
+
}
|
|
160
|
+
const DISCOVERED_LANES = wrunPollLanesOfModules(WRUN_POLL_LANE_MODULES);
|
|
161
|
+
let registry = indexWrunPollLanes(DISCOVERED_LANES);
|
|
162
|
+
// The row-lane registry's peer view: it refuses a row lane on a class or a key these lanes hold, read at call time
|
|
163
|
+
// (this registry's spec hook swaps them).
|
|
164
|
+
bindWrunRowLanePollPeers(() => ({
|
|
165
|
+
classes: [...registry.byClass.keys()],
|
|
166
|
+
keys: registry.lanes.map((lane) => lane.laneKey),
|
|
167
|
+
}));
|
|
168
|
+
const NO_LANES = Object.freeze([]);
|
|
169
|
+
/** Every registered lane, in file order. */
|
|
170
|
+
export function wrunPollLanes() {
|
|
171
|
+
return registry.lanes;
|
|
172
|
+
}
|
|
173
|
+
export function wrunPollLaneByKey(laneKey) {
|
|
174
|
+
return registry.byKey.get(laneKey);
|
|
175
|
+
}
|
|
176
|
+
/** The lanes serving a source class (several when its fields ride different K controls). */
|
|
177
|
+
export function wrunPollLanesOfClass(sourceClass) {
|
|
178
|
+
return typeof sourceClass === 'string' ? (registry.byClass.get(sourceClass) ?? NO_LANES) : NO_LANES;
|
|
179
|
+
}
|
|
180
|
+
/** The source classes the registry serves, once each, in file order. */
|
|
181
|
+
export function wrunPollLaneClasses() {
|
|
182
|
+
return [...registry.byClass.keys()];
|
|
183
|
+
}
|
|
184
|
+
/** The classes served on every chart, index-mode ones included (`global` lanes), once each, in
|
|
185
|
+
* file order. */
|
|
186
|
+
export function wrunPollLaneGlobalClasses() {
|
|
187
|
+
const classes = [];
|
|
188
|
+
for (const lane of registry.lanes) {
|
|
189
|
+
if (lane.global === true && !classes.includes(lane.sourceClass))
|
|
190
|
+
classes.push(lane.sourceClass);
|
|
191
|
+
}
|
|
192
|
+
return classes;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Spec hook: replace the registry with `lanes` (checked like discovered ones, minus the file
|
|
196
|
+
* name rule), or restore the discovered lanes with `null`. Every consumer reads the registry at
|
|
197
|
+
* call time, so a spec injects a lane, exercises the real run pass, row builder and tick, and
|
|
198
|
+
* restores in its teardown.
|
|
199
|
+
*/
|
|
200
|
+
export function __setWrunPollLanesForTest(lanes) {
|
|
201
|
+
if (lanes === null) {
|
|
202
|
+
registry = indexWrunPollLanes(DISCOVERED_LANES);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
assertWrunPollLanes(lanes);
|
|
206
|
+
registry = indexWrunPollLanes([...lanes]);
|
|
207
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { WrunRowLaneDescriptor, WrunRowLaneModule } from './wrun-row-lane.types.js';
|
|
2
|
+
/** The poll lanes' classes and keys, as the poll-lane registry binds them (none until it loads). */
|
|
3
|
+
type WrunRowLanePollPeers = () => {
|
|
4
|
+
classes: readonly string[];
|
|
5
|
+
keys: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
/** The poll-lane registry's binding, at its load: the lanes a row lane must not share a class or a key with. */
|
|
8
|
+
export declare function bindWrunRowLanePollPeers(peers: WrunRowLanePollPeers): void;
|
|
9
|
+
/** The lanes of the listed modules (index key `./row-lanes/<file>.ts` -> module), in file order, each file checked
|
|
10
|
+
* against its name and the whole set against the registry's rules. Exported for the spec. */
|
|
11
|
+
export declare function wrunRowLanesOfModules(modules: Readonly<Record<string, WrunRowLaneModule>>): WrunRowLaneDescriptor[];
|
|
12
|
+
/** Every registered row lane, in file order. */
|
|
13
|
+
export declare function wrunRowLanes(): readonly WrunRowLaneDescriptor[];
|
|
14
|
+
export declare function wrunRowLaneByKey(laneKey: unknown): WrunRowLaneDescriptor | undefined;
|
|
15
|
+
/** The row lane serving a source class, if one does. */
|
|
16
|
+
export declare function wrunRowLaneOfClass(sourceClass: unknown): WrunRowLaneDescriptor | undefined;
|
|
17
|
+
/** The source classes the row lanes serve, in file order. */
|
|
18
|
+
export declare function wrunRowLaneClasses(): string[];
|
|
19
|
+
/** Each row lane's tuple width by class (the packer counts `max_cells` in these tuples). */
|
|
20
|
+
export declare function wrunRowLaneWidths(): Readonly<Record<string, number>>;
|
|
21
|
+
/**
|
|
22
|
+
* Spec hook: replace the registry with `lanes` (checked like discovered ones against the poll lanes registered
|
|
23
|
+
* now, minus the file name rule), or restore the discovered lanes with `null`. Every consumer reads the registry
|
|
24
|
+
* at call time, so a spec injects a lane, exercises the real run pass, row builder and tick, and restores in its
|
|
25
|
+
* teardown.
|
|
26
|
+
*/
|
|
27
|
+
export declare function __setWrunRowLanesForTest(lanes: readonly WrunRowLaneDescriptor[] | null): void;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The row-lane registry of the browser lane: every `WrunRowLaneDescriptor` under `./row-lanes/`, listed by the
|
|
3
|
+
* generated index `./row-lanes/index.ts` (`WRUN_ROW_LANE_MODULES`, written by `node scripts/wrun-lane-index.mjs`; the
|
|
4
|
+
* poll-lane registry's pattern, `registry.ts`), so no hand-kept list names a lane and no bundler glob is needed. The
|
|
5
|
+
* contract a lane file keeps is in `wrun-row-lane.types.ts`. Checked here, once, when the module
|
|
6
|
+
* loads (a wrong descriptor fails every spec that reaches the registry, never a chart):
|
|
7
|
+
* - a file `row-lanes/<source_class>.ts` exports `rowLane` and/or `rowLanes`, each declaring that class;
|
|
8
|
+
* - one lane per class (a celled class's tuple is one shape); the class is no row-builder class and no poll-lane
|
|
9
|
+
* class; `laneKey` is lower snake case and unique across both registries;
|
|
10
|
+
* - `width` is a positive whole number; `landing` is a flow or a snapshot (its tiers each a key, a positive
|
|
11
|
+
* width, a positive retention or none and a positive served lag or none, `assertWrunHostGridLanding`; a
|
|
12
|
+
* `tierChoice` of `coarsest` only on a flow with tiers and a fold; `coarserWhenEmpty` only on a snapshot with
|
|
13
|
+
* tiers) or `latest` (no tiers, no tier choice, no fold);
|
|
14
|
+
* - `governed` is `opra` or absent; `emptyAnswer` is `quiet`, `degrades` or absent; `acquisitions` is `one` or
|
|
15
|
+
* absent; a `liveByCoin` lane names its script source and its stamp and fold functions, and is no `latest` one;
|
|
16
|
+
* a `rowBudget` names a whole row cap and a projection, on a flow or snapshot that carries a present mask;
|
|
17
|
+
* - a `chain` lane names its exchange field, resolves its chain in its identity or facets, and declares no
|
|
18
|
+
* `governed`, no `offPlane` and no `liveByCoin` (its plane is each instance's).
|
|
19
|
+
*
|
|
20
|
+
* The consumers read the lookups below at call time, so the one test hook (`__setWrunRowLanesForTest`) swaps the
|
|
21
|
+
* whole registry for a spec. The folder ships EMPTY of lanes until a class lands (UW-PARITY units U10b, U11).
|
|
22
|
+
*
|
|
23
|
+
* LIGHT on purpose: it never imports the poll-lane registry (whose index loads every poll lane's file), so a module
|
|
24
|
+
* reading row lanes (the requirement table, the packer) loads no poll lane. The poll-lane registry binds itself as
|
|
25
|
+
* this one's peer when it loads (`bindWrunRowLanePollPeers`), and each refuses a class or a key the other holds.
|
|
26
|
+
*/
|
|
27
|
+
// First: the row lane modules evaluate before this module's other imports, the order the bundler glob gave them.
|
|
28
|
+
import { WRUN_ROW_LANE_MODULES } from './row-lanes/index.js';
|
|
29
|
+
import { assertWrunHostGridLanding } from './host-grid-landing.js';
|
|
30
|
+
import { WRUN_BROWSER_BUILTIN_SOURCE_CLASSES, wrunPollLaneClassOfFile } from '../wrun-browser-sources.leaf.js';
|
|
31
|
+
import { registerWrunRefusalFeedKeys } from '../wrun-refusal.util.js';
|
|
32
|
+
import { registerWrunRowLaneTupleWidths } from '../wrun-pack.util.js';
|
|
33
|
+
const WRUN_ROW_LANE_KEY_RE = /^[a-z][a-z0-9_]*$/;
|
|
34
|
+
let pollPeers = () => ({ classes: [], keys: [] });
|
|
35
|
+
/** The poll-lane registry's binding, at its load: the lanes a row lane must not share a class or a key with. */
|
|
36
|
+
export function bindWrunRowLanePollPeers(peers) {
|
|
37
|
+
pollPeers = peers;
|
|
38
|
+
}
|
|
39
|
+
function isFunctionOrAbsent(value) {
|
|
40
|
+
return value === undefined || typeof value === 'function';
|
|
41
|
+
}
|
|
42
|
+
function nonEmptyText(value) {
|
|
43
|
+
return typeof value === 'string' && value !== '';
|
|
44
|
+
}
|
|
45
|
+
/** A chain lane's rules (`chain`): it names the payload field its chain's exchange rides in, resolves that chain in
|
|
46
|
+
* its identity or facets, and keeps no per-descriptor plane (`governed`, `offPlane`) and no live channel by coin
|
|
47
|
+
* (one plane's channel). */
|
|
48
|
+
function assertWrunRowChainLane(who, lane) {
|
|
49
|
+
const chain = lane.chain;
|
|
50
|
+
if (chain === undefined)
|
|
51
|
+
return;
|
|
52
|
+
if (chain === null || typeof chain !== 'object' || !nonEmptyText(chain.exchangeField)) {
|
|
53
|
+
throw new Error(`${who}: chain is { exchangeField: the payload field its chain's exchange rides in } or absent`);
|
|
54
|
+
}
|
|
55
|
+
if (lane.governed !== undefined || lane.offPlane !== undefined) {
|
|
56
|
+
throw new Error(`${who}: a chain lane's plane is each instance's: no governed, no offPlane`);
|
|
57
|
+
}
|
|
58
|
+
if (lane.identity === undefined && lane.facets === undefined) {
|
|
59
|
+
throw new Error(`${who}: a chain lane resolves its chain in its identity or facets`);
|
|
60
|
+
}
|
|
61
|
+
if (lane.liveByCoin !== undefined)
|
|
62
|
+
throw new Error(`${who}: a chain lane is polled, never fed live by coin`);
|
|
63
|
+
}
|
|
64
|
+
/** Refuse a malformed descriptor set by name (a programming error, never a user's). */
|
|
65
|
+
function assertWrunRowLanes(lanes) {
|
|
66
|
+
const peers = pollPeers();
|
|
67
|
+
const keys = new Set(peers.keys);
|
|
68
|
+
const pollClasses = new Set(peers.classes);
|
|
69
|
+
const classes = new Set();
|
|
70
|
+
for (const lane of lanes) {
|
|
71
|
+
const who = `wrun row lane '${String(lane?.laneKey)}'`;
|
|
72
|
+
if (typeof lane?.laneKey !== 'string' || !WRUN_ROW_LANE_KEY_RE.test(lane.laneKey)) {
|
|
73
|
+
throw new Error(`${who}: laneKey must be lower snake case (letters, digits, underscores)`);
|
|
74
|
+
}
|
|
75
|
+
if (keys.has(lane.laneKey))
|
|
76
|
+
throw new Error(`${who}: laneKey is declared twice (row and poll lanes share keys)`);
|
|
77
|
+
keys.add(lane.laneKey);
|
|
78
|
+
if (!nonEmptyText(lane.sourceClass))
|
|
79
|
+
throw new Error(`${who}: sourceClass is required`);
|
|
80
|
+
if (WRUN_BROWSER_BUILTIN_SOURCE_CLASSES.includes(lane.sourceClass)) {
|
|
81
|
+
throw new Error(`${who}: source class '${lane.sourceClass}' is served by the row builder itself`);
|
|
82
|
+
}
|
|
83
|
+
if (pollClasses.has(lane.sourceClass)) {
|
|
84
|
+
throw new Error(`${who}: source class '${lane.sourceClass}' is served by a poll lane`);
|
|
85
|
+
}
|
|
86
|
+
if (classes.has(lane.sourceClass)) {
|
|
87
|
+
throw new Error(`${who}: source class '${lane.sourceClass}' has one row lane (its tuple is one shape)`);
|
|
88
|
+
}
|
|
89
|
+
classes.add(lane.sourceClass);
|
|
90
|
+
if (!nonEmptyText(lane.kType))
|
|
91
|
+
throw new Error(`${who}: kType is required`);
|
|
92
|
+
if (!nonEmptyText(lane.label))
|
|
93
|
+
throw new Error(`${who}: label is required`);
|
|
94
|
+
if (lane.feedWords !== undefined && !nonEmptyText(lane.feedWords)) {
|
|
95
|
+
throw new Error(`${who}: feedWords is an i18n key or absent`);
|
|
96
|
+
}
|
|
97
|
+
if (!Number.isInteger(lane.width) || lane.width < 1)
|
|
98
|
+
throw new Error(`${who}: width is a whole number of f64s`);
|
|
99
|
+
for (const hook of ['identity', 'facets', 'cells', 'fetch', 'horizon']) {
|
|
100
|
+
if (!isFunctionOrAbsent(lane[hook]))
|
|
101
|
+
throw new Error(`${who}: ${hook} is a function or absent`);
|
|
102
|
+
}
|
|
103
|
+
if (lane.acquisitions !== undefined && lane.acquisitions !== 'one') {
|
|
104
|
+
throw new Error(`${who}: acquisitions is 'one' or absent`);
|
|
105
|
+
}
|
|
106
|
+
if (lane.governed !== undefined && lane.governed !== 'opra')
|
|
107
|
+
throw new Error(`${who}: governed is 'opra' or absent`);
|
|
108
|
+
assertWrunRowChainLane(who, lane);
|
|
109
|
+
if (lane.emptyAnswer !== undefined && lane.emptyAnswer !== 'quiet' && lane.emptyAnswer !== 'degrades') {
|
|
110
|
+
throw new Error(`${who}: emptyAnswer is 'quiet', 'degrades' or absent`);
|
|
111
|
+
}
|
|
112
|
+
const landing = lane.landing;
|
|
113
|
+
if (landing?.coarserWhenEmpty !== undefined &&
|
|
114
|
+
(landing.kind !== 'snapshot' || landing.tiers === undefined || typeof landing.coarserWhenEmpty !== 'function')) {
|
|
115
|
+
throw new Error(`${who}: coarserWhenEmpty is a function on a snapshot with tiers (a coarser tier to read)`);
|
|
116
|
+
}
|
|
117
|
+
if (landing?.kind === 'latest') {
|
|
118
|
+
if (landing.tiers !== undefined || landing.fold !== undefined || landing.tierChoice !== undefined) {
|
|
119
|
+
throw new Error(`${who}: a latest lane reads the newest row on the live bar: no tiers, no tier choice, no fold`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else if (landing?.kind === 'flow' || landing?.kind === 'snapshot') {
|
|
123
|
+
assertWrunHostGridLanding(who, {
|
|
124
|
+
landing: landing.kind,
|
|
125
|
+
tiers: landing.tiers,
|
|
126
|
+
});
|
|
127
|
+
if (!isFunctionOrAbsent(landing.fold))
|
|
128
|
+
throw new Error(`${who}: landing fold is a function or absent`);
|
|
129
|
+
if (landing.tierChoice !== undefined && landing.tierChoice !== 'finest' && landing.tierChoice !== 'coarsest') {
|
|
130
|
+
throw new Error(`${who}: landing tierChoice is 'finest', 'coarsest' or absent`);
|
|
131
|
+
}
|
|
132
|
+
if (landing.tierChoice === 'coarsest' &&
|
|
133
|
+
(landing.kind !== 'flow' || landing.tiers === undefined || landing.fold === undefined)) {
|
|
134
|
+
throw new Error(`${who}: the coarsest tier choice needs a flow with tiers and a fold (a bar read alike from any tier)`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
throw new Error(`${who}: landing is { kind: 'flow' | 'snapshot' | 'latest' }`);
|
|
139
|
+
}
|
|
140
|
+
const budget = lane.rowBudget;
|
|
141
|
+
if (budget !== undefined) {
|
|
142
|
+
if (landing.kind === 'latest' || lane.presentMask === false) {
|
|
143
|
+
throw new Error(`${who}: a row budget marks the bars it leaves out partial: a flow or snapshot with a present mask`);
|
|
144
|
+
}
|
|
145
|
+
if (!Number.isInteger(budget.maxRows) || budget.maxRows < 1 || typeof budget.barRows !== 'function') {
|
|
146
|
+
throw new Error(`${who}: rowBudget is { maxRows: a whole number of rows, barRows: a function } or absent`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const live = lane.liveByCoin;
|
|
150
|
+
if (live !== undefined) {
|
|
151
|
+
if (landing.kind === 'latest')
|
|
152
|
+
throw new Error(`${who}: a latest lane is polled, never fed live by coin`);
|
|
153
|
+
if (!nonEmptyText(live.scriptSource))
|
|
154
|
+
throw new Error(`${who}: liveByCoin names its script source`);
|
|
155
|
+
if (typeof live.stampOf !== 'function' || typeof live.fold !== 'function') {
|
|
156
|
+
throw new Error(`${who}: liveByCoin declares stampOf and fold`);
|
|
157
|
+
}
|
|
158
|
+
if (!isFunctionOrAbsent(live.coinOf) || !isFunctionOrAbsent(live.reconcile)) {
|
|
159
|
+
throw new Error(`${who}: liveByCoin coinOf and reconcile are functions or absent`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/** The lanes of the listed modules (index key `./row-lanes/<file>.ts` -> module), in file order, each file checked
|
|
165
|
+
* against its name and the whole set against the registry's rules. Exported for the spec. */
|
|
166
|
+
export function wrunRowLanesOfModules(modules) {
|
|
167
|
+
const lanes = [];
|
|
168
|
+
for (const path of Object.keys(modules).sort()) {
|
|
169
|
+
const fileClass = wrunPollLaneClassOfFile(path);
|
|
170
|
+
const exported = [...(modules[path].rowLane ? [modules[path].rowLane] : []), ...(modules[path].rowLanes ?? [])];
|
|
171
|
+
if (fileClass === undefined || exported.length === 0) {
|
|
172
|
+
throw new Error(`wrun row lane file '${path}': a row lane file is named after its source class (<source_class>.ts) and exports 'rowLane' or 'rowLanes'`);
|
|
173
|
+
}
|
|
174
|
+
for (const lane of exported) {
|
|
175
|
+
if (lane.sourceClass !== fileClass) {
|
|
176
|
+
throw new Error(`wrun row lane file '${path}' declares source class '${String(lane.sourceClass)}': a row lane file is named after the class it serves`);
|
|
177
|
+
}
|
|
178
|
+
lanes.push(lane);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
assertWrunRowLanes(lanes);
|
|
182
|
+
return lanes;
|
|
183
|
+
}
|
|
184
|
+
function indexWrunRowLanes(lanes) {
|
|
185
|
+
// A lane's own feed words, so a refusal record naming it reads them (no shared table row).
|
|
186
|
+
registerWrunRefusalFeedKeys(Object.fromEntries(lanes.flatMap((lane) => (lane.feedWords !== undefined ? [[lane.laneKey, lane.feedWords]] : []))));
|
|
187
|
+
// A lane's tuple width, so the packer counts its max_cells in the lane's tuples (the packer and the refusal
|
|
188
|
+
// table live in the wrun chart-host package, which never imports this registry).
|
|
189
|
+
registerWrunRowLaneTupleWidths(Object.fromEntries(lanes.map((lane) => [lane.sourceClass, lane.width])));
|
|
190
|
+
return {
|
|
191
|
+
lanes,
|
|
192
|
+
byKey: new Map(lanes.map((lane) => [lane.laneKey, lane])),
|
|
193
|
+
byClass: new Map(lanes.map((lane) => [lane.sourceClass, lane])),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
const DISCOVERED_ROW_LANES = wrunRowLanesOfModules(WRUN_ROW_LANE_MODULES);
|
|
197
|
+
let registry = indexWrunRowLanes(DISCOVERED_ROW_LANES);
|
|
198
|
+
/** Every registered row lane, in file order. */
|
|
199
|
+
export function wrunRowLanes() {
|
|
200
|
+
return registry.lanes;
|
|
201
|
+
}
|
|
202
|
+
export function wrunRowLaneByKey(laneKey) {
|
|
203
|
+
return typeof laneKey === 'string' ? registry.byKey.get(laneKey) : undefined;
|
|
204
|
+
}
|
|
205
|
+
/** The row lane serving a source class, if one does. */
|
|
206
|
+
export function wrunRowLaneOfClass(sourceClass) {
|
|
207
|
+
return typeof sourceClass === 'string' ? registry.byClass.get(sourceClass) : undefined;
|
|
208
|
+
}
|
|
209
|
+
/** The source classes the row lanes serve, in file order. */
|
|
210
|
+
export function wrunRowLaneClasses() {
|
|
211
|
+
return [...registry.byClass.keys()];
|
|
212
|
+
}
|
|
213
|
+
/** Each row lane's tuple width by class (the packer counts `max_cells` in these tuples). */
|
|
214
|
+
export function wrunRowLaneWidths() {
|
|
215
|
+
return Object.fromEntries(registry.lanes.map((lane) => [lane.sourceClass, lane.width]));
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Spec hook: replace the registry with `lanes` (checked like discovered ones against the poll lanes registered
|
|
219
|
+
* now, minus the file name rule), or restore the discovered lanes with `null`. Every consumer reads the registry
|
|
220
|
+
* at call time, so a spec injects a lane, exercises the real run pass, row builder and tick, and restores in its
|
|
221
|
+
* teardown.
|
|
222
|
+
*/
|
|
223
|
+
export function __setWrunRowLanesForTest(lanes) {
|
|
224
|
+
if (lanes === null) {
|
|
225
|
+
registry = indexWrunRowLanes(DISCOVERED_ROW_LANES);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
assertWrunRowLanes(lanes);
|
|
229
|
+
registry = indexWrunRowLanes([...lanes]);
|
|
230
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as lane_option_contract_flow from './option_contract_flow.js';
|
|
2
|
+
import * as lane_option_contract_state from './option_contract_state.js';
|
|
3
|
+
import * as lane_option_prints from './option_prints.js';
|
|
4
|
+
import * as lane_option_strikes from './option_strikes.js';
|
|
5
|
+
import * as lane_option_surface from './option_surface.js';
|
|
6
|
+
export const WRUN_ROW_LANE_MODULES = {
|
|
7
|
+
'./row-lanes/option_contract_flow.ts': lane_option_contract_flow,
|
|
8
|
+
'./row-lanes/option_contract_state.ts': lane_option_contract_state,
|
|
9
|
+
'./row-lanes/option_prints.ts': lane_option_prints,
|
|
10
|
+
'./row-lanes/option_strikes.ts': lane_option_strikes,
|
|
11
|
+
'./row-lanes/option_surface.ts': lane_option_surface,
|
|
12
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { refuseWrunOptionKnob, wrunOptionExpiriesKnob, wrunOptionExpiriesWord, wrunOptionStrikeWindowKnob, } from '../../wrun-option-knobs.util.js';
|
|
2
|
+
import { foldWrunOptionContractFlowBar, WRUN_OPTION_CONTRACT_FLOW_MAX_ROWS, WRUN_OPTION_CONTRACT_FLOW_WIDTH, WRUN_OPTION_PRINT_AGG_TIERS, wrunOptionContractFlowBarRows, } from '../../wrun-option-contract-flow.util.js';
|
|
3
|
+
import { resolveWrunOpraLaneUnderlying } from '../../wrun-opra-underlying.util.js';
|
|
4
|
+
/** The lane's key, its feed in a refusal record. */
|
|
5
|
+
const LANE_KEY = 'option_contract_flow';
|
|
6
|
+
/** One input's facets: the expiries word, the strike window and the volume floor (each absent when not declared). */
|
|
7
|
+
function contractFlowFacets(source, ctx) {
|
|
8
|
+
const expiries = wrunOptionExpiriesWord(wrunOptionExpiriesKnob(source, ctx));
|
|
9
|
+
const strikeWindowPct = wrunOptionStrikeWindowKnob(source, ctx);
|
|
10
|
+
const minVolume = source.min_volume;
|
|
11
|
+
if (minVolume !== undefined && !(typeof minVolume === 'number' && Number.isFinite(minVolume) && minVolume > 0)) {
|
|
12
|
+
refuseWrunOptionKnob(ctx, 'min_volume', minVolume, 'a contract count above 0');
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
...(expiries !== undefined ? { expiries } : {}),
|
|
16
|
+
...(strikeWindowPct !== undefined ? { strikeWindowPct } : {}),
|
|
17
|
+
...(minVolume !== undefined ? { minVolume } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export const rowLane = {
|
|
21
|
+
sourceClass: 'option_contract_flow',
|
|
22
|
+
laneKey: LANE_KEY,
|
|
23
|
+
kType: 'option_contract_flow',
|
|
24
|
+
label: 'Option contract flow',
|
|
25
|
+
feedWords: 'wrun.refusal.feed.optionContractFlow',
|
|
26
|
+
width: WRUN_OPTION_CONTRACT_FLOW_WIDTH,
|
|
27
|
+
identity: async (ctx) => ({ coin: await resolveWrunOpraLaneUnderlying(ctx) }),
|
|
28
|
+
facets: contractFlowFacets,
|
|
29
|
+
landing: {
|
|
30
|
+
kind: 'flow',
|
|
31
|
+
tiers: WRUN_OPTION_PRINT_AGG_TIERS,
|
|
32
|
+
tierChoice: 'coarsest',
|
|
33
|
+
fold: (group, acquisition) => foldWrunOptionContractFlowBar(group.rows, acquisition),
|
|
34
|
+
},
|
|
35
|
+
rowBudget: { maxRows: WRUN_OPTION_CONTRACT_FLOW_MAX_ROWS, barRows: wrunOptionContractFlowBarRows },
|
|
36
|
+
governed: 'opra',
|
|
37
|
+
emptyAnswer: 'quiet',
|
|
38
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WrunRowLaneDescriptor } from '../wrun-row-lane.types.js';
|
|
2
|
+
/** f64s per tuple (the source contract's width, the `present` mask included). */
|
|
3
|
+
export declare const WRUN_OPTION_CONTRACT_STATE_WIDTH = 13;
|
|
4
|
+
/** om's code for a market pin on the OPRA classes. */
|
|
5
|
+
export declare const WRUN_OPTION_MARKET_PINNED_CODE = "wrun_option_market_pinned";
|
|
6
|
+
export declare const rowLane: WrunRowLaneDescriptor;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `option_contract_state`: the chain summary of every contract of the chart's underlying with the prior session's close
|
|
3
|
+
* and the prior open interest, on the LIVE bar only (UW-PARITY S7, `contracts/sources.md`).
|
|
4
|
+
*
|
|
5
|
+
* - Tuple, width 13: `[root_code, expiry_ms, side_cp, strike, bid, ask, last, prev_close, theta, volume_day, oi, oi_prev,
|
|
6
|
+
* present]`; bits 4 to 11 of `present` say which of bid through oi_prev were served (0 with the bit clear otherwise).
|
|
7
|
+
* `prev_close` and `oi_prev` are kiyotaka-go !62's chain fields (`prevClose`, `openInterestPrev`, decoded since
|
|
8
|
+
* pb-common 12.68.0); a summary that leaves one out reads 0 with its bit clear. There is no protocol-pending refusal
|
|
9
|
+
* for this class.
|
|
10
|
+
* - Backend: the governed `StreamOptionChainSummary` read the options chain lane reads (the worker's chain store,
|
|
11
|
+
* `ensureFreshChain`), as an acquisition of its own (`K_OPTION_CHAIN_SUMMARY`: a package reading `options_chain` too
|
|
12
|
+
* reads the chain twice, separately; the hand-wired chain lane is untouched). The K type is om's fetch type for the
|
|
13
|
+
* class (`option_chain_summary`).
|
|
14
|
+
* - Landing `latest`: the newest chain snapshot is the live row's block, every other row an empty one (read it on
|
|
15
|
+
* `bar.isLast()`), like `options_chain`; an empty chain degrades like every state lane.
|
|
16
|
+
* - Knobs (acquisition facets): `expiries` ("all", "nearest:N" or "0dte") and `strike_window_pct` (above 0, at most 100);
|
|
17
|
+
* `max_cells` is required (the static plan) and a block over it refuses the run, never truncated. A market pin and
|
|
18
|
+
* the knobs of the other options classes are refused by name.
|
|
19
|
+
* - Governed by OPRA: served where the chart's options ride the OPRA plane (a US stock or ETF chart, an OPRA contract
|
|
20
|
+
* chart), the wall for a run that may not read OPRA, the provenance stamp and the routed tier (U10a's rules).
|
|
21
|
+
*
|
|
22
|
+
* LIGHT at module load: the chain resolver is imported inside `identity`.
|
|
23
|
+
*/
|
|
24
|
+
import { refuseWrunLaneStrayKnob, resolveWrunLaneOpraChain } from '../opra-option-lanes.util.js';
|
|
25
|
+
import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
|
|
26
|
+
import { wrunOptionExpiriesKnob, wrunOptionExpiriesText, wrunOptionStrikeWindowKnob, } from '../../wrun-option-knobs.util.js';
|
|
27
|
+
/** f64s per tuple (the source contract's width, the `present` mask included). */
|
|
28
|
+
export const WRUN_OPTION_CONTRACT_STATE_WIDTH = 13;
|
|
29
|
+
/** om's code for a market pin on the OPRA classes. */
|
|
30
|
+
export const WRUN_OPTION_MARKET_PINNED_CODE = 'wrun_option_market_pinned';
|
|
31
|
+
/** The knobs of the other options classes, each refused here by name. */
|
|
32
|
+
const STRAY_KNOBS = [
|
|
33
|
+
['venue', "'options_chain', 'option_strikes', 'option_surface', 'options_oi' and 'options_volume'"],
|
|
34
|
+
['history', "'tape' and 'option_prints' celled"],
|
|
35
|
+
['min_size', "'tape' celled"],
|
|
36
|
+
['min_premium', "'option_prints' celled"],
|
|
37
|
+
['overflow', "'option_prints' celled"],
|
|
38
|
+
['min_volume', "'option_contract_flow' celled"],
|
|
39
|
+
];
|
|
40
|
+
export const rowLane = {
|
|
41
|
+
sourceClass: 'option_contract_state',
|
|
42
|
+
laneKey: 'option_contract_state',
|
|
43
|
+
// om's fetch type for the class (option-cells.ts `WRUN_OPTION_FETCH_TYPES`): the K_OPTION_CHAIN_SUMMARY control.
|
|
44
|
+
kType: 'option_chain_summary',
|
|
45
|
+
label: 'Option contract quotes',
|
|
46
|
+
feedWords: 'wrun.refusal.feed.optionContractState',
|
|
47
|
+
width: WRUN_OPTION_CONTRACT_STATE_WIDTH,
|
|
48
|
+
governed: 'opra',
|
|
49
|
+
landing: { kind: 'latest' },
|
|
50
|
+
identity: async (ctx) => {
|
|
51
|
+
const chain = await resolveWrunLaneOpraChain(ctx);
|
|
52
|
+
return { stateExchange: chain.exchange, stateUnderlying: chain.underlying };
|
|
53
|
+
},
|
|
54
|
+
facets: (source, ctx) => {
|
|
55
|
+
for (const [knob, owners] of STRAY_KNOBS) {
|
|
56
|
+
if (source[knob] !== undefined)
|
|
57
|
+
refuseWrunLaneStrayKnob(ctx, knob, owners);
|
|
58
|
+
}
|
|
59
|
+
if (source.symbol !== undefined || source.exchange !== undefined) {
|
|
60
|
+
refuseWrunPollInput(ctx, `pins option_contract_state cells to a fixed market (${WRUN_OPTION_MARKET_PINNED_CODE}); it reads the chart's own underlying, so drop the symbol and exchange pin`, { cls: 'run-failed', variant: 'generic' });
|
|
61
|
+
}
|
|
62
|
+
// om's knob words and its one refusal name (`wrun_option_knob_invalid`), as every OPRA class refuses them.
|
|
63
|
+
const expiries = wrunOptionExpiriesKnob(source, ctx);
|
|
64
|
+
const strikeWindowPct = wrunOptionStrikeWindowKnob(source, ctx);
|
|
65
|
+
return {
|
|
66
|
+
stateExpiries: wrunOptionExpiriesText(expiries),
|
|
67
|
+
...(strikeWindowPct !== undefined ? { stateStrikeWindowPct: strikeWindowPct } : {}),
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WrunRowLaneDescriptor } from '../wrun-row-lane.types.js';
|
|
2
|
+
/** om's refusal name of a missing floor. */
|
|
3
|
+
export declare const WRUN_OPTION_PRINTS_MIN_PREMIUM_REQUIRED_CODE = "wrun_option_prints_min_premium_required";
|
|
4
|
+
export declare const rowLane: WrunRowLaneDescriptor;
|