@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,371 @@
|
|
|
1
|
+
import { MARKET_CAPABILITIES, ONCHAIN_POOL_CAPABILITIES, } from '../../constants/marketCapabilities.constants.js';
|
|
2
|
+
import { isBlkExchange } from '../blk-market.util.js';
|
|
3
|
+
import { ECONOMIC_EXCHANGES, FRED_EXCHANGE } from '../../constants/economic.constants.js';
|
|
4
|
+
import { isCmeGoverned, normalizeExchangeCode } from './cme-realtime.util.js';
|
|
5
|
+
import { isGovernedPlaneExchange } from '../v2/gate-plane.util.js';
|
|
6
|
+
import { isOmTargetPane } from './om-target.util.js';
|
|
7
|
+
import { poolSymbolPair } from '../pool-symbol.leaf.js';
|
|
8
|
+
/**
|
|
9
|
+
* Single source of truth for mapping kiyotaka exchange codes to `MarketKind`.
|
|
10
|
+
*
|
|
11
|
+
* Replaces the scattered `checkIsTradFi` / `checkIsForex` / etc. predicates
|
|
12
|
+
* + their hardcoded exchange lists. The 9 surviving `checkIs*` predicates
|
|
13
|
+
* (re-exported below) are now thin shims over `getMarketKind`. Codes use
|
|
14
|
+
* the UPPERCASE_UNDERSCORE convention kiyotaka receives from the backend
|
|
15
|
+
* gRPC layer.
|
|
16
|
+
*
|
|
17
|
+
* Unknown exchanges default to `'crypto'` for back-compat — kiyotaka has
|
|
18
|
+
* always implicitly treated unrecognized exchanges as crypto.
|
|
19
|
+
*
|
|
20
|
+
* Browser-safe: zero Vue / store imports. Workers can import directly
|
|
21
|
+
* without pulling in Pinia. Main-thread code that needs the chart's kind
|
|
22
|
+
* by index uses `getChartCapabilities(chartIndex)` from `chart-mode.util.ts`.
|
|
23
|
+
*/
|
|
24
|
+
const EXCHANGE_TO_KIND = {
|
|
25
|
+
// Tradfi equities (US listing venues + ETF issuers exposed by data feed)
|
|
26
|
+
POLYGON: 'tradfi', // post-flip raw vendor code for Polygon-served equities (design doc 2026-07-27)
|
|
27
|
+
US_STOCKS: 'tradfi', // POLYGON's enum alias (id 92); protobuf JSON emits this name
|
|
28
|
+
NYSE: 'tradfi',
|
|
29
|
+
NYSE_AMERICAN: 'tradfi',
|
|
30
|
+
NYSE_NATIONAL: 'tradfi',
|
|
31
|
+
NYSE_ARCA: 'tradfi',
|
|
32
|
+
NYSE_CHICAGO: 'tradfi',
|
|
33
|
+
NASDAQ: 'tradfi',
|
|
34
|
+
NASDAQ_BX: 'tradfi',
|
|
35
|
+
NASDAQ_ISE: 'tradfi',
|
|
36
|
+
NASDAQ_PHILADELPHIA: 'tradfi',
|
|
37
|
+
NASDAQ_PSX: 'tradfi',
|
|
38
|
+
NASDAQ_INT: 'tradfi',
|
|
39
|
+
CBOE: 'tradfi',
|
|
40
|
+
CBOE_EDGA: 'tradfi',
|
|
41
|
+
CBOE_EDGX: 'tradfi',
|
|
42
|
+
CBOE_BYX: 'tradfi',
|
|
43
|
+
CBOE_BZX: 'tradfi',
|
|
44
|
+
IEX: 'tradfi',
|
|
45
|
+
LTSE: 'tradfi',
|
|
46
|
+
MIAX_PEARL: 'tradfi',
|
|
47
|
+
MEMBERS_EXCHANGE: 'tradfi',
|
|
48
|
+
OTC_EQUITY_SECURITY: 'tradfi',
|
|
49
|
+
CONSOLIDATED_TAPE_ASSOCIATION: 'tradfi',
|
|
50
|
+
FINRA: 'tradfi',
|
|
51
|
+
UNLISTED_TRADING_PRIVILEGES: 'tradfi',
|
|
52
|
+
UNKNOWN_EXCHANGE: 'tradfi',
|
|
53
|
+
// ETF issuers (carry equities-flavored data)
|
|
54
|
+
BLACKROCK: 'tradfi',
|
|
55
|
+
FIDELITY: 'tradfi',
|
|
56
|
+
BITWISE: 'tradfi',
|
|
57
|
+
ARK: 'tradfi',
|
|
58
|
+
INVESCO: 'tradfi',
|
|
59
|
+
FRANKLIN: 'tradfi',
|
|
60
|
+
VALKYRIE: 'tradfi',
|
|
61
|
+
WISDOMTREE: 'tradfi',
|
|
62
|
+
// US equity and index options over the OPRA entitlement gate (the FE-owned
|
|
63
|
+
// `'options'` kind; the plane itself is resolved by gate-plane.util).
|
|
64
|
+
OPRA: 'options',
|
|
65
|
+
// Forex
|
|
66
|
+
POLYGON_FX: 'forex',
|
|
67
|
+
FX_OTC: 'forex',
|
|
68
|
+
// Commodity futures
|
|
69
|
+
CBOT: 'commodity',
|
|
70
|
+
ICE: 'commodity',
|
|
71
|
+
NYMEX: 'commodity',
|
|
72
|
+
LBMA: 'commodity',
|
|
73
|
+
PLATTS: 'commodity',
|
|
74
|
+
COMEX: 'commodity',
|
|
75
|
+
LME: 'commodity',
|
|
76
|
+
// Economic series: FRED plus the ECONOMICS catalog venue and the observation
|
|
77
|
+
// publishers (economic.constants.ts owns the list).
|
|
78
|
+
...Object.fromEntries(ECONOMIC_EXCHANGES.map((code) => [code, 'economic'])),
|
|
79
|
+
// Polymarket
|
|
80
|
+
POLYMARKET: 'polymarket',
|
|
81
|
+
// Hip3 (Hyperliquid synthetic derivatives)
|
|
82
|
+
HYPERLIQUID_HIP3: 'hip3',
|
|
83
|
+
// HIP4 (Hyperliquid prediction markets)
|
|
84
|
+
HYPERLIQUID_HIP4: 'hip4',
|
|
85
|
+
// DEX (Uniswap family + sibling AMMs)
|
|
86
|
+
UNISWAP_V2: 'dex',
|
|
87
|
+
UNISWAP_V3: 'dex',
|
|
88
|
+
UNISWAP_V4: 'dex',
|
|
89
|
+
SUSHISWAP_V2: 'dex',
|
|
90
|
+
SUSHISWAP_V3: 'dex',
|
|
91
|
+
SHIBASWAP: 'dex',
|
|
92
|
+
PANCAKESWAP_V2: 'dex',
|
|
93
|
+
PANCAKESWAP_V3: 'dex',
|
|
94
|
+
FRAXSWAP: 'dex',
|
|
95
|
+
SOLIDLY: 'dex',
|
|
96
|
+
SOLIDLY_V3: 'dex',
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* The one futures policy for every CME-governed exchange. Equivalent to
|
|
100
|
+
* `checkIsFutures`; retained as the spelling used by the many data-plane call
|
|
101
|
+
* sites that read as policy checks rather than kind comparisons.
|
|
102
|
+
*/
|
|
103
|
+
export function isCmeFuturesPolicyActive(exchange) {
|
|
104
|
+
return isCmeGoverned(exchange);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolve the venue's market kind for an exchange code. Case-insensitive;
|
|
108
|
+
* missing or unknown exchanges return `'crypto'`.
|
|
109
|
+
*
|
|
110
|
+
* The governed-venue branch is checked BEFORE the table lookup: CBOT / NYMEX /
|
|
111
|
+
* COMEX are also in EXCHANGE_TO_KIND as `'commodity'`, so a table hit would
|
|
112
|
+
* silently re-enter the legacy commodity treatment at every call site that
|
|
113
|
+
* consults the kind (count fetch, no order flow, no volume overlay).
|
|
114
|
+
*/
|
|
115
|
+
export function getMarketKind(exchange) {
|
|
116
|
+
const code = normalizeExchangeCode(exchange);
|
|
117
|
+
if (!code)
|
|
118
|
+
return 'crypto';
|
|
119
|
+
if (isCmeGoverned(code))
|
|
120
|
+
return 'futures';
|
|
121
|
+
return EXCHANGE_TO_KIND[code] ?? 'crypto';
|
|
122
|
+
}
|
|
123
|
+
/** Launchpad addresses are raw, case-sensitive market identities on the regular trade pipeline. */
|
|
124
|
+
export function isLaunchpadExchange(exchange) {
|
|
125
|
+
const code = normalizeExchangeCode(exchange);
|
|
126
|
+
return code === 'SOLANA_LAUNCHPAD' || code === 'ROBINHOOD_LAUNCHPAD';
|
|
127
|
+
}
|
|
128
|
+
const BASE58_MINT = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
129
|
+
/**
|
|
130
|
+
* The mint a memecoin market trades, or null. Memecoins ride SOLANA_ONCHAIN as
|
|
131
|
+
* per-venue pool series `<mint>/<QUOTE>:<venue>`; tokenized stocks share that
|
|
132
|
+
* exchange with ticker bases, so a base58 mint base is what marks a memecoin.
|
|
133
|
+
*/
|
|
134
|
+
export function memecoinMint(exchange, symbol) {
|
|
135
|
+
if (normalizeExchangeCode(exchange) !== 'SOLANA_ONCHAIN' || !symbol)
|
|
136
|
+
return null;
|
|
137
|
+
const base = poolSymbolPair(symbol)?.base;
|
|
138
|
+
return base && BASE58_MINT.test(base) ? base : null;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Launchpad-only chart behaviour (1s candles, sided bars, served-empty park,
|
|
142
|
+
* quiet-gap carry, COIN-quoted aggregates) applies to a memecoin pool on
|
|
143
|
+
* SOLANA_ONCHAIN exactly as to a launchpad exchange: same burst-traded tokens.
|
|
144
|
+
*/
|
|
145
|
+
export function isLaunchpadMarket(exchange, symbol) {
|
|
146
|
+
return isLaunchpadExchange(exchange) || memecoinMint(exchange, symbol) !== null;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Venues whose live gate emits ONLY sided TRADE_AGG frames. The main-bar
|
|
150
|
+
* branch in live-feed listens for the no-side stream, which for these never
|
|
151
|
+
* arrives, so their forming candle has to be built from the BUY/SELL frames
|
|
152
|
+
* instead. Every gate plane (CME, OPRA) relays the same sided-only lane; the
|
|
153
|
+
* launchpad lanes batch strictly by side too (live-feed's TradeAggBatchers
|
|
154
|
+
* keys on Series.Side, and every on-chain swap carries one), so without the
|
|
155
|
+
* bridge an on-chain chart only moves on refetch — which read as a chart that
|
|
156
|
+
* never moved at all.
|
|
157
|
+
*/
|
|
158
|
+
export function venueEmitsOnlySidedTradeAggregates(exchange, symbol) {
|
|
159
|
+
return isGovernedPlaneExchange(exchange) || isLaunchpadMarket(exchange, symbol);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Venues where a served-empty window is the market's real state, so the blank
|
|
163
|
+
* boot parks on it instead of treating it as a miss worth retrying. Governed
|
|
164
|
+
* venues of every gate plane close (CME sessions, OPRA's regular hours, and
|
|
165
|
+
* an option contract that has not traded yet); a launchpad token that has not
|
|
166
|
+
* traded yet is the same shape — the wire answered honestly and no amount of
|
|
167
|
+
* retrying conjures rows. Without the launchpad arm a zero-swap memecoin never
|
|
168
|
+
* reaches a terminal state: empty responses record no completion, so the
|
|
169
|
+
* retry key is never suppressed and the chart re-asks forever behind
|
|
170
|
+
* "Retrying data request".
|
|
171
|
+
*/
|
|
172
|
+
export function venueParksOnServedEmpty(exchange, symbol) {
|
|
173
|
+
return isGovernedPlaneExchange(exchange) || isLaunchpadMarket(exchange, symbol);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Session-bound venues close (nightly breaks, weekends, holidays), so "old"
|
|
177
|
+
* cached bars at boot are routinely the CURRENT state of the market, not
|
|
178
|
+
* misleading staleness. 24/7 venues (crypto, dex, prediction markets) are the
|
|
179
|
+
* opposite: wall-clock age tracks bars-behind. Cache freshness/paintability
|
|
180
|
+
* rules key on this split instead of any venue calendar (frontend holiday
|
|
181
|
+
* knowledge does not exist, and guessing open/closed would freeze a trading
|
|
182
|
+
* market or thrash a closed one). Unknown venues fail to the conservative
|
|
183
|
+
* 24/7 treatment via getMarketKind's crypto default.
|
|
184
|
+
*/
|
|
185
|
+
export function isSessionBoundMarketKind(exchange) {
|
|
186
|
+
return isSessionBoundKind(getMarketKind(exchange));
|
|
187
|
+
}
|
|
188
|
+
/** Kind-level form of the session-bound split, for call sites that already
|
|
189
|
+
* hold a resolved `VenueMarketKind` (one set, never re-declared). */
|
|
190
|
+
export function isSessionBoundKind(kind) {
|
|
191
|
+
return kind === 'futures' || kind === 'options' || kind === 'commodity' || kind === 'tradfi' || kind === 'forex';
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Venues that trade around the clock (crypto spot and perps, on-chain pools,
|
|
195
|
+
* HIP-3 perps): a wire answer short of its window there is the server behind
|
|
196
|
+
* the tape, never a closed market (synthetic-provenance.util, claims never
|
|
197
|
+
* outrank rows). Session-bound venues, prediction markets and economic series
|
|
198
|
+
* are not: their quiet windows are the market.
|
|
199
|
+
*/
|
|
200
|
+
export function isContinuousTradingKind(kind) {
|
|
201
|
+
return kind === 'crypto' || kind === 'dex' || kind === 'hip3';
|
|
202
|
+
}
|
|
203
|
+
export function isContinuousTradingVenue(exchange) {
|
|
204
|
+
return isContinuousTradingKind(getMarketKind(exchange));
|
|
205
|
+
}
|
|
206
|
+
export function getCapabilities(exchange) {
|
|
207
|
+
// On-chain pools keep the crypto kind (every kind-keyed path treats them as
|
|
208
|
+
// crypto) but not its book and profile surfaces: blk serves neither.
|
|
209
|
+
if (isBlkExchange(exchange))
|
|
210
|
+
return ONCHAIN_POOL_CAPABILITIES;
|
|
211
|
+
// The registry carries every VenueMarketKind (its 'futures' entry IS
|
|
212
|
+
// CME_FUTURES_CAPABILITIES), so the kind lookup needs no special case.
|
|
213
|
+
return MARKET_CAPABILITIES[getMarketKind(exchange)];
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Whether an interval switch must re-run every mounted indicator's
|
|
217
|
+
* `synchronizeOverlays` hook. The hook re-derives interval-scoped settings
|
|
218
|
+
* (profile bucket geometry via barHeight/minimumBarHeight, per-candle
|
|
219
|
+
* session grouping, orderbook block sizes), and those indicators exist only
|
|
220
|
+
* on venues served by the V2 TSDB pipeline: `fetchMode: 'period'`. Count-mode
|
|
221
|
+
* venues (tradfi/forex/commodity/dex) mount none of them. Keyed on fetchMode
|
|
222
|
+
* rather than barTimestamps because CME futures have irregular session bars
|
|
223
|
+
* but full order-flow surfaces: skipping them froze footprint/SVP/TPO bucket
|
|
224
|
+
* settings across interval switches (coarse leftovers render block-sized
|
|
225
|
+
* clusters on a finer chart; fine leftovers render sub-pixel, invisible
|
|
226
|
+
* clusters on a coarser one).
|
|
227
|
+
*/
|
|
228
|
+
export function supportsIntervalScopedIndicatorSync(exchange) {
|
|
229
|
+
return getCapabilities(exchange).fetchMode === 'period';
|
|
230
|
+
}
|
|
231
|
+
// `getChartCapabilities(chartIndex)` lives in `chart-mode.util.ts` (main-
|
|
232
|
+
// thread only); keeping it out of this file avoids pulling Pinia into the
|
|
233
|
+
// worker bundle — workers can import `getMarketKind` / `getCapabilities`
|
|
234
|
+
// directly without contamination.
|
|
235
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
236
|
+
// `checkIs*` shims. Thin wrappers over `getMarketKind`, retained for the
|
|
237
|
+
// many existing callers; new code should prefer `getMarketKind(ex) === 'X'`.
|
|
238
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
239
|
+
export function checkIsTradFi(exchange) {
|
|
240
|
+
return getMarketKind(exchange) === 'tradfi';
|
|
241
|
+
}
|
|
242
|
+
// Polygon-served equity venues. Distinct from `'tradfi'` kind (which also
|
|
243
|
+
// covers FINRA, MIAX, ETF issuers like BLACKROCK / BITWISE, etc.) because
|
|
244
|
+
// `checkIsPolygon` callers want "Polygon data feed" specifically — those
|
|
245
|
+
// other tradfi codes are served by separate flows.
|
|
246
|
+
const POLYGON_VENUES = new Set(['NYSE', 'NASDAQ', 'CBOE', 'POLYGON', 'US_STOCKS']);
|
|
247
|
+
export function checkIsPolygon(exchange) {
|
|
248
|
+
const code = normalizeExchangeCode(exchange);
|
|
249
|
+
return code !== null && POLYGON_VENUES.has(code);
|
|
250
|
+
}
|
|
251
|
+
export function checkIsForex(exchange) {
|
|
252
|
+
return getMarketKind(exchange) === 'forex';
|
|
253
|
+
}
|
|
254
|
+
export function checkIsCommodity(exchange) {
|
|
255
|
+
return getMarketKind(exchange) === 'commodity';
|
|
256
|
+
}
|
|
257
|
+
export function checkIsFutures(exchange) {
|
|
258
|
+
return getMarketKind(exchange) === 'futures';
|
|
259
|
+
}
|
|
260
|
+
export function checkIsForexOrCommodity(exchange) {
|
|
261
|
+
const kind = getMarketKind(exchange);
|
|
262
|
+
return kind === 'forex' || kind === 'commodity';
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The legacy forex/commodity venue family WITH governed futures riding along.
|
|
266
|
+
* For gates that guard session-market semantics or a legacy treatment that must
|
|
267
|
+
* keep matching governed venues: returns what `checkIsForexOrCommodity` returned
|
|
268
|
+
* for CBOT / NYMEX / COMEX before the futures kind existed, and additionally
|
|
269
|
+
* covers CME / GLOBEX, which were never in the commodity table. Sites that
|
|
270
|
+
* instead mean "data-poor venue with no volume/book" keep the bare
|
|
271
|
+
* `checkIsForexOrCommodity`, which correctly frees governed futures.
|
|
272
|
+
*/
|
|
273
|
+
export function checkIsForexCommodityOrFutures(exchange) {
|
|
274
|
+
const kind = getMarketKind(exchange);
|
|
275
|
+
return kind === 'forex' || kind === 'commodity' || kind === 'futures';
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Narrow the FE kind to TitanCharts' `MarketKind` union at the engine
|
|
279
|
+
* boundary. `'futures'` maps to `'commodity'` for session handling; `'hip4'`
|
|
280
|
+
* maps to `'polymarket'` for the prediction renderer; `'economic'` maps to
|
|
281
|
+
* the engine's `'fred'` (single-value series treatment). FE-internal code
|
|
282
|
+
* always sees the honest venue kind.
|
|
283
|
+
*/
|
|
284
|
+
export function toTitanMarketKind(kind) {
|
|
285
|
+
if (kind === 'futures' || kind === 'options')
|
|
286
|
+
return 'commodity';
|
|
287
|
+
if (kind === 'hip4')
|
|
288
|
+
return 'polymarket';
|
|
289
|
+
if (kind === 'economic')
|
|
290
|
+
return 'fred';
|
|
291
|
+
return kind;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* True when TitanCharts must omit the dedicated 'volume' legend overlay:
|
|
295
|
+
* economic series and forex/commodity venues ship no per-bar volume. Governed
|
|
296
|
+
* CME futures DO ship contracts volume on TRADE_AGG bars, so they keep it.
|
|
297
|
+
*/
|
|
298
|
+
export function venueOmitsVolumeOverlay(exchange) {
|
|
299
|
+
return checkIsEconomic(exchange) || checkIsForexOrCommodity(exchange);
|
|
300
|
+
}
|
|
301
|
+
export function checkIsDex(exchange) {
|
|
302
|
+
return getMarketKind(exchange) === 'dex';
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Economic series venue: FRED, the ECONOMICS catalog venue and the observation
|
|
306
|
+
* publishers. Accepts an exchange code or an already-resolved kind, so call
|
|
307
|
+
* sites holding either need no second predicate.
|
|
308
|
+
*/
|
|
309
|
+
export function checkIsEconomic(exchangeOrKind) {
|
|
310
|
+
if (exchangeOrKind === 'economic')
|
|
311
|
+
return true;
|
|
312
|
+
return getMarketKind(exchangeOrKind) === 'economic';
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* The wire path of an economic venue: `'fred'` keeps `FRED_OBSERVATION_AGG`,
|
|
316
|
+
* every other economic exchange rides the raw `OBSERVATION` type (C12).
|
|
317
|
+
* Gate on `checkIsEconomic` first; a non-economic code answers `'observation'`.
|
|
318
|
+
*/
|
|
319
|
+
export function economicSource(exchange) {
|
|
320
|
+
return normalizeExchangeCode(exchange) === FRED_EXCHANGE ? 'fred' : 'observation';
|
|
321
|
+
}
|
|
322
|
+
/** @deprecated FRED is one economic source of several; use `checkIsEconomic`. */
|
|
323
|
+
export function checkIsFred(exchange) {
|
|
324
|
+
return checkIsEconomic(exchange);
|
|
325
|
+
}
|
|
326
|
+
export function checkIsOmTarget(metadata) {
|
|
327
|
+
return isOmTargetPane(metadata);
|
|
328
|
+
}
|
|
329
|
+
export function checkIsHip3(exchange) {
|
|
330
|
+
return getMarketKind(exchange) === 'hip3';
|
|
331
|
+
}
|
|
332
|
+
export function checkIsHip4(exchange) {
|
|
333
|
+
return getMarketKind(exchange) === 'hip4';
|
|
334
|
+
}
|
|
335
|
+
export function checkIsPolymarket(exchange) {
|
|
336
|
+
return getMarketKind(exchange) === 'polymarket';
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Session-gap widening for wall-clock scan windows that MEAN "N bars".
|
|
340
|
+
*
|
|
341
|
+
* A window sized as N x interval only yields N bars on a 24/7 venue. CME
|
|
342
|
+
* Globex trades ~23h x 5 days = ~115 of every 168 wall hours, so the same
|
|
343
|
+
* window on a session-bound venue under-fills by ~1.46x before holidays
|
|
344
|
+
* (the multimode/backfill/default windows that shipped this way served ~107
|
|
345
|
+
* bars where 250 were intended, 2026-08-10). 1.75 covers the weekend+nightly
|
|
346
|
+
* deficit plus holiday/maintenance margin. The widened value is a SCAN bound
|
|
347
|
+
* only: callers keep their bar-count limit, so a 24/7 venue (factor 1) and
|
|
348
|
+
* the row count served are unchanged; a session-bound venue simply scans far
|
|
349
|
+
* enough back to actually find its N bars. Count-mode venues (tradfi/forex/
|
|
350
|
+
* commodity) never derive windows from bar counts, so in practice this
|
|
351
|
+
* governs the gate planes (CME futures here, OPRA options below).
|
|
352
|
+
*/
|
|
353
|
+
export const SESSION_GAP_SCAN_FACTOR = 1.75;
|
|
354
|
+
/**
|
|
355
|
+
* The same widening for the `'options'` kind (OPRA). US equity and index
|
|
356
|
+
* options trade the regular session only, 09:30 to 16:00 New York on
|
|
357
|
+
* weekdays: about 34 of every 168 wall hours (6.5 h x 5, plus the index
|
|
358
|
+
* roots' few extended minutes), so an N-bar window under-fills by
|
|
359
|
+
* 168 / 34 = ~4.9x before holidays. 6 keeps CME's ~1.2x headroom over the raw
|
|
360
|
+
* ratio (1.75 over 1.46) for holidays and early closes. Still a scan bound
|
|
361
|
+
* only: the bar-count limit and the rows served are unchanged.
|
|
362
|
+
*/
|
|
363
|
+
export const OPTIONS_SESSION_GAP_SCAN_FACTOR = 6;
|
|
364
|
+
export function widenScanPeriodForSessionGaps(exchange, periodSec) {
|
|
365
|
+
if (!Number.isFinite(periodSec) || periodSec <= 0)
|
|
366
|
+
return periodSec;
|
|
367
|
+
const kind = getMarketKind(exchange);
|
|
368
|
+
if (!isSessionBoundKind(kind))
|
|
369
|
+
return periodSec;
|
|
370
|
+
return Math.ceil(periodSec * (kind === 'options' ? OPTIONS_SESSION_GAP_SCAN_FACTOR : SESSION_GAP_SCAN_FACTOR));
|
|
371
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE answer to "may this run read the OPRA plane" (UW-PARITY source contract v2, global rule 6):
|
|
3
|
+
* an official run (an OpenMarket package, any first-party run) always; a draft or community run only
|
|
4
|
+
* while the `opra-user-scripts` flag opened the plane to it (`isOpraUserScriptRun`,
|
|
5
|
+
* kscript-venue-policy.util). Every OPRA door reads it: the data wall and Door C through
|
|
6
|
+
* `isOpraReadableKScriptRun`, the wrun run head, the options chain decision, each source lane's
|
|
7
|
+
* refusal (`opra-official-only:<class>`) and the poll and row lanes' plan context.
|
|
8
|
+
*
|
|
9
|
+
* A LEAF on purpose (no imports): the poll-lane and row-lane planners sit on the row builder's import
|
|
10
|
+
* graph, and the venue policy is worker-safe; both read this without reaching each other.
|
|
11
|
+
*/
|
|
12
|
+
/** The two facts the decision reads, as a run's head holds them: absent reads false (fail closed). */
|
|
13
|
+
export interface OpraReadFacts {
|
|
14
|
+
/** A first-party run (an OpenMarket package: `isOfficialWrunOverlay`; any first-party kScript run). */
|
|
15
|
+
official?: boolean;
|
|
16
|
+
/** A browser user run the `opra-user-scripts` flag opened the OPRA plane to (`isOpraUserScriptRun`). */
|
|
17
|
+
opraUserScripts?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** May the run the facts describe read the OPRA plane. */
|
|
20
|
+
export declare function mayReadOpra(facts: OpraReadFacts | null | undefined): boolean;
|
|
21
|
+
/** The payload field a source ask carries when it reads the OPRA plane beyond its own exchange (a wrun lane
|
|
22
|
+
* asking a stock chart's options on the native-rows path: its `exchange` is the stock's placeholder). Door C
|
|
23
|
+
* judges such an ask as an OPRA one. */
|
|
24
|
+
export declare const WRUN_PLANE_PAYLOAD_KEY = "wrunPlane";
|
|
25
|
+
/** Whether a source payload names the OPRA plane it reads (`WRUN_PLANE_PAYLOAD_KEY`). */
|
|
26
|
+
export declare function payloadReadsOpraPlane(payload: unknown): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE answer to "may this run read the OPRA plane" (UW-PARITY source contract v2, global rule 6):
|
|
3
|
+
* an official run (an OpenMarket package, any first-party run) always; a draft or community run only
|
|
4
|
+
* while the `opra-user-scripts` flag opened the plane to it (`isOpraUserScriptRun`,
|
|
5
|
+
* kscript-venue-policy.util). Every OPRA door reads it: the data wall and Door C through
|
|
6
|
+
* `isOpraReadableKScriptRun`, the wrun run head, the options chain decision, each source lane's
|
|
7
|
+
* refusal (`opra-official-only:<class>`) and the poll and row lanes' plan context.
|
|
8
|
+
*
|
|
9
|
+
* A LEAF on purpose (no imports): the poll-lane and row-lane planners sit on the row builder's import
|
|
10
|
+
* graph, and the venue policy is worker-safe; both read this without reaching each other.
|
|
11
|
+
*/
|
|
12
|
+
/** May the run the facts describe read the OPRA plane. */
|
|
13
|
+
export function mayReadOpra(facts) {
|
|
14
|
+
return facts?.official === true || facts?.opraUserScripts === true;
|
|
15
|
+
}
|
|
16
|
+
/** The payload field a source ask carries when it reads the OPRA plane beyond its own exchange (a wrun lane
|
|
17
|
+
* asking a stock chart's options on the native-rows path: its `exchange` is the stock's placeholder). Door C
|
|
18
|
+
* judges such an ask as an OPRA one. */
|
|
19
|
+
export const WRUN_PLANE_PAYLOAD_KEY = 'wrunPlane';
|
|
20
|
+
/** Whether a source payload names the OPRA plane it reads (`WRUN_PLANE_PAYLOAD_KEY`). */
|
|
21
|
+
export function payloadReadsOpraPlane(payload) {
|
|
22
|
+
return (payload !== null &&
|
|
23
|
+
typeof payload === 'object' &&
|
|
24
|
+
payload[WRUN_PLANE_PAYLOAD_KEY] === 'opra');
|
|
25
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prediction-market outcome identity: the venue-neutral series-key primitives,
|
|
3
|
+
* plus the binary-complement synthesis built on them.
|
|
4
|
+
*
|
|
5
|
+
* ONE decision core for an outcome's series key — use `getMarketSeriesKey` for a
|
|
6
|
+
* market object, `resolveOutcomeSeriesKey` for an identifier string, rather than
|
|
7
|
+
* re-deriving the precedence at a call site.
|
|
8
|
+
*
|
|
9
|
+
* DELIBERATELY A LEAF: pure, with type-only imports alone, so workers and node
|
|
10
|
+
* specs can import identity without the prediction pipeline behind it. Keep it
|
|
11
|
+
* that way.
|
|
12
|
+
*/
|
|
13
|
+
import type { IPolymarketPredictionMarket, PredictionMarketMetadata } from '../../interfaces/prediction-market.interface.js';
|
|
14
|
+
/** The chart facts `isMarketsEligible` reads: structurally the workspace chart (`IChartTemplate`, chart.interface.ts). */
|
|
15
|
+
interface MarketsEligibleChart {
|
|
16
|
+
metadata?: {
|
|
17
|
+
polymarketMetadata?: Pick<PredictionMarketMetadata, 'predictionMarkets'>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare const HIP4_EXCHANGE_NAME = "HYPERLIQUID_HIP4";
|
|
21
|
+
/** Canonical venue list. index-mode's `PREDICTION_MARKET_EXCHANGES` derives from this. */
|
|
22
|
+
export declare const PREDICTION_MARKET_EXCHANGE_NAMES: readonly ["POLYMARKET", "HYPERLIQUID_HIP4"];
|
|
23
|
+
/**
|
|
24
|
+
* Worker-safe venue check; main-thread code has `checkIsPredictionMarket`.
|
|
25
|
+
* Case-insensitive to match it — a venue gate must not turn on the casing of
|
|
26
|
+
* the exchange string it happens to be handed.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isPredictionExchangeName(exchange: string | undefined | null): boolean;
|
|
29
|
+
export declare function isMarketsEligible(chart: MarketsEligibleChart | null | undefined): boolean;
|
|
30
|
+
export interface OutcomeIdentity {
|
|
31
|
+
conditionId?: string;
|
|
32
|
+
/** Generic on-chain id (e.g. a HIP-4 coin_id) — what new venues populate. */
|
|
33
|
+
tokenId?: string;
|
|
34
|
+
slug?: string;
|
|
35
|
+
}
|
|
36
|
+
type IdentifiableMarket = OutcomeIdentity & {
|
|
37
|
+
slug: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* An outcome's backend series key: its `rawSymbol` in StreamPoints and its
|
|
41
|
+
* orderbook / live-feed subscribe key. The precedence tracks the data model —
|
|
42
|
+
* Polymarket populates `conditionId`, newer venues `tokenId`, and the two are
|
|
43
|
+
* mutually exclusive in practice.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getMarketSeriesKey(market: OutcomeIdentity | null | undefined): string;
|
|
46
|
+
export declare function buildPredictionDataTransformations(exchange: string, seriesKey: string): string;
|
|
47
|
+
/** Outcome wire-key shapes shared by the two prediction venues; event slugs and complement sentinels are excluded. */
|
|
48
|
+
export declare function isPredictionSeriesKey(value: unknown): value is string;
|
|
49
|
+
/**
|
|
50
|
+
* The venue a series key belongs to, read off its wire shape: Polymarket keys are
|
|
51
|
+
* conditionIds (`0x…`), HIP-4 keys are tokenIds (`#…`). `null` for anything else
|
|
52
|
+
* (event slugs, complement sentinels are unwrapped first).
|
|
53
|
+
*/
|
|
54
|
+
export declare function inferPredictionVenueFromSeriesKey(seriesKey: string | undefined | null): string | null;
|
|
55
|
+
/**
|
|
56
|
+
* The short human label for one outcome: the outcome name (`groupItemTitle`,
|
|
57
|
+
* "No change" / "Dortmund"), else the market question, else the identifier
|
|
58
|
+
* itself. Legends, axis pills and ticker chips read this; `getPolymarketQuestion`
|
|
59
|
+
* stays the long-form (tooltip) copy, which on HIP-4 is the event title shared by
|
|
60
|
+
* every outcome and so cannot tell outcomes apart.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getPredictionOutcomeLabel(identifier: string, predictionMarkets: Array<{
|
|
63
|
+
slug: string;
|
|
64
|
+
question?: string;
|
|
65
|
+
groupItemTitle?: string;
|
|
66
|
+
}> | undefined): string;
|
|
67
|
+
/** `question` is in the search because `synchronizeOverlays` stores a symbol as one. */
|
|
68
|
+
export declare function findMarketByIdentifier<T extends IdentifiableMarket & {
|
|
69
|
+
question?: string;
|
|
70
|
+
}>(identifier: string, predictionMarkets: T[] | undefined): {
|
|
71
|
+
market: T;
|
|
72
|
+
index: number;
|
|
73
|
+
} | null;
|
|
74
|
+
/**
|
|
75
|
+
* Normalize any stored identifier to its series key, or pass it through unchanged.
|
|
76
|
+
*
|
|
77
|
+
* Match slugs, condition IDs, token IDs, and stored questions through
|
|
78
|
+
* `findMarketByIdentifier`, then derive the backend key from the market.
|
|
79
|
+
* HIP4 outcomes have empty slugs, so slug-only lookup cannot identify them.
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveOutcomeSeriesKey(identifier: string, predictionMarkets: IdentifiableMarket[] | undefined): string;
|
|
82
|
+
/**
|
|
83
|
+
* The backend series a stored outcome identifier subscribes to. A synthesized
|
|
84
|
+
* complement has none of its own, so it resolves to its primary's — the sentinel
|
|
85
|
+
* must never reach the backend.
|
|
86
|
+
*/
|
|
87
|
+
export declare function resolveBackendSeriesKey(identifier: string, predictionMarkets: IdentifiableMarket[] | undefined): string;
|
|
88
|
+
/**
|
|
89
|
+
* The outcome snapshot the orderbook widgets persist in their own settings, so a
|
|
90
|
+
* widget keeps working identity (and its complement flags) after init, when it no
|
|
91
|
+
* longer reads chart metadata. ONE shape for all of them — a field added here
|
|
92
|
+
* reaches every widget rather than six of nine.
|
|
93
|
+
*/
|
|
94
|
+
export declare function toStoredPredictionMarket(market: {
|
|
95
|
+
slug: string;
|
|
96
|
+
conditionId?: string;
|
|
97
|
+
tokenId?: string;
|
|
98
|
+
isComplement?: boolean;
|
|
99
|
+
complementOf?: string;
|
|
100
|
+
question: string;
|
|
101
|
+
groupItemTitle?: string;
|
|
102
|
+
lastPrice?: number;
|
|
103
|
+
closed?: boolean;
|
|
104
|
+
}): IPolymarketPredictionMarket;
|
|
105
|
+
/** The selected outcome's series key, falling back to the leading market's. */
|
|
106
|
+
export declare function seriesKeyAtOutcomeIndex(markets: OutcomeIdentity[], index: number): string;
|
|
107
|
+
/**
|
|
108
|
+
* The outcome a single-market chart mode should land on: the one already
|
|
109
|
+
* selected, else the event's leading outcome supplied by the caller.
|
|
110
|
+
*
|
|
111
|
+
* ONE decider for every single-market entry point — the chart-type selector and
|
|
112
|
+
* the super-search chart-style command, across their candle-family, footprint
|
|
113
|
+
* and TPO flows. Never read `.slug` here: a HIP-4 outcome's slug is always `""`,
|
|
114
|
+
* so a slug read gave every outcome the same empty identity and the caller's
|
|
115
|
+
* `if (target)` guard then dropped the interaction silently.
|
|
116
|
+
*
|
|
117
|
+
* `null` means "no prediction outcome to target" — the caller must still honour
|
|
118
|
+
* the user's pick rather than bail on it.
|
|
119
|
+
*/
|
|
120
|
+
export declare function resolveTargetOutcomeKey(selectedOutcomes: string[], leadingOutcome: OutcomeIdentity | null | undefined): string | null;
|
|
121
|
+
export declare function mapIdentifiersToSeriesKeys(identifiers: string[], predictionMarkets: IdentifiableMarket[] | undefined): string[];
|
|
122
|
+
export declare function getPolymarketQuestion(identifier: string, predictionMarkets: Array<{
|
|
123
|
+
slug: string;
|
|
124
|
+
question?: string;
|
|
125
|
+
}> | undefined): string;
|
|
126
|
+
export declare function makeComplementKey(primarySeriesKey: string): string;
|
|
127
|
+
export declare function isComplementKey(seriesKey: string | undefined | null): boolean;
|
|
128
|
+
export declare function primaryKeyOfComplement(complementKey: string): string;
|
|
129
|
+
export declare function invertProbability(p: number): number;
|
|
130
|
+
/**
|
|
131
|
+
* Invert a `[time, open, high, low, close, volume]` row. Inversion is
|
|
132
|
+
* monotonically decreasing, so high and low swap rather than mapping in place.
|
|
133
|
+
*/
|
|
134
|
+
export declare function invertProbabilityCandle(row: readonly number[]): number[];
|
|
135
|
+
/** Project raw OHLCV at the display boundary without mutating rows shared by other consumers. */
|
|
136
|
+
export declare function projectOhlcvRow(row: number[], projection: 'identity' | 'complement'): number[];
|
|
137
|
+
export declare function projectOhlcvRow(row: readonly number[], projection: 'identity' | 'complement'): readonly number[];
|
|
138
|
+
/**
|
|
139
|
+
* Append the synthesized second side, priced and plotted as `1 − primary`, so
|
|
140
|
+
* both render as selectable outcomes.
|
|
141
|
+
*/
|
|
142
|
+
/**
|
|
143
|
+
* The sub-market a list row displays (probability, sparkline, leader label):
|
|
144
|
+
* the highest last price among the REAL outcomes of the event. A synthesized
|
|
145
|
+
* complement (the NO side of a binary event, appendBinaryComplement) is never
|
|
146
|
+
* a candidate: it is the same market read from the other side, and a row
|
|
147
|
+
* reads the YES side the way Polymarket rows do, or a 4% YES shows as "96%"
|
|
148
|
+
* with the NO line under it. Ties keep the first market; an event with only
|
|
149
|
+
* complement sides (never built) falls back to them.
|
|
150
|
+
*/
|
|
151
|
+
export declare function pickLeadingPredictionMarket<T extends {
|
|
152
|
+
lastPrice?: number | null;
|
|
153
|
+
isComplement?: boolean;
|
|
154
|
+
tokenId?: string;
|
|
155
|
+
conditionId?: string;
|
|
156
|
+
slug?: string;
|
|
157
|
+
}>(markets: T[] | null | undefined): T | null;
|
|
158
|
+
export declare function appendBinaryComplement(predictionMarkets: PredictionMarketMetadata['predictionMarkets'], venueSynthesizesComplement: boolean): PredictionMarketMetadata['predictionMarkets'];
|
|
159
|
+
export {};
|