@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,523 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pin spellings (WRUN-REPORTS-CLASSES C5, unit U8): a pinned market written the way another platform writes it is
|
|
3
|
+
* respelled onto the market it names, or refused by name, on the run's copy of the sheet BEFORE the run plans its legs.
|
|
4
|
+
*
|
|
5
|
+
* The class this closes: a pin was judged for its venue only (`wrunPinnedLegRefusalOf`), never for its spelling, so
|
|
6
|
+
* a served venue with a foreign symbol (`COINBASE:BTCUSD`, TradingView's name for our `COINBASE|BTC-USD`) passed, the
|
|
7
|
+
* leg fetch came back empty and the legend blamed the market ("COINBASE:BTCUSD sent no prices"). The settings picker
|
|
8
|
+
* always writes our spelling; foreign ones arrive through agent params, Pine conversions and sheet defaults.
|
|
9
|
+
*
|
|
10
|
+
* One step per run, between the settings painter and the leg planner (`planWrunPinnedWires`), so fetch identities are
|
|
11
|
+
* built from the market the run asks:
|
|
12
|
+
* - `isForeignSpelling` (sync, no catalog): could the written spelling name no market of ours? A venue word off our
|
|
13
|
+
* wire (a TradingView prefix, a display alias such as `BINANCE.F`, a stock listing), TradingView's perpetual suffix
|
|
14
|
+
* (`BTCUSDT.P`), our key typed into the symbol half (`COINBASE|BTC-USD`), a stock or forex symbol without its
|
|
15
|
+
* `/` (`POLYGON:AAPL`, `FX_OTC:EURUSD`), or a crypto pair whose form the venue's catalog spelling does not vouch for
|
|
16
|
+
* (`venue-presets.constants`: Coinbase and OKX write `BTC-USD`, Binance and Bybit `BTCUSDT`; a pair on a venue the
|
|
17
|
+
* presets do not describe is confirmed by the catalog). Everything else is ours and skips the catalog.
|
|
18
|
+
* - `resolveWrunPinMarket` (sync over an already-loaded catalog): the written spelling first (our own spelling always
|
|
19
|
+
* wins), then the same instrument through the TradingView prefix tables (tradingview-symbols.leaf, the watchlist
|
|
20
|
+
* import's own: the venue map, the quote split, the perpetual ids, the metals), checked against the catalog; never a
|
|
21
|
+
* stand-in on another venue (the watchlist import's "closest market"), never an inverted forex pair (`USD/JPY` is
|
|
22
|
+
* not `JPY/USD`). No catalog loaded: `catalog-pending` with the candidates to ask, so a caller awaits the catalog
|
|
23
|
+
* only for a foreign spelling.
|
|
24
|
+
* - Refused by name before any fetch: `wrun_pin_unresolvable` (a venue we know, or one the tables map, with no market
|
|
25
|
+
* of ours under that spelling) and `wrun_pin_venue_unknown` (a venue word no table maps, the venue judge's own
|
|
26
|
+
* words). A CME Group market (ours as written, or the one a TradingView CME prefix names, `CME_MINI:ES1!` read as
|
|
27
|
+
* `CME|ES1!`) and an expression go on to the venue judge, which refuses them in its own words.
|
|
28
|
+
* - A respelled pin runs on the resolved market with a legend note (`WRUN_PIN_RESPELLED`, "Pinned COINBASE:BTCUSD runs
|
|
29
|
+
* as COINBASE|BTC-USD"); the SAVED value is never rewritten (the respelling lives on the run's copy only).
|
|
30
|
+
*
|
|
31
|
+
* Guard: tests/fixtures/wrun/pin-spellings.json (`{ input, expect: { market } | { refusal } }`, the row shape om's
|
|
32
|
+
* runner vendors) runs through this step, the planner and the venue judge over a fixture catalog, and no row may end
|
|
33
|
+
* in an empty fetch. Pure: no store, no service, no I/O (the one async helper awaits a catalog ask its caller injects).
|
|
34
|
+
*/
|
|
35
|
+
import { Category, Exchange } from '@orangecharts/orange-v2-pb-common';
|
|
36
|
+
import { PERP_PRESET_VENUE_QUOTES, SPOT_PRESET_VENUE_QUOTES } from '../../constants/venue-presets.constants.js';
|
|
37
|
+
import { normalizeLegacyExchange } from '../chart/legacy-exchange.leaf.js';
|
|
38
|
+
import { EXCHANGE_DISPLAY_SUFFIXES, formatDisplayToExchange } from '../exchange-normalization.util.js';
|
|
39
|
+
import { BASE_ALIASES, CME_PREFIXES, CRYPTO_VENUES, FX_PREFIXES, NATIVE_PREFIX, PERP_SUFFIX_RE, TVC_SPOT_METALS, US_STOCK_PREFIXES, VENUE_TO_TRADINGVIEW, cmeContinuousKeyOf, cryptoCandidate, fxPair, splitCryptoSymbol, } from '../watchlist/import/tradingview-symbols.leaf.js';
|
|
40
|
+
import { WRUN_PIN_VENUE_UNKNOWN_CODE, wrunPinMarketIsLiteral, wrunPinVenueOnWire, wrunPinVenueUnknownMessage, wrunPinVenueUnknownSeed, } from './wrun-pin-venues.util.js';
|
|
41
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
42
|
+
import { WRUN_LEG_STREAM_CLASS_NAMES, isWrunLegStreamClass } from './wrun-leg-stream-classes.js';
|
|
43
|
+
/** A pin no market of ours answers to, as written or as the tables map it: refused by name before any fetch. */
|
|
44
|
+
export const WRUN_PIN_UNRESOLVABLE_CODE = 'wrun_pin_unresolvable';
|
|
45
|
+
/** The catalog has not answered for a foreign spelling yet: ask it, then resolve again. */
|
|
46
|
+
export const WRUN_PIN_CATALOG_PENDING = 'catalog-pending';
|
|
47
|
+
/** The legend note row of a respelled pin, and the run-owned set its publisher replaces per run. */
|
|
48
|
+
export const WRUN_PIN_RESPELLED_CODE = 'WRUN_PIN_RESPELLED';
|
|
49
|
+
export const WRUN_PIN_ROW_CODES = new Set([WRUN_PIN_RESPELLED_CODE]);
|
|
50
|
+
/** The note's words: "Pinned {pin} runs as {market}." (every locale bundle). */
|
|
51
|
+
export const WRUN_PIN_RESPELLED_NOTE_KEY = 'wrun.pin.respelled';
|
|
52
|
+
/** `EXCHANGE<sep>SYMBOL`: split at the first `|` or `:` (whichever comes first), else at the first `/`; no
|
|
53
|
+
* separator, a symbol alone. `HYPERLIQUID_HIP3:xyz:TSLA` keeps `xyz:TSLA`, `POLYGON|BRK.B/USD` keeps `BRK.B/USD`. */
|
|
54
|
+
export function parseWrunPinSpelling(text) {
|
|
55
|
+
const trimmed = text.trim();
|
|
56
|
+
const at = [trimmed.indexOf('|'), trimmed.indexOf(':')].filter((index) => index > 0);
|
|
57
|
+
const split = at.length > 0 ? Math.min(...at) : trimmed.indexOf('/');
|
|
58
|
+
if (split <= 0 || split === trimmed.length - 1)
|
|
59
|
+
return { exchange: '', symbol: trimmed };
|
|
60
|
+
return { exchange: trimmed.slice(0, split).trim(), symbol: trimmed.slice(split + 1).trim() };
|
|
61
|
+
}
|
|
62
|
+
const upper = (word) => word.trim().toUpperCase();
|
|
63
|
+
/** The display alias's venue (`BINANCE.F` -> `BINANCE`) and whether it names derivatives. */
|
|
64
|
+
function displayAliasOf(word) {
|
|
65
|
+
const suffix = EXCHANGE_DISPLAY_SUFFIXES.find((candidate) => word.endsWith(candidate));
|
|
66
|
+
return suffix && word.length > suffix.length
|
|
67
|
+
? { base: word.slice(0, -suffix.length), options: suffix === '.O' }
|
|
68
|
+
: null;
|
|
69
|
+
}
|
|
70
|
+
/** A venue word some table knows: our wire's, a TradingView prefix, a display alias of one, or our escape. */
|
|
71
|
+
function isKnownVenueWord(word) {
|
|
72
|
+
const venue = upper(word);
|
|
73
|
+
if (venue === '')
|
|
74
|
+
return false;
|
|
75
|
+
const alias = displayAliasOf(venue);
|
|
76
|
+
const base = alias?.base ?? venue;
|
|
77
|
+
return (typeof Exchange[base] === 'number' ||
|
|
78
|
+
base in CRYPTO_VENUES ||
|
|
79
|
+
base in CME_PREFIXES ||
|
|
80
|
+
US_STOCK_PREFIXES.has(base) ||
|
|
81
|
+
FX_PREFIXES.has(base) ||
|
|
82
|
+
base === 'TVC' ||
|
|
83
|
+
base === NATIVE_PREFIX);
|
|
84
|
+
}
|
|
85
|
+
/** Our escape (`OPENMARKET:<key>`, the watchlist export's name for a market TradingView cannot spell) read as its key. */
|
|
86
|
+
function unwrapNative(reading) {
|
|
87
|
+
return upper(reading.exchange) === NATIVE_PREFIX ? parseWrunPinSpelling(reading.symbol) : reading;
|
|
88
|
+
}
|
|
89
|
+
/** The pin as written (a symbol alone reads the chart's exchange), then the reading it names when that differs: our
|
|
90
|
+
* key typed into a setting (`COINBASE|BTC-USD`, the delimiter no symbol holds), a known venue word ahead of `:` or
|
|
91
|
+
* `/` in the symbol half (`COINBASE/BTCUSD` painted onto a sheet pinned elsewhere), our escape's key. */
|
|
92
|
+
function readingsOf(input, chartExchange) {
|
|
93
|
+
let written;
|
|
94
|
+
let named;
|
|
95
|
+
if (typeof input === 'string') {
|
|
96
|
+
written = parseWrunPinSpelling(input);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const symbol = (input.symbol ?? '').trim();
|
|
100
|
+
written = { exchange: (input.exchange ?? chartExchange ?? '').trim(), symbol };
|
|
101
|
+
const inner = parseWrunPinSpelling(symbol);
|
|
102
|
+
if (inner.exchange !== '' && (symbol.includes('|') || isKnownVenueWord(inner.exchange)))
|
|
103
|
+
named = inner;
|
|
104
|
+
}
|
|
105
|
+
const meant = unwrapNative(named ?? written);
|
|
106
|
+
return meant === written ? [written] : [written, meant];
|
|
107
|
+
}
|
|
108
|
+
/** A crypto venue of ours the TradingView tables or the venue presets describe. */
|
|
109
|
+
function isOurCryptoVenue(venue) {
|
|
110
|
+
return venue in VENUE_TO_TRADINGVIEW || venue in SPOT_PRESET_VENUE_QUOTES || venue in PERP_PRESET_VENUE_QUOTES;
|
|
111
|
+
}
|
|
112
|
+
/** How a preset venue spells a pair in its catalog (`venue-presets.constants`: `COINBASE: '-USD'` is `BTC-USD`,
|
|
113
|
+
* `BINANCE: 'USDT'` is `BTCUSDT`): `glued`, the separator, or undefined for a venue the presets do not describe. */
|
|
114
|
+
function presetPairForm(venue) {
|
|
115
|
+
const quote = SPOT_PRESET_VENUE_QUOTES[venue] ?? PERP_PRESET_VENUE_QUOTES[venue];
|
|
116
|
+
if (quote === undefined)
|
|
117
|
+
return undefined;
|
|
118
|
+
return /^[A-Z0-9]/.test(quote) ? 'glued' : quote[0];
|
|
119
|
+
}
|
|
120
|
+
const GLUED_RE = /^[A-Z0-9]+$/;
|
|
121
|
+
/** TradingView's perpetual (`BTCUSDT.P`): no market of ours is spelled so. */
|
|
122
|
+
const TRADINGVIEW_PERP_RE = /^[A-Z0-9]+\.P$/i;
|
|
123
|
+
/** A spelling that can name no market of ours, the catalog unasked: TradingView's perpetual, or a glued pair on a
|
|
124
|
+
* venue whose catalog always separates (Coinbase and OKX write `BTC-USD`). A separated pair on a glued venue is no
|
|
125
|
+
* proof (Binance's dated contracts are `BTCUSDT_251226`): the catalog decides it. */
|
|
126
|
+
function provablyForeign(reading) {
|
|
127
|
+
if (TRADINGVIEW_PERP_RE.test(reading.symbol))
|
|
128
|
+
return true;
|
|
129
|
+
const form = presetPairForm(reading.exchange);
|
|
130
|
+
if (form === undefined || form === 'glued')
|
|
131
|
+
return false;
|
|
132
|
+
return GLUED_RE.test(reading.symbol.toUpperCase()) && splitCryptoSymbol(reading.symbol) !== null;
|
|
133
|
+
}
|
|
134
|
+
/** Whether a written spelling needs the catalog before any fetch (see the header). */
|
|
135
|
+
function writtenNeedsCatalog(reading) {
|
|
136
|
+
const { exchange, symbol } = reading;
|
|
137
|
+
if (exchange === '' || symbol === '')
|
|
138
|
+
return false;
|
|
139
|
+
if (!wrunPinVenueOnWire(exchange) || symbol.includes('|') || provablyForeign(reading))
|
|
140
|
+
return true;
|
|
141
|
+
if (exchange === 'POLYGON' || exchange === 'FX_OTC')
|
|
142
|
+
return !symbol.includes('/');
|
|
143
|
+
if (!isOurCryptoVenue(exchange) || splitCryptoSymbol(symbol) === null)
|
|
144
|
+
return false;
|
|
145
|
+
const form = presetPairForm(exchange);
|
|
146
|
+
if (form === undefined)
|
|
147
|
+
return true;
|
|
148
|
+
if (form === 'glued')
|
|
149
|
+
return !GLUED_RE.test(symbol);
|
|
150
|
+
const [base, quote, ...rest] = symbol.split(form);
|
|
151
|
+
return rest.length > 0 || !GLUED_RE.test(base ?? '') || !GLUED_RE.test(quote ?? '');
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Whether a pin's spelling could name no market of ours as written, so the catalog must confirm it (or name the
|
|
155
|
+
* market it means) before any fetch: sync, no catalog. False for our own spellings (`BINANCE:BTCUSDT`,
|
|
156
|
+
* `COINBASE:BTC-USD`, `FX_OTC:EUR/USD`, `POLYGON:AAPL/USD`, `CME:ES1!`), which run as written.
|
|
157
|
+
*/
|
|
158
|
+
export function isForeignSpelling(input, chartExchange) {
|
|
159
|
+
return writtenNeedsCatalog(readingsOf(input, chartExchange)[0]);
|
|
160
|
+
}
|
|
161
|
+
const candidateId = (candidate) => candidate.rawSymbol !== undefined
|
|
162
|
+
? `${candidate.exchange}|r:${candidate.rawSymbol}`
|
|
163
|
+
: `${candidate.exchange}|n:${candidate.normalizedSymbol ?? ''}`;
|
|
164
|
+
/** Our venues a crypto venue word names: a TradingView prefix's spot or perpetual ids, a display alias's perpetuals,
|
|
165
|
+
* or our own id (a `.P` on a spot id: its prefix's perpetuals). */
|
|
166
|
+
function cryptoVenueIds(venue, perp) {
|
|
167
|
+
const alias = displayAliasOf(venue);
|
|
168
|
+
if (alias) {
|
|
169
|
+
if (alias.options)
|
|
170
|
+
return [];
|
|
171
|
+
// `BINANCE.F` names Binance's perpetuals; `COINBASE_INTERNATIONAL.F` (our own display form) its venue as written.
|
|
172
|
+
const wire = formatDisplayToExchange(venue);
|
|
173
|
+
return [
|
|
174
|
+
...(CRYPTO_VENUES[alias.base]?.perp ?? []),
|
|
175
|
+
...[wire, alias.base].filter((id) => wrunPinVenueOnWire(id) && isOurCryptoVenue(id)),
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
const ids = [];
|
|
179
|
+
const tradingView = CRYPTO_VENUES[venue];
|
|
180
|
+
if (tradingView)
|
|
181
|
+
ids.push(...(perp || !tradingView.spot ? tradingView.perp : [tradingView.spot]));
|
|
182
|
+
const ours = VENUE_TO_TRADINGVIEW[venue];
|
|
183
|
+
if (ours)
|
|
184
|
+
ids.push(...(perp && ours.perp === false ? (CRYPTO_VENUES[ours.prefix]?.perp ?? []) : [venue]));
|
|
185
|
+
else if (isOurCryptoVenue(venue))
|
|
186
|
+
ids.push(venue);
|
|
187
|
+
return ids;
|
|
188
|
+
}
|
|
189
|
+
/** The same instrument on one crypto venue: the pair as the venue's catalog normalizes it (`BTC-USD`), its coin on
|
|
190
|
+
* Hyperliquid's perpetuals, and the base our venues spell otherwise (`XBT` is `BTC`). */
|
|
191
|
+
function cryptoCandidates(venue, symbol) {
|
|
192
|
+
const out = [cryptoCandidate(venue, symbol)];
|
|
193
|
+
const pair = splitCryptoSymbol(symbol);
|
|
194
|
+
const alias = pair ? BASE_ALIASES[pair.base] : undefined;
|
|
195
|
+
if (pair && alias)
|
|
196
|
+
out.push(cryptoCandidate(venue, `${alias}${pair.quote}`));
|
|
197
|
+
return out;
|
|
198
|
+
}
|
|
199
|
+
/** The CME Group market a reading names, by its venue (the venue judge refuses it, never the catalog): the written
|
|
200
|
+
* word on the shared host's refused list, or a TradingView CME prefix through the continuous root table. */
|
|
201
|
+
function cmeMarketOf(reading) {
|
|
202
|
+
if (reading.exchange === '' || reading.symbol === '')
|
|
203
|
+
return undefined;
|
|
204
|
+
if (wrunChartHostEnv().sharedHost().wrunPinVenueRefused(reading.exchange))
|
|
205
|
+
return `${reading.exchange}|${reading.symbol}`;
|
|
206
|
+
const venue = CME_PREFIXES[upper(reading.exchange)];
|
|
207
|
+
if (venue === undefined)
|
|
208
|
+
return undefined;
|
|
209
|
+
return cmeContinuousKeyOf(reading.symbol) ?? `${venue}|${upper(reading.symbol)}`;
|
|
210
|
+
}
|
|
211
|
+
/** Every identity one reading may name, most literal first: as written on our wire, then the same instrument through
|
|
212
|
+
* the TradingView tables (stocks on POLYGON, forex and metals on FX_OTC in the written order, crypto per venue). */
|
|
213
|
+
function readingCandidates(reading) {
|
|
214
|
+
const venue = upper(reading.exchange);
|
|
215
|
+
const raw = reading.symbol;
|
|
216
|
+
if (venue === '' || raw === '' || raw.includes('|'))
|
|
217
|
+
return [];
|
|
218
|
+
const perp = PERP_SUFFIX_RE.test(raw);
|
|
219
|
+
const symbol = upper(perp ? raw.slice(0, -2) : raw);
|
|
220
|
+
const out = [];
|
|
221
|
+
if (wrunPinVenueOnWire(reading.exchange))
|
|
222
|
+
out.push({ exchange: reading.exchange, rawSymbol: raw });
|
|
223
|
+
if (US_STOCK_PREFIXES.has(venue) || normalizeLegacyExchange(venue) === 'POLYGON') {
|
|
224
|
+
out.push({ exchange: 'POLYGON', rawSymbol: symbol.endsWith('/USD') ? symbol : `${symbol}/USD` });
|
|
225
|
+
}
|
|
226
|
+
if (FX_PREFIXES.has(venue) || venue === 'FX_OTC') {
|
|
227
|
+
const pair = fxPair(symbol);
|
|
228
|
+
if (pair)
|
|
229
|
+
out.push({ exchange: 'FX_OTC', rawSymbol: `${pair[0]}/${pair[1]}` });
|
|
230
|
+
}
|
|
231
|
+
const metal = venue === 'TVC' ? TVC_SPOT_METALS[symbol] : undefined;
|
|
232
|
+
if (metal)
|
|
233
|
+
out.push({ exchange: 'FX_OTC', rawSymbol: metal });
|
|
234
|
+
for (const id of cryptoVenueIds(venue, perp))
|
|
235
|
+
out.push(...cryptoCandidates(id, symbol));
|
|
236
|
+
return out;
|
|
237
|
+
}
|
|
238
|
+
/** The candidates of every reading, deduplicated, in reading order. */
|
|
239
|
+
function candidatesOf(readings) {
|
|
240
|
+
const seen = new Map();
|
|
241
|
+
for (const candidate of readings.flatMap(readingCandidates))
|
|
242
|
+
seen.set(candidateId(candidate), candidate);
|
|
243
|
+
return [...seen.values()];
|
|
244
|
+
}
|
|
245
|
+
/** The catalog identities a pin's spelling may name, in the order the resolver reads them (the asks a caller sends
|
|
246
|
+
* when the resolver answers `catalog-pending`). */
|
|
247
|
+
export function wrunPinCandidates(input, chartExchange) {
|
|
248
|
+
return candidatesOf(readingsOf(input, chartExchange));
|
|
249
|
+
}
|
|
250
|
+
const keyOf = (reading) => `${reading.exchange}|${reading.symbol}`;
|
|
251
|
+
/**
|
|
252
|
+
* The market one pin runs on, sync over an already-loaded catalog (`lookup`, `wrunPinCatalogLookupOf`): see the
|
|
253
|
+
* header. Our own spelling never waits; a foreign one reads `catalog-pending` (with the asks) until the catalog
|
|
254
|
+
* answered for its candidates. A catalog that could not answer leaves a spelling as written (the venue judge and the
|
|
255
|
+
* fetch take it as before), except one that provably names nothing of ours, refused by name.
|
|
256
|
+
*/
|
|
257
|
+
export function resolveWrunPinMarket(input, lookup, chartExchange) {
|
|
258
|
+
const readings = readingsOf(input, chartExchange);
|
|
259
|
+
const [written] = readings;
|
|
260
|
+
const writtenKey = keyOf(written);
|
|
261
|
+
const unchanged = { market: writtenKey, respelled: false };
|
|
262
|
+
if (!isForeignSpelling(input, chartExchange))
|
|
263
|
+
return unchanged;
|
|
264
|
+
// An expression or a CME Group venue is the venue judge's, in its own words (its precedence stands).
|
|
265
|
+
const literal = readings.filter((reading) => wrunPinMarketIsLiteral(reading.exchange, reading.symbol));
|
|
266
|
+
if (literal.length === 0)
|
|
267
|
+
return unchanged;
|
|
268
|
+
for (const reading of literal) {
|
|
269
|
+
const cme = cmeMarketOf(reading);
|
|
270
|
+
if (cme !== undefined)
|
|
271
|
+
return { market: cme, respelled: cme !== writtenKey };
|
|
272
|
+
}
|
|
273
|
+
// No identity to ask: no venue of ours, and no table maps the word (a reading on our wire always asks itself).
|
|
274
|
+
const candidates = candidatesOf(literal);
|
|
275
|
+
if (candidates.length === 0)
|
|
276
|
+
return { refusal: WRUN_PIN_VENUE_UNKNOWN_CODE };
|
|
277
|
+
if (lookup === undefined)
|
|
278
|
+
return { pending: WRUN_PIN_CATALOG_PENDING, candidates };
|
|
279
|
+
let unavailable = false;
|
|
280
|
+
for (const candidate of candidates) {
|
|
281
|
+
const answer = lookup(candidate);
|
|
282
|
+
if (answer === undefined)
|
|
283
|
+
return { pending: WRUN_PIN_CATALOG_PENDING, candidates };
|
|
284
|
+
if (answer === 'unavailable')
|
|
285
|
+
unavailable = true;
|
|
286
|
+
else if (answer !== null && !unavailable) {
|
|
287
|
+
const market = `${answer.exchange}|${answer.rawSymbol}`;
|
|
288
|
+
return { market, respelled: market !== writtenKey };
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (unavailable && !literal.some(provablyForeign))
|
|
292
|
+
return unchanged;
|
|
293
|
+
return { refusal: WRUN_PIN_UNRESOLVABLE_CODE };
|
|
294
|
+
}
|
|
295
|
+
/** The venue word the spelling step refuses without asking the catalog (`wrun_pin_venue_unknown`: no venue of ours and
|
|
296
|
+
* no table maps it), else undefined: the spelling-aware form of `wrunSymbolSettingUnknownVenue` for the settings row
|
|
297
|
+
* and the works-on verdict, where a word the run respells (`NASDAQ:AAPL`) is no refusal. Reads the shared host. */
|
|
298
|
+
export function wrunPinUnknownVenue(input, chartExchange) {
|
|
299
|
+
const resolution = resolveWrunPinMarket(input, undefined, chartExchange);
|
|
300
|
+
if (!('refusal' in resolution) || resolution.refusal !== WRUN_PIN_VENUE_UNKNOWN_CODE)
|
|
301
|
+
return undefined;
|
|
302
|
+
const readings = readingsOf(input, chartExchange);
|
|
303
|
+
return readings[readings.length - 1].exchange;
|
|
304
|
+
}
|
|
305
|
+
/** A row's venue name (the raw page carries the enum number). */
|
|
306
|
+
function rowVenue(value) {
|
|
307
|
+
if (typeof value === 'string')
|
|
308
|
+
return value;
|
|
309
|
+
return typeof value === 'number' ? (Exchange[value] ?? '') : '';
|
|
310
|
+
}
|
|
311
|
+
/** Perpetuals and spot before dated contracts: a normalized pair on a futures venue lands on its perpetual. */
|
|
312
|
+
function rowRank(category) {
|
|
313
|
+
const word = typeof category === 'number' ? Category[category] : category;
|
|
314
|
+
return word === 'PERPETUAL' || word === 'SPOT' ? 0 : 1;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* The sync lookup over one catalog answer: `asked` are the candidates the page was asked for (any other reads
|
|
318
|
+
* `undefined`, pending), `page` what `getMarketsRaw` answered (null when the ask failed: every asked candidate reads
|
|
319
|
+
* `unavailable`, as does a page vetoed at the gateway's deadline). Rows are read raw: a hidden or retired venue still
|
|
320
|
+
* answers for a spelling written on it, as the fetch would.
|
|
321
|
+
*/
|
|
322
|
+
export function wrunPinCatalogLookupOf(asked, page) {
|
|
323
|
+
const askedIds = new Set(asked.map(candidateId));
|
|
324
|
+
const failed = page === null || page === undefined || page.vetoed === true;
|
|
325
|
+
const byId = new Map();
|
|
326
|
+
for (const entry of failed ? [] : (page.marketSymbols ?? [])) {
|
|
327
|
+
const row = entry;
|
|
328
|
+
const exchange = rowVenue(row.exchange);
|
|
329
|
+
if (exchange === '' || typeof row.rawSymbol !== 'string' || row.rawSymbol === '')
|
|
330
|
+
continue;
|
|
331
|
+
const found = { row: { exchange, rawSymbol: row.rawSymbol }, rank: rowRank(row.category) };
|
|
332
|
+
const ids = [candidateId({ exchange, rawSymbol: row.rawSymbol })];
|
|
333
|
+
if (typeof row.normalizedSymbol === 'string' && row.normalizedSymbol !== '') {
|
|
334
|
+
ids.push(candidateId({ exchange, normalizedSymbol: row.normalizedSymbol }));
|
|
335
|
+
}
|
|
336
|
+
for (const id of ids) {
|
|
337
|
+
const held = byId.get(id);
|
|
338
|
+
if (held === undefined || found.rank < held.rank)
|
|
339
|
+
byId.set(id, found);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return (candidate) => {
|
|
343
|
+
const id = candidateId(candidate);
|
|
344
|
+
if (!askedIds.has(id))
|
|
345
|
+
return undefined;
|
|
346
|
+
if (failed)
|
|
347
|
+
return 'unavailable';
|
|
348
|
+
return byId.get(id)?.row ?? null;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
/** The pin as its note names it: what the setting or the sheet wrote. */
|
|
352
|
+
function pinText(market, named) {
|
|
353
|
+
const symbol = market.symbol ?? '';
|
|
354
|
+
return named || market.exchange === undefined ? symbol : `${market.exchange}:${symbol}`;
|
|
355
|
+
}
|
|
356
|
+
/** The halves a respelled leg carries: a pin that named a symbol alone keeps the chart's venue implicit. */
|
|
357
|
+
function respelledHalves(written, market, chartExchange) {
|
|
358
|
+
const bar = market.indexOf('|');
|
|
359
|
+
const exchange = market.slice(0, bar);
|
|
360
|
+
const symbol = market.slice(bar + 1);
|
|
361
|
+
return written.exchange === undefined && exchange === chartExchange ? { symbol } : { exchange, symbol };
|
|
362
|
+
}
|
|
363
|
+
/** The refusal of one pin, with the record seed the venue judge gives the same words. */
|
|
364
|
+
function pinRefusal(leg, code, chartExchange) {
|
|
365
|
+
const settingBound = leg.settingBound === true;
|
|
366
|
+
const readings = readingsOf(leg.market, chartExchange);
|
|
367
|
+
const pin = pinText(leg.market, readings.length > 1);
|
|
368
|
+
if (code === WRUN_PIN_VENUE_UNKNOWN_CODE) {
|
|
369
|
+
const venue = readings[readings.length - 1].exchange;
|
|
370
|
+
return {
|
|
371
|
+
message: wrunPinVenueUnknownMessage(leg.inputName, venue),
|
|
372
|
+
seed: wrunPinVenueUnknownSeed(venue, settingBound),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
const seed = {
|
|
376
|
+
cls: 'run-failed',
|
|
377
|
+
variant: 'generic',
|
|
378
|
+
...(settingBound ? { out: { kind: 'open-settings' } } : {}),
|
|
379
|
+
};
|
|
380
|
+
return {
|
|
381
|
+
message: `Input '${leg.inputName}' pins ${pin} (${WRUN_PIN_UNRESOLVABLE_CODE}): no market our data serves answers to ` +
|
|
382
|
+
`that spelling, as written or as the TradingView name maps it; pin the market the symbol search names ` +
|
|
383
|
+
`(EXCHANGE:SYMBOL, such as COINBASE:BTC-USD or POLYGON:AAPL/USD)`,
|
|
384
|
+
seed,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Resolve every pinned leg's spelling, in declaration order (`legs` as `wrunSheetPinLegs` lists them): the legs the
|
|
389
|
+
* run plans (a respelled one carries the resolved halves), one note per respelling, the first refusal (held back
|
|
390
|
+
* while an earlier leg waits on the catalog, so the refusal named is the first in order), and the catalog asks the
|
|
391
|
+
* verdict waits on.
|
|
392
|
+
*/
|
|
393
|
+
export function resolveWrunPinnedLegs(legs, lookup, options = {}) {
|
|
394
|
+
const out = { legs: [], notes: [], pending: [] };
|
|
395
|
+
const pending = new Map();
|
|
396
|
+
for (const leg of legs) {
|
|
397
|
+
const resolution = resolveWrunPinMarket(leg.market, lookup, options.chartExchange);
|
|
398
|
+
if ('pending' in resolution) {
|
|
399
|
+
for (const candidate of resolution.candidates)
|
|
400
|
+
pending.set(candidateId(candidate), candidate);
|
|
401
|
+
out.legs.push(leg);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
if ('refusal' in resolution) {
|
|
405
|
+
if (out.refusal === undefined && pending.size === 0) {
|
|
406
|
+
out.refusal = pinRefusal(leg, resolution.refusal, options.chartExchange);
|
|
407
|
+
}
|
|
408
|
+
out.legs.push(leg);
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
if (!resolution.respelled) {
|
|
412
|
+
out.legs.push(leg);
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
out.legs.push({ ...leg, market: respelledHalves(leg.market, resolution.market, options.chartExchange) });
|
|
416
|
+
const named = readingsOf(leg.market, options.chartExchange).length > 1;
|
|
417
|
+
out.notes.push({ inputName: leg.inputName, from: pinText(leg.market, named), to: resolution.market });
|
|
418
|
+
}
|
|
419
|
+
out.pending = [...pending.values()];
|
|
420
|
+
return out;
|
|
421
|
+
}
|
|
422
|
+
/** The source classes the leg planner serves a market pin on (secondary inputs only, never a celled ohlcv): ohlcv,
|
|
423
|
+
* intrabar and every leg stream (wrun-leg-stream-classes). */
|
|
424
|
+
const PINNED_SOURCES = new Set(['ohlcv', 'intrabar', ...WRUN_LEG_STREAM_CLASS_NAMES]);
|
|
425
|
+
/** A pin the leg planner serves: it refuses the rest in its own words first (a primary input, a celled ohlcv, another
|
|
426
|
+
* class, a celled leg pinning one half alone, which a respelling must not complete), and plans nothing for a candles
|
|
427
|
+
* lane the chart's interval gates off (`wrunGatedLegStream`). */
|
|
428
|
+
function plannedPin(input, source) {
|
|
429
|
+
if (source === undefined || !PINNED_SOURCES.has(source.source) || input.index === 0)
|
|
430
|
+
return false;
|
|
431
|
+
if (isWrunLegStreamClass(source.source) && source.undemanded === true)
|
|
432
|
+
return false;
|
|
433
|
+
if (source.source === 'ohlcv') {
|
|
434
|
+
return input.cellType !== 'array' && (source.symbol !== undefined || source.exchange !== undefined);
|
|
435
|
+
}
|
|
436
|
+
return source.symbol !== undefined && source.exchange !== undefined;
|
|
437
|
+
}
|
|
438
|
+
/** The sheet's pinned inputs in declaration order, as the leg planner reads them. */
|
|
439
|
+
export function wrunSheetPinLegs(metadata) {
|
|
440
|
+
return [...metadata.inputs]
|
|
441
|
+
.sort((a, b) => a.index - b.index)
|
|
442
|
+
.flatMap((input) => {
|
|
443
|
+
const source = metadata.inputSources[input.name];
|
|
444
|
+
if (!plannedPin(input, source))
|
|
445
|
+
return [];
|
|
446
|
+
const market = {
|
|
447
|
+
...(source.exchange !== undefined ? { exchange: source.exchange } : {}),
|
|
448
|
+
...(source.symbol !== undefined ? { symbol: source.symbol } : {}),
|
|
449
|
+
};
|
|
450
|
+
return [{ inputName: input.name, market, settingBound: typeof source.symbol_param === 'string' }];
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* The run's sheet with every pinned spelling resolved: the same sheet when nothing changed, else a copy whose
|
|
455
|
+
* respelled inputs carry the resolved halves (the saved settings and the sheet passed in are never written);
|
|
456
|
+
* `pending` while the catalog has not answered for a foreign spelling; `refusal` for the first unresolvable pin.
|
|
457
|
+
*/
|
|
458
|
+
export function resolveWrunPinnedSheet(metadata, lookup, options = {}) {
|
|
459
|
+
const legs = wrunSheetPinLegs(metadata);
|
|
460
|
+
const resolved = resolveWrunPinnedLegs(legs, lookup, options);
|
|
461
|
+
if (resolved.refusal !== undefined)
|
|
462
|
+
return { refusal: resolved.refusal };
|
|
463
|
+
if (resolved.pending.length > 0)
|
|
464
|
+
return { pending: resolved.pending };
|
|
465
|
+
if (resolved.notes.length === 0)
|
|
466
|
+
return { metadata, notes: [] };
|
|
467
|
+
const inputSources = { ...metadata.inputSources };
|
|
468
|
+
resolved.legs.forEach((leg, at) => {
|
|
469
|
+
if (leg === legs[at])
|
|
470
|
+
return;
|
|
471
|
+
const source = { ...inputSources[leg.inputName] };
|
|
472
|
+
delete source.exchange;
|
|
473
|
+
delete source.symbol;
|
|
474
|
+
inputSources[leg.inputName] = { ...source, ...leg.market };
|
|
475
|
+
});
|
|
476
|
+
return { metadata: { ...metadata, inputSources }, notes: resolved.notes };
|
|
477
|
+
}
|
|
478
|
+
const settled = (resolution) => !('pending' in resolution);
|
|
479
|
+
/**
|
|
480
|
+
* `resolveWrunPinnedSheet` with the catalog asked once when a spelling is foreign: `ask` sends the candidates to the
|
|
481
|
+
* markets catalog (the run's transport: `metadataService.getMarketsRaw` over `buildMarketsRequestFromSymbols`) and
|
|
482
|
+
* answers the raw page, or null when it failed. A sheet of our own spellings never asks.
|
|
483
|
+
*/
|
|
484
|
+
export async function resolveWrunPinnedSheetWithCatalog(metadata, ask, options = {}) {
|
|
485
|
+
const first = resolveWrunPinnedSheet(metadata, undefined, options);
|
|
486
|
+
if (settled(first))
|
|
487
|
+
return first;
|
|
488
|
+
// A transport that throws, synchronously or not, is a catalog that could not answer.
|
|
489
|
+
const page = await Promise.resolve()
|
|
490
|
+
.then(() => ask(first.pending))
|
|
491
|
+
.catch(() => null);
|
|
492
|
+
const second = resolveWrunPinnedSheet(metadata, wrunPinCatalogLookupOf(first.pending, page), options);
|
|
493
|
+
if (settled(second))
|
|
494
|
+
return second;
|
|
495
|
+
// The second pass asks what the first named (the candidates are a function of the sheet), so nothing pends;
|
|
496
|
+
// were it ever to, the catalog reads as unanswered: spellings run as written, provably foreign ones refused.
|
|
497
|
+
const unanswered = resolveWrunPinnedSheet(metadata, () => 'unavailable', options);
|
|
498
|
+
return settled(unanswered) ? unanswered : { metadata, notes: [] };
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* The legend note rows of the respelled pins, one per spelling (its inputs merged), warnings in the run-owned set
|
|
502
|
+
* `WRUN_PIN_ROW_CODES`: `message` the technical words (Copy details), `details` the facts the legend's localized
|
|
503
|
+
* sentence reads (`WRUN_PIN_RESPELLED_NOTE_KEY`: `{ pin, market }`). Empty for no respelling, which is what clears
|
|
504
|
+
* the rows of an earlier run.
|
|
505
|
+
*/
|
|
506
|
+
export function wrunPinRespelledDiagnostics(notes) {
|
|
507
|
+
const merged = new Map();
|
|
508
|
+
for (const note of notes) {
|
|
509
|
+
const key = `${note.from}\u0000${note.to}`;
|
|
510
|
+
const entry = merged.get(key) ?? { pin: note.from, market: note.to, inputs: [] };
|
|
511
|
+
if (!entry.inputs.includes(note.inputName))
|
|
512
|
+
entry.inputs.push(note.inputName);
|
|
513
|
+
merged.set(key, entry);
|
|
514
|
+
}
|
|
515
|
+
return [...merged.values()].map(({ pin, market, inputs }) => ({
|
|
516
|
+
stage: 'compute',
|
|
517
|
+
severity: 'warning',
|
|
518
|
+
code: WRUN_PIN_RESPELLED_CODE,
|
|
519
|
+
type: 'execution',
|
|
520
|
+
message: `Pinned ${pin} runs as ${market} (input ${inputs.map((name) => `'${name}'`).join(', ')}; the saved value is unchanged)`,
|
|
521
|
+
details: { pin, market, inputs },
|
|
522
|
+
}));
|
|
523
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type WrunRefusalSeed } from './wrun-refusal.util.js';
|
|
2
|
+
import type { WrunUnservedLeg } from './wrun-run-health.util.js';
|
|
3
|
+
import type { WrunPinnedLeg, WrunPinnedWire } from './wrun-source-rows.util.js';
|
|
4
|
+
/** The venues the gateway serves no series for to scripts yet: a pin on one is soft-refused per
|
|
5
|
+
* input with a `WRUN_LEG_UNSERVED` row naming why (never silently NaN). Remove a venue here the
|
|
6
|
+
* moment the gateway lists it; nothing else gates it. */
|
|
7
|
+
export declare const WRUN_PIN_UNSERVED_EXCHANGES: readonly ["POLYGON_INDICES"];
|
|
8
|
+
/** A pin on a venue word the chart's lanes cannot ask (`wrunPinVenueVerdict` 'unknown'): the sheet
|
|
9
|
+
* contract's code (om's WRUN_PIN_VENUE_UNKNOWN_CODE; the shared host this chart loads does not
|
|
10
|
+
* carry it yet), refused before any fetch as a failed run. */
|
|
11
|
+
export declare const WRUN_PIN_VENUE_UNKNOWN_CODE = "wrun_pin_venue_unknown";
|
|
12
|
+
/** A multi-day pin shorter than a week on a session venue: a 3d stock, forex or metals candle
|
|
13
|
+
* groups three trading days (a Friday bar runs into Monday), and the leg core confirms a candle
|
|
14
|
+
* at its open plus the span, so such a leg would show Monday's prices on Sunday rows and admit a
|
|
15
|
+
* still-forming candle as confirmed. 1d and 1w stay served: a US listing's confirm at its
|
|
16
|
+
* session close (`wrunLegCandleClose`), every other market's late, never early. */
|
|
17
|
+
export declare const WRUN_PIN_SESSION_INTERVAL_UNSERVED_CODE = "wrun_pin_session_interval_unserved";
|
|
18
|
+
/** Every market the chart's expression parser extracts from a pin's `exchange|symbol`, the text
|
|
19
|
+
* the k-ohlcv control would hand the worker (duplicates kept: each is a request). */
|
|
20
|
+
export declare function wrunPinMarketsOf(exchange: string, symbol: string): Array<{
|
|
21
|
+
exchange: string;
|
|
22
|
+
symbol: string;
|
|
23
|
+
}>;
|
|
24
|
+
/** Whether a pin is one literal market: the exchange and symbol spellings above, and the
|
|
25
|
+
* expression parser reading the pair as exactly one market, that market. The k-ohlcv control
|
|
26
|
+
* concatenates `exchange|symbol` into a transformation expression and the worker asks one
|
|
27
|
+
* request per market the parser extracts, so a symbol carrying an operator and a second market
|
|
28
|
+
* would reach that market's data under the pin's declared exchange. A pin that fails refuses
|
|
29
|
+
* with the sheet contract's code (`WRUN_PIN_SYMBOL_LITERAL_CODE`, om owns it). */
|
|
30
|
+
export declare function wrunPinMarketIsLiteral(exchange: string, symbol: string): boolean;
|
|
31
|
+
export type WrunPinVenueVerdict = 'served' | 'refused' | 'unserved' | 'unknown';
|
|
32
|
+
/** Whether the chart's lanes can ask a venue word: a member of the wire's exchange enum
|
|
33
|
+
* (`Exchange`, the table the symbol search derives its venues from and every series ask maps
|
|
34
|
+
* the word through; `getExchangeFromSymbol` hands the K_OHLCV worker an enum name), never a
|
|
35
|
+
* stock listing the query layer rejects since the polygon-exchange flip (`normalizeLegacyExchange`
|
|
36
|
+
* moves NASDAQ, NYSE, CBOE and their siblings to POLYGON on persisted records; a SAVED pin is never
|
|
37
|
+
* rewritten: wrun-pin-spelling.util respells the run's copy). Exact, as the wire reads the word. */
|
|
38
|
+
export declare function wrunPinVenueOnWire(exchange: string): boolean;
|
|
39
|
+
/** What the chart does with a pin on `exchange`: `refused` (a CME Group venue, by name, the run
|
|
40
|
+
* does not start), `unserved` (an index venue the gateway does not serve to scripts yet, the
|
|
41
|
+
* leg soft-refused), `unknown` (a venue word the chart's lanes cannot ask, `wrunPinVenueOnWire`:
|
|
42
|
+
* by name, the run does not start), `served` (everything else; an absent exchange is the chart's
|
|
43
|
+
* own market). */
|
|
44
|
+
export declare function wrunPinVenueVerdict(exchange: string | undefined): WrunPinVenueVerdict;
|
|
45
|
+
/** The unknown venue's words: the input, then the sheet contract's own message (the text om's
|
|
46
|
+
* sheet check writes for the same word, `wrun_pin_venue_unknown: venue '<word>' ...`). */
|
|
47
|
+
export declare function wrunPinVenueUnknownMessage(inputName: string, exchange: string): string;
|
|
48
|
+
/** The venue word of a symbol setting's `EXCHANGE:SYMBOL` text (split at the first colon, as
|
|
49
|
+
* `wrunSheetWithSettings` paints it onto the bound inputs) when its verdict is `unknown`, else
|
|
50
|
+
* undefined: the settings row says the run's words for it. Reads the shared host (the CME check
|
|
51
|
+
* first), so the caller loads it. */
|
|
52
|
+
export declare function wrunSymbolSettingUnknownVenue(text: string): string | undefined;
|
|
53
|
+
/** The refusal's words: the input, then the sheet contract's own message (the same text the om
|
|
54
|
+
* prebuild writes at declaration time and the sheet check at validation). */
|
|
55
|
+
export declare function wrunPinVenueRefusalMessage(inputName: string, exchange: string): string;
|
|
56
|
+
/** A pinned leg's refusal: the technical words (the error's message) and the record's seed. */
|
|
57
|
+
export interface WrunPinnedLegRefusal {
|
|
58
|
+
message: string;
|
|
59
|
+
seed: WrunRefusalSeed;
|
|
60
|
+
}
|
|
61
|
+
/** The failed-run seed of an unknown venue: its own words (the venue named), and the settings as
|
|
62
|
+
* the way out when a symbol setting holds the market (a served pick fixes it), else the class's
|
|
63
|
+
* ladder (the source, else the report). */
|
|
64
|
+
export declare function wrunPinVenueUnknownSeed(venue: string, settingBound: boolean): WrunRefusalSeed;
|
|
65
|
+
/** The refusal a pinned leg earns before any fetch, with its record's seed, or null when it is
|
|
66
|
+
* served; the one point the run pass judges every leg at (the tick's reconcile re-asks only legs
|
|
67
|
+
* that passed here):
|
|
68
|
+
* - every market the expression parser extracts from the pin's `exchange|symbol` gets the venue
|
|
69
|
+
* verdict (a CME Group market hidden behind a served exchange refuses by the contract's words):
|
|
70
|
+
* `pin-refused`, the refused market's symbol as `pin` (its exchange when it names none);
|
|
71
|
+
* - a pin that is not one literal market refuses (`WRUN_PIN_SYMBOL_LITERAL_CODE`): a failed run;
|
|
72
|
+
* - a literal market on a venue word the chart's lanes cannot ask refuses
|
|
73
|
+
* (`WRUN_PIN_VENUE_UNKNOWN_CODE`): a failed run, its way out the settings when `settingBound`
|
|
74
|
+
* (a symbol setting holds the market);
|
|
75
|
+
* - a multi-day leg shorter than a week on a session venue, the pinned market's or the chart's
|
|
76
|
+
* own, refuses (`WRUN_PIN_SESSION_INTERVAL_UNSERVED_CODE`): a failed run.
|
|
77
|
+
* An own-market leg (no `market`) is the chart's own venue: never a pin for the first three rules. */
|
|
78
|
+
export declare function wrunPinnedLegRefusalOf(leg: Pick<WrunPinnedLeg, 'market' | 'intervalKey' | 'legMs'>, inputName: string, chartExchange: string | undefined, settingBound?: boolean): WrunPinnedLegRefusal | null;
|
|
79
|
+
/** The words of `wrunPinnedLegRefusalOf`, or null when the leg is served. */
|
|
80
|
+
export declare function wrunPinnedLegRefusal(leg: Pick<WrunPinnedLeg, 'market' | 'intervalKey' | 'legMs'>, inputName: string, chartExchange: string | undefined): string | null;
|
|
81
|
+
/** Refuse by name, before any fetch, the first pinned leg in declaration order that
|
|
82
|
+
* `wrunPinnedLegRefusalOf` refuses (a CME Group market, declared or hidden in an expression
|
|
83
|
+
* symbol; a pin that is not one literal market; a venue word the chart's lanes cannot ask; a
|
|
84
|
+
* multi-day leg on a session venue), the refusal's seed attached to the error. `settingBoundAt`
|
|
85
|
+
* names the inputs a symbol setting pins (`symbol_param`): a leg one of them reads offers the
|
|
86
|
+
* settings as its way out. */
|
|
87
|
+
export declare function assertWrunPinnedLegVenues(legs: ReadonlyArray<WrunPinnedLeg>, inputNameAt: (index: number) => string, chartExchange?: string, settingBoundAt?: (index: number) => boolean): void;
|
|
88
|
+
/** The inputs whose wire consumes THIS leg's fetched rows, by index, ascending: matched by the
|
|
89
|
+
* fetch key each wire reads against the leg's (`wrunWireFetchKey`). A foreign forming view counts
|
|
90
|
+
* for its grid leg only; an own-market forming view, a typed feed and an own-period view never
|
|
91
|
+
* count. A leg with no such reader (the period leg of forming views alone) is skipped by every
|
|
92
|
+
* caller that judges a leg by its readers. */
|
|
93
|
+
export declare function wrunLegFetchedRowReaders(leg: Pick<WrunPinnedLeg, 'fetchKey'>, wires: ReadonlyMap<number, WrunPinnedWire>): number[];
|
|
94
|
+
/** Split the planned legs into the ones the chart serves and the ones on a venue the gateway
|
|
95
|
+
* does not serve to scripts yet (`WRUN_PIN_UNSERVED_EXCHANGES`). `served` keeps the planner's
|
|
96
|
+
* order (every served leg: what a leg without fetched-row readers means is the run pass's leg
|
|
97
|
+
* gate's to decide). The names an unserved leg carries are the inputs that READ its fetched rows
|
|
98
|
+
* (`wrunLegFetchedRowReaders`): an own-market `forming` view folds the primary rows and is left
|
|
99
|
+
* out (it keeps working), a foreign one is named under its grid leg only; a leg with no such
|
|
100
|
+
* reader is dropped silently. Call after `assertWrunPinnedLegVenues`: a refused venue never
|
|
101
|
+
* reaches here. */
|
|
102
|
+
export declare function partitionWrunLegsByVenue(legs: ReadonlyArray<WrunPinnedLeg>, wires: ReadonlyMap<number, WrunPinnedWire>, inputNameAt: (index: number) => string): {
|
|
103
|
+
served: WrunPinnedLeg[];
|
|
104
|
+
unserved: WrunUnservedLeg[];
|
|
105
|
+
};
|
|
106
|
+
/** Whether a leg's ask rides dataFetch's native-rows path: a leg whose market is index mode (its
|
|
107
|
+
* own venue, else the chart's for an own-market leg) or whose chart is, so its rows come back at
|
|
108
|
+
* their own stamps instead of realigned onto the chart's sparse grid (the step `dataFetch`
|
|
109
|
+
* applies in its A-1, A-2 and B-1 cases). A timestamp-mode leg on a timestamp-mode chart keeps
|
|
110
|
+
* the plain ask, byte-identical to before. */
|
|
111
|
+
export declare function wrunLegRidesNativeRows(leg: Pick<WrunPinnedLeg, 'market'>, chartExchange: string | undefined): boolean;
|
|
112
|
+
/** The fetch option a leg's ask spreads in (the full run's lane ask and the tick's reconcile
|
|
113
|
+
* alike): `{ nativeRows: true }` for a leg that rides native rows, else nothing. */
|
|
114
|
+
export declare function wrunLegNativeRowsOption(leg: Pick<WrunPinnedLeg, 'market'>, chartExchange: string | undefined): {
|
|
115
|
+
nativeRows: true;
|
|
116
|
+
} | undefined;
|