@orangecharts/wrun-chart-host 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -6
- package/dist/constants/common.constants.d.ts +15 -0
- package/dist/constants/common.constants.js +23 -0
- package/dist/constants/data-source.constants.d.ts +1 -0
- package/dist/constants/data-source.constants.js +1 -0
- package/dist/constants/economic.constants.d.ts +39 -0
- package/dist/constants/economic.constants.js +77 -0
- package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
- package/dist/constants/etf-covered-coins.constants.js +9 -0
- package/dist/constants/feature-flags.constants.d.ts +60 -0
- package/dist/constants/feature-flags.constants.js +308 -0
- package/dist/constants/feature-limits.constants.d.ts +134 -0
- package/dist/constants/feature-limits.constants.js +155 -0
- package/dist/constants/marketCapabilities.constants.d.ts +87 -0
- package/dist/constants/marketCapabilities.constants.js +213 -0
- package/dist/constants/option-venues.constants.d.ts +100 -0
- package/dist/constants/option-venues.constants.js +167 -0
- package/dist/constants/overlay-data.constants.d.ts +53 -0
- package/dist/constants/overlay-data.constants.js +80 -0
- package/dist/constants/pane-grid.constants.d.ts +15 -0
- package/dist/constants/pane-grid.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +10 -0
- package/dist/constants/venue-presets.constants.js +22 -0
- package/dist/enums/chart.enum.d.ts +68 -0
- package/dist/enums/chart.enum.js +70 -0
- package/dist/helpers/data.helpers.d.ts +2 -0
- package/dist/helpers/data.helpers.js +14 -0
- package/dist/host-env.d.ts +161 -5
- package/dist/host-ports.types.d.ts +446 -0
- package/dist/host-ports.types.js +1 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.js +128 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
- package/dist/interfaces/asset-venue.interface.d.ts +91 -0
- package/dist/interfaces/asset-venue.interface.js +1 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
- package/dist/interfaces/cancel-reason.interface.js +2 -0
- package/dist/interfaces/catalog-display.interface.d.ts +3 -0
- package/dist/interfaces/catalog-display.interface.js +1 -0
- package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
- package/dist/interfaces/cme-realtime.interface.js +46 -0
- package/dist/interfaces/feed.interface.d.ts +80 -0
- package/dist/interfaces/feed.interface.js +7 -0
- package/dist/interfaces/market-kind.interface.d.ts +8 -0
- package/dist/interfaces/market-kind.interface.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
- package/dist/interfaces/opra-realtime.interface.js +105 -0
- package/dist/interfaces/option-instrument.interface.d.ts +32 -0
- package/dist/interfaces/option-instrument.interface.js +1 -0
- package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
- package/dist/interfaces/options-chain-scope.interface.js +7 -0
- package/dist/interfaces/prediction-market.interface.d.ts +88 -0
- package/dist/interfaces/prediction-market.interface.js +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
- package/dist/settings-templates/frvp-fields.d.ts +27 -0
- package/dist/settings-templates/frvp-fields.js +108 -0
- package/dist/settings-templates/index.d.ts +119 -0
- package/dist/settings-templates/index.js +442 -0
- package/dist/settings-templates/indicator-fields.d.ts +56 -0
- package/dist/settings-templates/indicator-fields.js +793 -0
- package/dist/settings-templates/tool-rules.d.ts +59 -0
- package/dist/settings-templates/tool-rules.js +49 -0
- package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
- package/dist/settings-templates/tool-tables.generated.js +1668 -0
- package/dist/utility/blk-market.util.d.ts +5 -0
- package/dist/utility/blk-market.util.js +12 -0
- package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
- package/dist/utility/chart/chart-load-phase.util.js +78 -0
- package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
- package/dist/utility/chart/cme-cache-context.util.js +166 -0
- package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
- package/dist/utility/chart/cme-session-bucket.util.js +343 -0
- package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
- package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
- package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
- package/dist/utility/chart/continuous-contracts.util.js +374 -0
- package/dist/utility/chart/feed-interval.util.d.ts +119 -0
- package/dist/utility/chart/feed-interval.util.js +321 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
- package/dist/utility/chart/footprint-band.util.d.ts +76 -0
- package/dist/utility/chart/footprint-band.util.js +205 -0
- package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
- package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
- package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
- package/dist/utility/chart/formula-calendar.util.js +59 -0
- package/dist/utility/chart/history-wall.util.d.ts +67 -0
- package/dist/utility/chart/history-wall.util.js +87 -0
- package/dist/utility/chart/index-mode.util.d.ts +66 -0
- package/dist/utility/chart/index-mode.util.js +360 -0
- package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
- package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
- package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
- package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
- package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
- package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
- package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
- package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
- package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
- package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
- package/dist/utility/chart/interval-registry.util.d.ts +23 -0
- package/dist/utility/chart/interval-registry.util.js +83 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
- package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
- package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
- package/dist/utility/chart/live-bucket.util.d.ts +66 -0
- package/dist/utility/chart/live-bucket.util.js +165 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
- package/dist/utility/chart/market-session-schedule.util.js +337 -0
- package/dist/utility/chart/marketKind.util.d.ts +181 -0
- package/dist/utility/chart/marketKind.util.js +371 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
- package/dist/utility/chart/opra-read-access.leaf.js +25 -0
- package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
- package/dist/utility/chart/prediction-identity.util.js +236 -0
- package/dist/utility/chart/rth-session.util.d.ts +352 -0
- package/dist/utility/chart/rth-session.util.js +926 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
- package/dist/utility/chart/titan-constants.pin.js +50 -0
- package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
- package/dist/utility/chart/us-equities-session.util.js +251 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
- package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
- package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
- package/dist/utility/common/safe-math-eval.d.ts +18 -0
- package/dist/utility/common/safe-math-eval.js +160 -0
- package/dist/utility/common/time.util.d.ts +134 -0
- package/dist/utility/common/time.util.js +428 -0
- package/dist/utility/common/transformations.util.d.ts +126 -0
- package/dist/utility/common/transformations.util.js +711 -0
- package/dist/utility/common/visible-timeout.util.d.ts +17 -0
- package/dist/utility/common/visible-timeout.util.js +75 -0
- package/dist/utility/exchange-normalization.util.d.ts +8 -0
- package/dist/utility/exchange-normalization.util.js +32 -0
- package/dist/utility/intl-locale.util.d.ts +2 -0
- package/dist/utility/intl-locale.util.js +28 -0
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +50 -19
- package/dist/utility/options/option-symbol.util.d.ts +28 -0
- package/dist/utility/options/option-symbol.util.js +176 -0
- package/dist/utility/options/option-trade-units.util.d.ts +190 -0
- package/dist/utility/options/option-trade-units.util.js +283 -0
- package/dist/utility/options/option-venue.util.d.ts +75 -0
- package/dist/utility/options/option-venue.util.js +85 -0
- package/dist/utility/pool-symbol.leaf.d.ts +34 -0
- package/dist/utility/pool-symbol.leaf.js +95 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
- package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
- package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
- package/dist/utility/v2/gate-plane.util.d.ts +58 -0
- package/dist/utility/v2/gate-plane.util.js +99 -0
- package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
- package/dist/utility/v2/gate-session-latch.util.js +34 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
- package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
- package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/economic.js +79 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
- package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/lanes/index.js +32 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
- package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
- package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
- package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
- package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
- package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
- package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
- package/dist/utility/wrun/sources/lanes/series.js +321 -0
- package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
- package/dist/utility/wrun/sources/registry.d.ts +21 -0
- package/dist/utility/wrun/sources/registry.js +207 -0
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
- package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
- package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
- package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
- package/dist/utility/wrun/wrun-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 +30 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
- package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
- package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
- package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
- package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
- package/dist/utility/wrun/wrun-param-map.util.js +581 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +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-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,236 @@
|
|
|
1
|
+
export const HIP4_EXCHANGE_NAME = 'HYPERLIQUID_HIP4';
|
|
2
|
+
/** Canonical venue list. index-mode's `PREDICTION_MARKET_EXCHANGES` derives from this. */
|
|
3
|
+
export const PREDICTION_MARKET_EXCHANGE_NAMES = ['POLYMARKET', HIP4_EXCHANGE_NAME];
|
|
4
|
+
const PREDICTION_MARKET_EXCHANGE_NAME_SET = new Set(PREDICTION_MARKET_EXCHANGE_NAMES);
|
|
5
|
+
/**
|
|
6
|
+
* Worker-safe venue check; main-thread code has `checkIsPredictionMarket`.
|
|
7
|
+
* Case-insensitive to match it — a venue gate must not turn on the casing of
|
|
8
|
+
* the exchange string it happens to be handed.
|
|
9
|
+
*/
|
|
10
|
+
export function isPredictionExchangeName(exchange) {
|
|
11
|
+
return !!exchange && PREDICTION_MARKET_EXCHANGE_NAME_SET.has(exchange.toUpperCase());
|
|
12
|
+
}
|
|
13
|
+
export function isMarketsEligible(chart) {
|
|
14
|
+
return chart?.metadata?.polymarketMetadata?.predictionMarkets?.some((market) => !!market.sportsMarketType) ?? false;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* An outcome's backend series key: its `rawSymbol` in StreamPoints and its
|
|
18
|
+
* orderbook / live-feed subscribe key. The precedence tracks the data model —
|
|
19
|
+
* Polymarket populates `conditionId`, newer venues `tokenId`, and the two are
|
|
20
|
+
* mutually exclusive in practice.
|
|
21
|
+
*/
|
|
22
|
+
export function getMarketSeriesKey(market) {
|
|
23
|
+
return market?.conditionId || market?.tokenId || market?.slug || '';
|
|
24
|
+
}
|
|
25
|
+
export function buildPredictionDataTransformations(exchange, seriesKey) {
|
|
26
|
+
return `${exchange}|${seriesKey}`;
|
|
27
|
+
}
|
|
28
|
+
/** Outcome wire-key shapes shared by the two prediction venues; event slugs and complement sentinels are excluded. */
|
|
29
|
+
export function isPredictionSeriesKey(value) {
|
|
30
|
+
return typeof value === 'string' && /^(?:#\d+|0x[\da-f]+)$/i.test(value);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The venue a series key belongs to, read off its wire shape: Polymarket keys are
|
|
34
|
+
* conditionIds (`0x…`), HIP-4 keys are tokenIds (`#…`). `null` for anything else
|
|
35
|
+
* (event slugs, complement sentinels are unwrapped first).
|
|
36
|
+
*/
|
|
37
|
+
export function inferPredictionVenueFromSeriesKey(seriesKey) {
|
|
38
|
+
const key = primaryKeyOfComplement(seriesKey ?? '');
|
|
39
|
+
if (/^#\d+$/.test(key))
|
|
40
|
+
return 'HYPERLIQUID_HIP4';
|
|
41
|
+
if (/^0x[\da-f]+$/i.test(key))
|
|
42
|
+
return 'POLYMARKET';
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The short human label for one outcome: the outcome name (`groupItemTitle`,
|
|
47
|
+
* "No change" / "Dortmund"), else the market question, else the identifier
|
|
48
|
+
* itself. Legends, axis pills and ticker chips read this; `getPolymarketQuestion`
|
|
49
|
+
* stays the long-form (tooltip) copy, which on HIP-4 is the event title shared by
|
|
50
|
+
* every outcome and so cannot tell outcomes apart.
|
|
51
|
+
*/
|
|
52
|
+
export function getPredictionOutcomeLabel(identifier, predictionMarkets) {
|
|
53
|
+
if (!predictionMarkets || !identifier)
|
|
54
|
+
return identifier;
|
|
55
|
+
const result = findMarketByIdentifier(primaryKeyOfComplement(identifier), predictionMarkets);
|
|
56
|
+
if (!result)
|
|
57
|
+
return identifier;
|
|
58
|
+
return result.market.groupItemTitle?.trim() || result.market.question?.trim() || identifier;
|
|
59
|
+
}
|
|
60
|
+
/** `question` is in the search because `synchronizeOverlays` stores a symbol as one. */
|
|
61
|
+
export function findMarketByIdentifier(identifier, predictionMarkets) {
|
|
62
|
+
if (!predictionMarkets || !identifier)
|
|
63
|
+
return null;
|
|
64
|
+
for (const field of ['slug', 'conditionId', 'tokenId', 'question']) {
|
|
65
|
+
const index = predictionMarkets.findIndex((m) => m[field] === identifier);
|
|
66
|
+
if (index !== -1)
|
|
67
|
+
return { market: predictionMarkets[index], index };
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Normalize any stored identifier to its series key, or pass it through unchanged.
|
|
73
|
+
*
|
|
74
|
+
* Match slugs, condition IDs, token IDs, and stored questions through
|
|
75
|
+
* `findMarketByIdentifier`, then derive the backend key from the market.
|
|
76
|
+
* HIP4 outcomes have empty slugs, so slug-only lookup cannot identify them.
|
|
77
|
+
*/
|
|
78
|
+
export function resolveOutcomeSeriesKey(identifier, predictionMarkets) {
|
|
79
|
+
const result = findMarketByIdentifier(identifier, predictionMarkets);
|
|
80
|
+
return (result && getMarketSeriesKey(result.market)) || identifier;
|
|
81
|
+
}
|
|
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 function resolveBackendSeriesKey(identifier, predictionMarkets) {
|
|
88
|
+
return primaryKeyOfComplement(resolveOutcomeSeriesKey(identifier, predictionMarkets));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The outcome snapshot the orderbook widgets persist in their own settings, so a
|
|
92
|
+
* widget keeps working identity (and its complement flags) after init, when it no
|
|
93
|
+
* longer reads chart metadata. ONE shape for all of them — a field added here
|
|
94
|
+
* reaches every widget rather than six of nine.
|
|
95
|
+
*/
|
|
96
|
+
export function toStoredPredictionMarket(market) {
|
|
97
|
+
return {
|
|
98
|
+
slug: market.slug,
|
|
99
|
+
conditionId: market.conditionId,
|
|
100
|
+
tokenId: market.tokenId,
|
|
101
|
+
isComplement: market.isComplement,
|
|
102
|
+
complementOf: market.complementOf,
|
|
103
|
+
question: market.question,
|
|
104
|
+
groupItemTitle: market.groupItemTitle,
|
|
105
|
+
lastPrice: market.lastPrice,
|
|
106
|
+
closed: market.closed,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** The selected outcome's series key, falling back to the leading market's. */
|
|
110
|
+
export function seriesKeyAtOutcomeIndex(markets, index) {
|
|
111
|
+
return getMarketSeriesKey(markets[index]) || getMarketSeriesKey(markets[0]);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The outcome a single-market chart mode should land on: the one already
|
|
115
|
+
* selected, else the event's leading outcome supplied by the caller.
|
|
116
|
+
*
|
|
117
|
+
* ONE decider for every single-market entry point — the chart-type selector and
|
|
118
|
+
* the super-search chart-style command, across their candle-family, footprint
|
|
119
|
+
* and TPO flows. Never read `.slug` here: a HIP-4 outcome's slug is always `""`,
|
|
120
|
+
* so a slug read gave every outcome the same empty identity and the caller's
|
|
121
|
+
* `if (target)` guard then dropped the interaction silently.
|
|
122
|
+
*
|
|
123
|
+
* `null` means "no prediction outcome to target" — the caller must still honour
|
|
124
|
+
* the user's pick rather than bail on it.
|
|
125
|
+
*/
|
|
126
|
+
export function resolveTargetOutcomeKey(selectedOutcomes, leadingOutcome) {
|
|
127
|
+
if (selectedOutcomes.length > 0 && !selectedOutcomes.includes('all'))
|
|
128
|
+
return selectedOutcomes[0] || null;
|
|
129
|
+
return getMarketSeriesKey(leadingOutcome) || null;
|
|
130
|
+
}
|
|
131
|
+
export function mapIdentifiersToSeriesKeys(identifiers, predictionMarkets) {
|
|
132
|
+
if (!predictionMarkets)
|
|
133
|
+
return identifiers;
|
|
134
|
+
return identifiers.map((id) => resolveOutcomeSeriesKey(id, predictionMarkets));
|
|
135
|
+
}
|
|
136
|
+
export function getPolymarketQuestion(identifier, predictionMarkets) {
|
|
137
|
+
if (!predictionMarkets || !identifier)
|
|
138
|
+
return identifier;
|
|
139
|
+
const result = findMarketByIdentifier(identifier, predictionMarkets);
|
|
140
|
+
if (result && result.market.question) {
|
|
141
|
+
return result.market.question;
|
|
142
|
+
}
|
|
143
|
+
return identifier;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* A binary event can arrive from StreamMarkets as a SINGLE market: both sides in
|
|
147
|
+
* `outcomes[]`, one real series, `lastPrice = P(outcomes[0])`. The second side
|
|
148
|
+
* exists only as `1 − P`, with no series of its own.
|
|
149
|
+
*
|
|
150
|
+
* It is synthesized as an outcome whose series key is a sentinel encoding the
|
|
151
|
+
* primary's real key. That key is still unique and well-formed, so the generic
|
|
152
|
+
* plumbing treats it as a normal outcome, while the fetch layer detects the
|
|
153
|
+
* sentinel, fetches the primary's series and inverts the values.
|
|
154
|
+
*/
|
|
155
|
+
const COMPLEMENT_KEY_PREFIX = '~complement:';
|
|
156
|
+
export function makeComplementKey(primarySeriesKey) {
|
|
157
|
+
return `${COMPLEMENT_KEY_PREFIX}${primarySeriesKey}`;
|
|
158
|
+
}
|
|
159
|
+
export function isComplementKey(seriesKey) {
|
|
160
|
+
return !!seriesKey && seriesKey.startsWith(COMPLEMENT_KEY_PREFIX);
|
|
161
|
+
}
|
|
162
|
+
export function primaryKeyOfComplement(complementKey) {
|
|
163
|
+
return isComplementKey(complementKey) ? complementKey.slice(COMPLEMENT_KEY_PREFIX.length) : complementKey;
|
|
164
|
+
}
|
|
165
|
+
export function invertProbability(p) {
|
|
166
|
+
return 1 - p;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Invert a `[time, open, high, low, close, volume]` row. Inversion is
|
|
170
|
+
* monotonically decreasing, so high and low swap rather than mapping in place.
|
|
171
|
+
*/
|
|
172
|
+
export function invertProbabilityCandle(row) {
|
|
173
|
+
const [time, open, high, low, close, volume] = row;
|
|
174
|
+
return [
|
|
175
|
+
time,
|
|
176
|
+
invertProbability(open),
|
|
177
|
+
invertProbability(low),
|
|
178
|
+
invertProbability(high),
|
|
179
|
+
invertProbability(close),
|
|
180
|
+
volume,
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
export function projectOhlcvRow(row, projection) {
|
|
184
|
+
return projection === 'complement' ? invertProbabilityCandle(row) : row;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Append the synthesized second side, priced and plotted as `1 − primary`, so
|
|
188
|
+
* both render as selectable outcomes.
|
|
189
|
+
*/
|
|
190
|
+
/**
|
|
191
|
+
* The sub-market a list row displays (probability, sparkline, leader label):
|
|
192
|
+
* the highest last price among the REAL outcomes of the event. A synthesized
|
|
193
|
+
* complement (the NO side of a binary event, appendBinaryComplement) is never
|
|
194
|
+
* a candidate: it is the same market read from the other side, and a row
|
|
195
|
+
* reads the YES side the way Polymarket rows do, or a 4% YES shows as "96%"
|
|
196
|
+
* with the NO line under it. Ties keep the first market; an event with only
|
|
197
|
+
* complement sides (never built) falls back to them.
|
|
198
|
+
*/
|
|
199
|
+
export function pickLeadingPredictionMarket(markets) {
|
|
200
|
+
if (!markets?.length)
|
|
201
|
+
return null;
|
|
202
|
+
const real = markets.filter((market) => !market.isComplement && !isComplementKey(getMarketSeriesKey(market)));
|
|
203
|
+
const candidates = real.length ? real : markets;
|
|
204
|
+
let leading = null;
|
|
205
|
+
for (const market of candidates) {
|
|
206
|
+
if (!leading || (market.lastPrice || 0) > (leading.lastPrice || 0))
|
|
207
|
+
leading = market;
|
|
208
|
+
}
|
|
209
|
+
return leading;
|
|
210
|
+
}
|
|
211
|
+
export function appendBinaryComplement(predictionMarkets, venueSynthesizesComplement) {
|
|
212
|
+
if (!venueSynthesizesComplement || predictionMarkets.length !== 1)
|
|
213
|
+
return predictionMarkets;
|
|
214
|
+
const primary = predictionMarkets[0];
|
|
215
|
+
const outcomes = primary.outcomes || [];
|
|
216
|
+
if (outcomes.length !== 2)
|
|
217
|
+
return predictionMarkets;
|
|
218
|
+
const primaryKey = getMarketSeriesKey(primary);
|
|
219
|
+
if (!primaryKey || isComplementKey(primaryKey))
|
|
220
|
+
return predictionMarkets;
|
|
221
|
+
const complement = {
|
|
222
|
+
...primary,
|
|
223
|
+
// No real backend identity — the sentinel key is the only one it has.
|
|
224
|
+
slug: '',
|
|
225
|
+
conditionId: '',
|
|
226
|
+
tokenId: makeComplementKey(primaryKey),
|
|
227
|
+
groupItemTitle: outcomes[1],
|
|
228
|
+
question: outcomes[1],
|
|
229
|
+
lastPrice: invertProbability(primary.lastPrice ?? 0),
|
|
230
|
+
oneDayPriceChange: primary.oneDayPriceChange == null ? undefined : -primary.oneDayPriceChange,
|
|
231
|
+
prices: (primary.prices || []).map(invertProbability),
|
|
232
|
+
isComplement: true,
|
|
233
|
+
complementOf: primaryKey,
|
|
234
|
+
};
|
|
235
|
+
return [primary, complement];
|
|
236
|
+
}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
export interface RthWindow {
|
|
2
|
+
/** IANA timezone the RTH hours are defined in. */
|
|
3
|
+
timeZone: string;
|
|
4
|
+
/** RTH open, minutes after local midnight of the trading date. */
|
|
5
|
+
openMinutes: number;
|
|
6
|
+
/** RTH close, minutes after local midnight of the trading date. */
|
|
7
|
+
closeMinutes: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The RTH window of a CME-group exchange, the client mirror of tsdb-gateway
|
|
11
|
+
* `SessionVenueGroupOf`: NYMEX serves the energy pit session, CME, CBOT and
|
|
12
|
+
* COMEX the platform RTH. Null for every other code, the GLOBEX alias
|
|
13
|
+
* included (a root resolves through the exchange it lists on, never through
|
|
14
|
+
* the alias).
|
|
15
|
+
*/
|
|
16
|
+
export declare function rthWindowForExchange(exchange: unknown): Readonly<RthWindow> | null;
|
|
17
|
+
/**
|
|
18
|
+
* Futures root of a raw contract symbol: leading letters before the
|
|
19
|
+
* month-code + year digits suffix ("ESU6" -> "ES", "MNQZ26" -> "MNQ").
|
|
20
|
+
* Returns null when the symbol does not look like a dated futures contract.
|
|
21
|
+
*/
|
|
22
|
+
export declare function futuresRootOf(symbol: unknown): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* The RTH window for a contract symbol: its root's listing exchange through
|
|
25
|
+
* `rthWindowForExchange`, or null for unmapped roots. Continuous symbols
|
|
26
|
+
* (`ES1!`, `BTC1!`) resolve through their root so the toggle works on the
|
|
27
|
+
* primary way CME futures are charted; unmapped roots stay null.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getRthWindowForSymbol(symbol: unknown): Readonly<RthWindow> | null;
|
|
30
|
+
/**
|
|
31
|
+
* The RTH window the kScript engine's venue-sessions table gives a symbol:
|
|
32
|
+
* the platform window for every mapped root, NYMEX included (engine 3.0.94).
|
|
33
|
+
* Script-facing session facts read this one (wrun `time.session`,
|
|
34
|
+
* wrun-bar-session-facts.util), so a browser run of an indicator agrees with
|
|
35
|
+
* its cloud run and with the engine's `inSession` / `vwap(session="rth")`;
|
|
36
|
+
* every chart gate reads `getRthWindowForSymbol`. It moves to the exchange
|
|
37
|
+
* windows only in a coordinated change of the engine, the WRUN-SESSIONS C3
|
|
38
|
+
* golden and the cloud lanes. Null for an unmapped root.
|
|
39
|
+
*/
|
|
40
|
+
export declare function engineRthWindowForSymbol(symbol: unknown): Readonly<RthWindow> | null;
|
|
41
|
+
export declare const SESSION_HOURS_ETH: "eth";
|
|
42
|
+
export declare const SESSION_HOURS_RTH: "rth";
|
|
43
|
+
/** Follow the chart-level session switch (the per-overlay default). */
|
|
44
|
+
export declare const SESSION_HOURS_CHART: "chart";
|
|
45
|
+
/** What a fetch/key/live gate actually acts on: 'chart' always collapses first. */
|
|
46
|
+
export type EffectiveSessionHours = typeof SESSION_HOURS_ETH | typeof SESSION_HOURS_RTH;
|
|
47
|
+
export type SessionHoursSetting = EffectiveSessionHours | typeof SESSION_HOURS_CHART;
|
|
48
|
+
/**
|
|
49
|
+
* Normalize a persisted/unknown value. Explicit 'rth'/'eth' are overrides;
|
|
50
|
+
* anything else (unset, legacy junk) follows the chart (the default).
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveSessionHoursSetting(value: unknown): SessionHoursSetting;
|
|
53
|
+
/**
|
|
54
|
+
* Collapse an overlay's saved session-hours choice to the EFFECTIVE session:
|
|
55
|
+
* 'chart' (the default) inherits the chart's RTH state, explicit 'eth'/'rth'
|
|
56
|
+
* override it regardless of what the chart is doing.
|
|
57
|
+
*/
|
|
58
|
+
export declare function resolveEffectiveSessionHours(overlaySessionHours: unknown, chartRthActive: boolean): EffectiveSessionHours;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the RTH toggle is offerable at all for this market: a CME-governed
|
|
61
|
+
* venue whose symbol resolves an RTH window. Unmapped roots fail CLOSED here
|
|
62
|
+
* (no toggle), while `isWithinRthWindow` fails OPEN (never drop data the toggle
|
|
63
|
+
* could not have filtered).
|
|
64
|
+
*
|
|
65
|
+
* The venue gate reads `isCmeGoverned` directly rather than the equivalent
|
|
66
|
+
* `isCmeFuturesPolicyActive`, so this module keeps the light worker-safe import
|
|
67
|
+
* graph trading-day.util established instead of pulling marketKind.util's
|
|
68
|
+
* capabilities registry into every worker and spec that touches the VP family.
|
|
69
|
+
*/
|
|
70
|
+
export declare function hasRthWindow(symbol: unknown, exchange: unknown): boolean;
|
|
71
|
+
export declare function isIntradayIntervalMs(chartTfMs: unknown): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The 30m bucket-grid exactness ceiling shared by every surface that keeps
|
|
74
|
+
* the CHART interval on the wire (main-series candles, the footprint): the
|
|
75
|
+
* gateway keeps/drops WHOLE buckets by their start: both opens (09:30 New
|
|
76
|
+
* York, 09:00 on NYMEX) sit on the 30m grid, while a 1h or 4h bucket
|
|
77
|
+
* straddling the 09:30 open would be dropped whole and silently under-count
|
|
78
|
+
* the cash session. The 16:15 close is exact through 15m; at 30m the 16:00
|
|
79
|
+
* bucket is admitted whole (its start is in-window), matching the engine's
|
|
80
|
+
* pinned admit-whole rule. The NYMEX 14:30 close is exact through 30m.
|
|
81
|
+
*/
|
|
82
|
+
export declare function isRthBucketExactIntervalMs(chartTfMs: unknown): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The footprint's RTH interval gate: the original consumer of the 30m
|
|
85
|
+
* bucket-grid ceiling (its fetch interval is never overridden). Kept as a
|
|
86
|
+
* named export; the shared predicate above is the one the chart-level
|
|
87
|
+
* session switch reuses.
|
|
88
|
+
*/
|
|
89
|
+
export declare function isFootprintRthIntervalMs(chartTfMs: unknown): boolean;
|
|
90
|
+
export declare function isFootprintRthFoldTfMs(chartTfMs: unknown): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Chart-format interval to milliseconds: numbers pass through, '15m'-style
|
|
93
|
+
* labels resolve via the interval table, anything else is undefined (which
|
|
94
|
+
* every RTH predicate treats as inactive).
|
|
95
|
+
*/
|
|
96
|
+
export declare function chartIntervalToMs(interval: unknown): number | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Whether the CHART itself is in RTH mode: a CME-governed venue whose symbol
|
|
99
|
+
* resolves an RTH window, the persisted chart `sessionType` is 'regular'
|
|
100
|
+
* (unset means ETH on futures; the equities meaning of unset is owned by the
|
|
101
|
+
* Polygon branch of `resolveCandleTradingHour` and never reaches this
|
|
102
|
+
* predicate), AND the chart interval sits on the 30m bucket-exact grid
|
|
103
|
+
* (candles keep the chart interval on the wire, so above 30m the effective
|
|
104
|
+
* mode falls back to ETH while the persisted choice is kept).
|
|
105
|
+
*
|
|
106
|
+
* Ordered cheapest-first on purpose: live-tick gates call this per frame, and
|
|
107
|
+
* the sessionType compare short-circuits everything for non-RTH charts.
|
|
108
|
+
*/
|
|
109
|
+
export declare function isChartRthActive(exchange: unknown, symbol: unknown, sessionType: unknown, chartTfMs: unknown): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* The default persisted `sessionType` for a chart's market: futures with a
|
|
112
|
+
* governed RTH window default to 'extended' (ETH, the full Globex session)
|
|
113
|
+
* so settings confirms can never silently stamp them into RTH; every other
|
|
114
|
+
* market keeps the historical 'regular' default (for Polygon equities unset
|
|
115
|
+
* and 'regular' both mean the regular session, byte-identical to today).
|
|
116
|
+
*/
|
|
117
|
+
export declare function defaultChartSessionType(symbol: unknown, exchange: unknown): 'regular' | 'extended';
|
|
118
|
+
/**
|
|
119
|
+
* The `sessionType` a chart carries through a symbol switch. The RTH/ETH
|
|
120
|
+
* choice stays only while the chart moves between futures with an RTH window
|
|
121
|
+
* (ES1! in RTH stays RTH on NQ1!); a switch into or out of that family takes
|
|
122
|
+
* the incoming market's default. Carried as-is, the 'regular' a crypto or
|
|
123
|
+
* equities chart stamps by default opened every future it switched to in RTH,
|
|
124
|
+
* frozen on the last cash-session bar while Globex traded.
|
|
125
|
+
*/
|
|
126
|
+
export declare function sessionTypeAfterSymbolSwitch(previous: {
|
|
127
|
+
symbol?: unknown;
|
|
128
|
+
exchange?: unknown;
|
|
129
|
+
sessionType?: 'regular' | 'extended';
|
|
130
|
+
}, next: {
|
|
131
|
+
symbol?: unknown;
|
|
132
|
+
exchange?: unknown;
|
|
133
|
+
}): 'regular' | 'extended' | undefined;
|
|
134
|
+
export interface RthSessionSettingsLike {
|
|
135
|
+
sessionHours?: unknown;
|
|
136
|
+
symbol?: unknown;
|
|
137
|
+
exchange?: unknown;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The single activity decision every RTH consumer shares: the overlay's
|
|
141
|
+
* EFFECTIVE session is RTH (explicit 'rth', or the 'chart' default while the
|
|
142
|
+
* chart-level switch is active; callers that can know the chart state pass
|
|
143
|
+
* `chartRthActive`, everything else fails safe to ETH), the venue+symbol
|
|
144
|
+
* resolve a window, AND the chart interval is intraday (a DAY-interval
|
|
145
|
+
* request under the gateway filter returns zero rows, so daily+ charts
|
|
146
|
+
* always behave as ETH; the settings UI hides the toggle there too).
|
|
147
|
+
*/
|
|
148
|
+
export declare function isRthSessionHoursActive(settings: RthSessionSettingsLike | null | undefined, chartTfMs: unknown, chartRthActive?: boolean): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* The wire interval an RTH-filtered profile fetch should use:
|
|
151
|
+
* min(chartTf, 15m), floored at 1m, then snapped to the standard width at or
|
|
152
|
+
* below it. The gateway drops whole buckets whose start lies outside the
|
|
153
|
+
* window, so a coarse bucket straddling the open (e.g. a 1h bucket starting
|
|
154
|
+
* 09:00 ET) would vanish and under-count the profile; capping at 15m keeps
|
|
155
|
+
* every kept/dropped decision boundary-exact (09:30 and 16:15 ET are both on
|
|
156
|
+
* the 15m grid, as are NYMEX's 09:00 and 14:30) while profile aggregation
|
|
157
|
+
* absorbs the finer rows. The snap covers the custom widths under 15m (2m
|
|
158
|
+
* and 3m fetch 1m, 10m fetches 5m): the gateway serves those by rolling up a
|
|
159
|
+
* finer tier and refuses a trading-hour plan at a rolled width ("trading
|
|
160
|
+
* hour sessions are not served at this interval"), and a 2m or 10m bucket
|
|
161
|
+
* would straddle the 16:15 close anyway. Every result is a natively served
|
|
162
|
+
* width (1m / 5m / 15m).
|
|
163
|
+
*/
|
|
164
|
+
export declare function rthEffectiveFetchTfMs(chartTfMs: number): number;
|
|
165
|
+
/**
|
|
166
|
+
* The wire interval a footprint's RTH fold fetches: the 1s tier under a 5s,
|
|
167
|
+
* 15s or 30s bar (the gateway rolls those from 1s and refuses a trading-hour
|
|
168
|
+
* plan at a rolled width, while 1s is a tier of its own and serves one), else
|
|
169
|
+
* `rthEffectiveFetchTfMs` (1m for 2m and 3m, 5m for 10m, 15m from 45m up).
|
|
170
|
+
* The range profiles keep that 1m floor. Shared by the footprint's request
|
|
171
|
+
* resolver and its worker, so the fetch and the cache key cannot drift.
|
|
172
|
+
*/
|
|
173
|
+
export declare function footprintRthFoldFetchTfMs(chartTfMs: number): number;
|
|
174
|
+
/**
|
|
175
|
+
* The timestamp grid live VP rows must land on for an RTH-active overlay so
|
|
176
|
+
* they line up with fetched history: the effective fetch interval for the
|
|
177
|
+
* range profiles, the chart interval for the footprint (per-bar ladders are
|
|
178
|
+
* its identity, its fetch interval is never overridden).
|
|
179
|
+
*/
|
|
180
|
+
export declare function rthLiveMergeIntervalMs(ovType: unknown, chartTfMs: number): number;
|
|
181
|
+
export interface SessionDayWindow {
|
|
182
|
+
openMs: number;
|
|
183
|
+
closeMs: number;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Every venue-local calendar day's `[open, close)` window that touches
|
|
187
|
+
* `[fromMs, toMs]`, in order: the walk steps one calendar day at a time in
|
|
188
|
+
* the window's zone (`rthDayBoundsFor`, so it is DST-exact on 23h/25h days)
|
|
189
|
+
* and keeps a day whose close is after `fromMs` and whose open is before
|
|
190
|
+
* `toMs`. Calendar-based like the other walks: Saturday, Sunday and holidays
|
|
191
|
+
* have mathematical bounds too, which is harmless for consumers that shade
|
|
192
|
+
* or gate BARS (no bar trades 09:30-16:15 New York on a weekend) and wrong
|
|
193
|
+
* for anyone who would count the windows as trading days. Empty for an
|
|
194
|
+
* inverted or non-finite span. Ad-hoc window objects miss the per-window
|
|
195
|
+
* memo (correct, slower); pass the frozen module constants.
|
|
196
|
+
*/
|
|
197
|
+
export declare function sessionWindowsInRange(window: Readonly<RthWindow>, fromMs: number, toMs: number): SessionDayWindow[];
|
|
198
|
+
/**
|
|
199
|
+
* `sessionWindowsInRange` for a symbol's mapped RTH window; empty for an
|
|
200
|
+
* unmapped root (callers gate on `hasRthWindow` first, like every other
|
|
201
|
+
* session-reset consumer).
|
|
202
|
+
*/
|
|
203
|
+
export declare function rthWindowsInRange(symbol: unknown, fromMs: number, toMs: number): SessionDayWindow[];
|
|
204
|
+
/**
|
|
205
|
+
* Whether `tsMs` falls inside the symbol's RTH window `[open, close)` on its
|
|
206
|
+
* own venue-local calendar day, DST-correct in the window's IANA zone. This
|
|
207
|
+
* matches the gateway's bucket rule (a bucket is kept when its START is
|
|
208
|
+
* inside the window), so gating bucket-start timestamps with it agrees with
|
|
209
|
+
* the server filter.
|
|
210
|
+
*
|
|
211
|
+
* Fails OPEN (returns true) when the symbol has no window: consumers only
|
|
212
|
+
* call this while RTH is active, and dropping data the toggle predicate
|
|
213
|
+
* could not vouch for would blank overlays on a mapping gap.
|
|
214
|
+
*/
|
|
215
|
+
export declare function isWithinRthWindow(symbol: unknown, tsMs: number): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* The session OPEN instant for an in-session timestamp, or null when the
|
|
218
|
+
* symbol resolves no window or `tsMs` lies outside `[open, close)` on its
|
|
219
|
+
* venue-local day. One value serves two roles for session-reset consumers
|
|
220
|
+
* (CVD reset-at-open): it is a window-membership predicate (null = out of
|
|
221
|
+
* session) AND the session identity (two timestamps share a trading session
|
|
222
|
+
* exactly when their opens are equal), so reset boundaries can never disagree
|
|
223
|
+
* with the filter that admitted the rows. Unmapped symbols return null for
|
|
224
|
+
* EVERY timestamp, so callers must gate on a mapped window first (every
|
|
225
|
+
* session-reset activity predicate requires `hasRthWindow`); only then does
|
|
226
|
+
* null strictly mean "outside the session". DST-correct via the same
|
|
227
|
+
* memoized per-day bounds.
|
|
228
|
+
*/
|
|
229
|
+
export declare function rthSessionOpenMs(symbol: unknown, tsMs: number): number | null;
|
|
230
|
+
/**
|
|
231
|
+
* The EXCLUSIVE close of the trading session containing `tsMs`: the twin of
|
|
232
|
+
* `rthSessionOpenMs` (same null contract: no mapped window, or `tsMs` outside
|
|
233
|
+
* `[open, close)`), for "did the held row reach the session close" checks.
|
|
234
|
+
*/
|
|
235
|
+
export declare function rthSessionCloseMs(symbol: unknown, tsMs: number): number | null;
|
|
236
|
+
/**
|
|
237
|
+
* The instant a FOLDED footprint bucket stops changing, on either fold grid:
|
|
238
|
+
* anchored buckets end at `min(start + tf, session close)`
|
|
239
|
+
* (`rthAnchoredBucketEndMs`); utc-grid buckets nominally end at `start + tf`
|
|
240
|
+
* but the RTH filter stops feeding them at the session close, so the bucket
|
|
241
|
+
* holding the close is complete at 20:15Z, not at the top of the next hour.
|
|
242
|
+
* Forming/closed classification (the poll-apply gate) must use this end or a
|
|
243
|
+
* closed stub/close-straddling row would count as forming long after it froze.
|
|
244
|
+
*/
|
|
245
|
+
export declare function footprintFoldBucketEndMs(symbol: unknown, bucketStartMs: number, tfMs: number, bucketMode: 'anchored' | 'utc'): number | null;
|
|
246
|
+
/**
|
|
247
|
+
* Does the bucket `[bucketStartMs, bucketStartMs + tfMs)` overlap its venue
|
|
248
|
+
* day's RTH session at all? The live gate for FOLDED footprints on the utc
|
|
249
|
+
* grid: the bucket holding the open (13:00Z for a 13:30Z open) and the one
|
|
250
|
+
* holding the close legitimately carry in-session sub-rows even though their
|
|
251
|
+
* starts sit outside `[open, close)`; the worker already rejected every
|
|
252
|
+
* out-of-session SOURCE frame, so the bucket-start test would wrongly drop
|
|
253
|
+
* them. Anchored buckets start in-session by construction and pass trivially.
|
|
254
|
+
*/
|
|
255
|
+
export declare function rthBucketOverlapsSessionMs(symbol: unknown, bucketStartMs: number, tfMs: number): boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Session-anchored bucket start for an RTH-mode bar at coarse (>30m)
|
|
258
|
+
* intervals. Above the 30m bucket-exact ceiling the gateway's trading-hour
|
|
259
|
+
* path re-aggregates from the 15m base with buckets anchored at the session
|
|
260
|
+
* OPEN (09:30 America/New_York, 09:00 on NYMEX), stepping `tfMs` within the
|
|
261
|
+
* day; the session's last bucket is a natural partial (nominal width, fewer
|
|
262
|
+
* contributing rows). This is the client-side mirror of that grid, and the
|
|
263
|
+
* ONE boundary source for both live writers: the live-feed forming-bar gate
|
|
264
|
+
* (cme-rth-main-frame-drop) and titan's main-series merger
|
|
265
|
+
* (`buildMergeLiveDataPoint`) derive their bucket keys here, so a live frame
|
|
266
|
+
* merges into the bucket the fetched history actually has and the two paths
|
|
267
|
+
* can never disagree (a UTC-grid floor at 1h keys 13:00Z/14:00Z while EDT
|
|
268
|
+
* session bars sit at 13:30Z/14:30Z).
|
|
269
|
+
*
|
|
270
|
+
* Returns null when the inputs are invalid, the symbol resolves no window,
|
|
271
|
+
* or `tsMs` sits outside `[open, close)` on its venue-local day: out of
|
|
272
|
+
* session there is no anchored bucket the frame could belong to, so live
|
|
273
|
+
* callers treat null as "drop the frame". DST-correct via the same memoized
|
|
274
|
+
* per-day bounds `isWithinRthWindow` rides.
|
|
275
|
+
*/
|
|
276
|
+
export declare function rthAnchoredBucketStartMs(symbol: unknown, tsMs: number, tfMs: number): number | null;
|
|
277
|
+
/**
|
|
278
|
+
* The EXCLUSIVE end of the anchored bucket that starts at `bucketStartMs`:
|
|
279
|
+
* `min(start + tf, session close)`. The session's last bucket is a stub (the
|
|
280
|
+
* 19:30 hourly bar closes at the 20:15 session close), and forming/closed
|
|
281
|
+
* classification must use this end, not `start + tf`. Null mirrors
|
|
282
|
+
* `rthAnchoredBucketStartMs` (no window, or the start is outside its session).
|
|
283
|
+
*/
|
|
284
|
+
export declare function rthAnchoredBucketEndMs(symbol: unknown, bucketStartMs: number, tfMs: number): number | null;
|
|
285
|
+
export declare function latestRthSessionBoundsAtOrBefore(symbol: unknown, tsMs: number): {
|
|
286
|
+
openMs: number;
|
|
287
|
+
closeMs: number;
|
|
288
|
+
} | null;
|
|
289
|
+
/**
|
|
290
|
+
* The next RTH open strictly AFTER `tsMs` on the same memoized window: inside
|
|
291
|
+
* a session it is tomorrow's open, after the close it is the next calendar
|
|
292
|
+
* day's, before the open it is today's. NON-AUTHORITATIVE, a HINT only
|
|
293
|
+
* (data-loading S6, the poll cadence's probe hint): the RthWindow is a
|
|
294
|
+
* chart-side filter (a timezone plus open and close minutes), not a venue
|
|
295
|
+
* schedule. It admits Saturday and holiday sessions exactly like
|
|
296
|
+
* `latestRthSessionBoundsAtOrBefore` (every calendar day has mathematical
|
|
297
|
+
* bounds), the RTH window (09:30 to 16:15 New York, 09:00 to 14:30 on NYMEX)
|
|
298
|
+
* is not the Globex cycle, and it can neither prove a venue still closed nor
|
|
299
|
+
* name the 17:00 CT
|
|
300
|
+
* reopen. A caller may shorten a timer to it (one extra probe on a
|
|
301
|
+
* non-trading day at worst); it must never skip a request, derive 'closed'
|
|
302
|
+
* or resume a cadence from it. Null for an unmapped symbol or a non-finite
|
|
303
|
+
* instant.
|
|
304
|
+
*/
|
|
305
|
+
export declare function nextRthSessionOpenMs(symbol: unknown, tsMs: number): number | null;
|
|
306
|
+
/**
|
|
307
|
+
* Slack a CALLER should add to a bar count before asking for its session span.
|
|
308
|
+
* Session slots are an upper bound on rows (holidays, early closes, and thin
|
|
309
|
+
* back-month contracts under-fill them), so a window sized to exact capacity
|
|
310
|
+
* systematically delivers short. Lives here next to the walk it corrects; the
|
|
311
|
+
* walk itself stays exact so it remains a testable "span holding N bars".
|
|
312
|
+
*/
|
|
313
|
+
export declare const RTH_SPAN_DENSITY_MARGIN = 1.15;
|
|
314
|
+
/**
|
|
315
|
+
* Session-anchored buckets one full RTH trading day contributes at `tfMs`:
|
|
316
|
+
* ceil(sessionSpan / tfMs), the last bucket a natural partial (mirrors the
|
|
317
|
+
* gateway's session-anchored re-aggregation above the 30m grid and the
|
|
318
|
+
* admit-whole rule at/below it). At 1h: 7 on the CME platform window, 6 on
|
|
319
|
+
* the NYMEX energy window.
|
|
320
|
+
*/
|
|
321
|
+
export declare function rthSessionBucketsPerDay(window: Readonly<RthWindow>, tfMs: number): number;
|
|
322
|
+
/**
|
|
323
|
+
* Wall-clock span that contains `barCount` RTH session bars walking BACKWARD
|
|
324
|
+
* from `endMs`, for sizing lazy-load windows on session-filtered series. The
|
|
325
|
+
* lazy pipeline's `bars * intervalMs` translation assumes contiguous bars; an
|
|
326
|
+
* RTH series carries only `rthSessionBucketsPerDay` bars per trading day and
|
|
327
|
+
* none on weekends (~3.4-4.9x sparser at 1h), so windows sized that way
|
|
328
|
+
* under-deliver every round and the loader re-frames once per round until the
|
|
329
|
+
* shortfall closes (the 2026-08-20 ES1! reload-flap).
|
|
330
|
+
*
|
|
331
|
+
* Walks venue-local calendar days on a NOON-anchored cursor (24h steps from
|
|
332
|
+
* noon are DST-safe: US transitions run at 02:00 and the two yearly shifts
|
|
333
|
+
* cancel, so the cursor stays inside 11:00-13:00 local), skips Saturday and
|
|
334
|
+
* Sunday, and accumulates per-day bucket counts until `barCount` is covered;
|
|
335
|
+
* the span then reaches that day's terminal bucket. The count is treated as
|
|
336
|
+
* session CAPACITY, which is an upper bound on rows actually present, so
|
|
337
|
+
* callers sizing a fetch window should pad with `RTH_SPAN_DENSITY_MARGIN`
|
|
338
|
+
* (holidays, early closes and thin contracts under-fill their slots, which
|
|
339
|
+
* would otherwise make every window land short). Returns null when the
|
|
340
|
+
* symbol resolves no RTH window or inputs are invalid (callers keep the
|
|
341
|
+
* naive translation).
|
|
342
|
+
*/
|
|
343
|
+
export declare function rthSessionWallSpanForBarsMs(symbol: unknown, tfMs: number, barCount: number, endMs: number): number | null;
|
|
344
|
+
/**
|
|
345
|
+
* Roughly how many RTH bars a wall-clock span of `spanMs` holds at `tfMs`:
|
|
346
|
+
* the per-day bucket count scaled by the span's trading days (5 of every 7
|
|
347
|
+
* calendar days). The inverse of `rthSessionWallSpanForBarsMs`, for callers
|
|
348
|
+
* sizing a BUDGET rather than a window (how many bars a plain bucket-sized
|
|
349
|
+
* round can be expected to yield on an RTH pane). Null when the symbol
|
|
350
|
+
* resolves no RTH window.
|
|
351
|
+
*/
|
|
352
|
+
export declare function rthSessionBarsInWallSpanMs(symbol: unknown, tfMs: number, spanMs: number): number | null;
|