@orangecharts/wrun-chart-host 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -6
- package/dist/constants/common.constants.d.ts +15 -0
- package/dist/constants/common.constants.js +23 -0
- package/dist/constants/data-source.constants.d.ts +1 -0
- package/dist/constants/data-source.constants.js +1 -0
- package/dist/constants/economic.constants.d.ts +39 -0
- package/dist/constants/economic.constants.js +77 -0
- package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
- package/dist/constants/etf-covered-coins.constants.js +9 -0
- package/dist/constants/feature-flags.constants.d.ts +60 -0
- package/dist/constants/feature-flags.constants.js +308 -0
- package/dist/constants/feature-limits.constants.d.ts +134 -0
- package/dist/constants/feature-limits.constants.js +155 -0
- package/dist/constants/marketCapabilities.constants.d.ts +87 -0
- package/dist/constants/marketCapabilities.constants.js +213 -0
- package/dist/constants/option-venues.constants.d.ts +100 -0
- package/dist/constants/option-venues.constants.js +167 -0
- package/dist/constants/overlay-data.constants.d.ts +53 -0
- package/dist/constants/overlay-data.constants.js +80 -0
- package/dist/constants/pane-grid.constants.d.ts +15 -0
- package/dist/constants/pane-grid.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +10 -0
- package/dist/constants/venue-presets.constants.js +22 -0
- package/dist/enums/chart.enum.d.ts +68 -0
- package/dist/enums/chart.enum.js +70 -0
- package/dist/helpers/data.helpers.d.ts +2 -0
- package/dist/helpers/data.helpers.js +14 -0
- package/dist/host-env.d.ts +161 -5
- package/dist/host-ports.types.d.ts +446 -0
- package/dist/host-ports.types.js +1 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +131 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
- package/dist/interfaces/asset-venue.interface.d.ts +91 -0
- package/dist/interfaces/asset-venue.interface.js +1 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
- package/dist/interfaces/cancel-reason.interface.js +2 -0
- package/dist/interfaces/catalog-display.interface.d.ts +3 -0
- package/dist/interfaces/catalog-display.interface.js +1 -0
- package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
- package/dist/interfaces/cme-realtime.interface.js +46 -0
- package/dist/interfaces/feed.interface.d.ts +80 -0
- package/dist/interfaces/feed.interface.js +7 -0
- package/dist/interfaces/market-kind.interface.d.ts +8 -0
- package/dist/interfaces/market-kind.interface.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
- package/dist/interfaces/opra-realtime.interface.js +105 -0
- package/dist/interfaces/option-instrument.interface.d.ts +32 -0
- package/dist/interfaces/option-instrument.interface.js +1 -0
- package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
- package/dist/interfaces/options-chain-scope.interface.js +7 -0
- package/dist/interfaces/prediction-market.interface.d.ts +88 -0
- package/dist/interfaces/prediction-market.interface.js +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
- package/dist/settings-templates/frvp-fields.d.ts +27 -0
- package/dist/settings-templates/frvp-fields.js +108 -0
- package/dist/settings-templates/index.d.ts +119 -0
- package/dist/settings-templates/index.js +442 -0
- package/dist/settings-templates/indicator-fields.d.ts +56 -0
- package/dist/settings-templates/indicator-fields.js +793 -0
- package/dist/settings-templates/tool-rules.d.ts +59 -0
- package/dist/settings-templates/tool-rules.js +49 -0
- package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
- package/dist/settings-templates/tool-tables.generated.js +1668 -0
- package/dist/utility/blk-market.util.d.ts +5 -0
- package/dist/utility/blk-market.util.js +12 -0
- package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
- package/dist/utility/chart/chart-load-phase.util.js +78 -0
- package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
- package/dist/utility/chart/cme-cache-context.util.js +166 -0
- package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
- package/dist/utility/chart/cme-session-bucket.util.js +343 -0
- package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
- package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
- package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
- package/dist/utility/chart/continuous-contracts.util.js +374 -0
- package/dist/utility/chart/feed-interval.util.d.ts +119 -0
- package/dist/utility/chart/feed-interval.util.js +321 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
- package/dist/utility/chart/footprint-band.util.d.ts +76 -0
- package/dist/utility/chart/footprint-band.util.js +205 -0
- package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
- package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
- package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
- package/dist/utility/chart/formula-calendar.util.js +59 -0
- package/dist/utility/chart/history-wall.util.d.ts +67 -0
- package/dist/utility/chart/history-wall.util.js +87 -0
- package/dist/utility/chart/index-mode.util.d.ts +66 -0
- package/dist/utility/chart/index-mode.util.js +360 -0
- package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
- package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
- package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
- package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
- package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
- package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
- package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
- package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
- package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
- package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
- package/dist/utility/chart/interval-registry.util.d.ts +23 -0
- package/dist/utility/chart/interval-registry.util.js +83 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
- package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
- package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
- package/dist/utility/chart/live-bucket.util.d.ts +66 -0
- package/dist/utility/chart/live-bucket.util.js +165 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
- package/dist/utility/chart/market-session-schedule.util.js +337 -0
- package/dist/utility/chart/marketKind.util.d.ts +181 -0
- package/dist/utility/chart/marketKind.util.js +371 -0
- package/dist/utility/chart/om-panel.util.js +6 -0
- package/dist/utility/chart/om-widget.util.d.ts +4 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
- package/dist/utility/chart/opra-read-access.leaf.js +25 -0
- package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
- package/dist/utility/chart/prediction-identity.util.js +236 -0
- package/dist/utility/chart/rth-session.util.d.ts +352 -0
- package/dist/utility/chart/rth-session.util.js +926 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
- package/dist/utility/chart/titan-constants.pin.js +50 -0
- package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
- package/dist/utility/chart/us-equities-session.util.js +251 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
- package/dist/utility/chart/wrun-run-result.util.js +10 -0
- package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
- package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
- package/dist/utility/common/safe-math-eval.d.ts +18 -0
- package/dist/utility/common/safe-math-eval.js +160 -0
- package/dist/utility/common/time.util.d.ts +134 -0
- package/dist/utility/common/time.util.js +428 -0
- package/dist/utility/common/transformations.util.d.ts +126 -0
- package/dist/utility/common/transformations.util.js +711 -0
- package/dist/utility/common/visible-timeout.util.d.ts +17 -0
- package/dist/utility/common/visible-timeout.util.js +75 -0
- package/dist/utility/exchange-normalization.util.d.ts +8 -0
- package/dist/utility/exchange-normalization.util.js +32 -0
- package/dist/utility/intl-locale.util.d.ts +2 -0
- package/dist/utility/intl-locale.util.js +28 -0
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +50 -19
- package/dist/utility/options/option-symbol.util.d.ts +28 -0
- package/dist/utility/options/option-symbol.util.js +176 -0
- package/dist/utility/options/option-trade-units.util.d.ts +190 -0
- package/dist/utility/options/option-trade-units.util.js +283 -0
- package/dist/utility/options/option-venue.util.d.ts +75 -0
- package/dist/utility/options/option-venue.util.js +85 -0
- package/dist/utility/pool-symbol.leaf.d.ts +34 -0
- package/dist/utility/pool-symbol.leaf.js +95 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
- package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
- package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
- package/dist/utility/v2/gate-plane.util.d.ts +58 -0
- package/dist/utility/v2/gate-plane.util.js +99 -0
- package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
- package/dist/utility/v2/gate-session-latch.util.js +34 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
- package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
- package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/economic.js +79 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
- package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/lanes/index.js +32 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
- package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
- package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
- package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
- package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
- package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
- package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
- package/dist/utility/wrun/sources/lanes/series.js +321 -0
- package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
- package/dist/utility/wrun/sources/registry.d.ts +21 -0
- package/dist/utility/wrun/sources/registry.js +207 -0
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
- package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
- package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
- package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +1 -1
- package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
- package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
- package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-deadline.util.js +82 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
- package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
- package/dist/utility/wrun/wrun-failure-cause.d.ts +39 -0
- package/dist/utility/wrun/wrun-failure-cause.js +94 -0
- package/dist/utility/wrun/wrun-frames.d.ts +28 -3
- package/dist/utility/wrun/wrun-frames.js +132 -52
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +167 -4
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +47 -2
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +5 -2
- package/dist/utility/wrun/wrun-hosted-wire.util.js +4 -2
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
- package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
- package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
- package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
- package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +30 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
- package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
- package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
- package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
- package/dist/utility/wrun/wrun-pack.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-pack.util.js +13 -3
- package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
- package/dist/utility/wrun/wrun-param-map.util.js +581 -0
- package/dist/utility/wrun/wrun-param-values.util.d.ts +8 -0
- package/dist/utility/wrun/wrun-param-values.util.js +8 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +95 -7
- package/dist/utility/wrun/wrun-refusal.util.js +314 -18
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
- package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
- package/dist/utility/wrun/wrun-render-select.util.js +1 -0
- package/dist/utility/wrun/wrun-row-market.util.d.ts +29 -0
- package/dist/utility/wrun/wrun-row-market.util.js +92 -0
- package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
- package/dist/utility/wrun/wrun-row-source.js +75 -0
- package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
- package/dist/utility/wrun/wrun-run-health.util.js +273 -0
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
- package/dist/utility/wrun/wrun-symbol-code.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-symbol-code.util.js +56 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
- package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
- package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
- package/dist/utility/wrun-display-name.util.d.ts +33 -0
- package/dist/utility/wrun-display-name.util.js +64 -0
- package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
- package/dist/workers/constants/kscript-transport-codes.js +15 -0
- package/dist/workers/constants/socket-slots.d.ts +574 -0
- package/dist/workers/constants/socket-slots.js +539 -0
- package/dist/workers/utils/number.worker.util.d.ts +5 -0
- package/dist/workers/utils/number.worker.util.js +10 -0
- package/dist/workers/utils/time.worker.util.d.ts +12 -0
- package/dist/workers/utils/time.worker.util.js +24 -0
- package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
- package/dist/workers/utils/volume-profile.worker.util.js +631 -0
- package/package.json +10 -4
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Weekly session schedule for governed futures venues (the CME Globex family:
|
|
3
|
+
* CME, CBOT, NYMEX, COMEX, GLOBEX). This is deliberately NOT a holiday
|
|
4
|
+
* calendar: it encodes only the static weekly cycle, which is enough to (a)
|
|
5
|
+
* flip the market-status indicator the second the Friday close passes and (b)
|
|
6
|
+
* promise a reopen time on the ordinary weekend/daily halts. Holidays fall
|
|
7
|
+
* through to the data-driven "closed, reopen unknown" state upstream
|
|
8
|
+
* (useMarketSessionStatus): schedule says open, no trades print, and the UI
|
|
9
|
+
* says just "Market closed" without promising a time we cannot stand behind.
|
|
10
|
+
*
|
|
11
|
+
* Weekly cycle, America/Chicago wall clock (Globex):
|
|
12
|
+
* open Sun 17:00 -> Fri 16:00
|
|
13
|
+
* halt Mon-Thu 16:00 -> 17:00 (daily maintenance)
|
|
14
|
+
* Some CBOT agricultural products keep narrower pit-session hours inside this
|
|
15
|
+
* envelope; for them the schedule can read "open" during an afternoon pause
|
|
16
|
+
* until the data latch corrects it. Known-coarse by design (v1).
|
|
17
|
+
*
|
|
18
|
+
* All math is done in exchange wall-clock parts obtained through Intl with an
|
|
19
|
+
* explicit timeZone, then converted back to UTC instants with the dual-offset
|
|
20
|
+
* probe (try CST/CDT, keep the one that renders back to the intended wall
|
|
21
|
+
* time). The session boundaries (16:00/17:00) are never inside a DST jump
|
|
22
|
+
* (those happen at 02:00 local), so the probe is always unambiguous.
|
|
23
|
+
*/
|
|
24
|
+
export declare const GOVERNED_FUTURES_TIME_ZONE = "America/Chicago";
|
|
25
|
+
export interface GovernedFuturesScheduleStatus {
|
|
26
|
+
/** True when the weekly schedule has the venue trading at `nowMs`. */
|
|
27
|
+
open: boolean;
|
|
28
|
+
/** Next scheduled open instant (UTC ms) when closed, else null. */
|
|
29
|
+
nextOpenMs: number | null;
|
|
30
|
+
/** Next scheduled close instant (UTC ms) when open, else null. */
|
|
31
|
+
nextCloseMs: number | null;
|
|
32
|
+
}
|
|
33
|
+
/** Closed iff inside the weekend halt (Fri 16:00 -> Sun 17:00) or a Mon-Thu daily halt. */
|
|
34
|
+
export declare function isGovernedFuturesScheduleOpen(nowMs: number): boolean;
|
|
35
|
+
export declare function getGovernedFuturesScheduleStatus(nowMs: number): GovernedFuturesScheduleStatus;
|
|
36
|
+
/** Futures root of a continuous (`BTC1!`), monthly (`BTCQ6`, `1OZV6`) or
|
|
37
|
+
* weekly (`BFFQ628`) CME symbol; null when the symbol has no such shape. */
|
|
38
|
+
export declare function cmeFuturesRootOf(symbol: unknown): string | null;
|
|
39
|
+
/** True when the symbol's root trades on CME's 24/7 schedule. */
|
|
40
|
+
export declare function isCmeAlwaysOnSymbol(symbol: unknown): boolean;
|
|
41
|
+
/** The instant the symbol's root became always-on, or null for weekly-cycle roots. */
|
|
42
|
+
export declare function cmeAlwaysOnSinceMs(symbol: unknown): number | null;
|
|
43
|
+
/** The always-on schedule: open except inside the Saturday maintenance window. */
|
|
44
|
+
export declare function getAlwaysOnScheduleStatus(nowMs: number): GovernedFuturesScheduleStatus;
|
|
45
|
+
/**
|
|
46
|
+
* Schedule status for a specific governed symbol: always-on roots get the
|
|
47
|
+
* 24/7 schedule, everything else the Globex weekly cycle. Callers that have a
|
|
48
|
+
* symbol must use this; `getGovernedFuturesScheduleStatus` remains the
|
|
49
|
+
* venue-level cycle for symbol-less consumers (the region session clock's CME
|
|
50
|
+
* lane).
|
|
51
|
+
*/
|
|
52
|
+
export declare function getGovernedFuturesScheduleStatusForSymbol(symbol: unknown, nowMs: number): GovernedFuturesScheduleStatus;
|
|
53
|
+
/**
|
|
54
|
+
* The instant a viewer's governed data has reached at `nowMs`, the server's
|
|
55
|
+
* now (`serverNowMs()`, never the device clock: everything it is compared with
|
|
56
|
+
* is a server bar time or the exchange's own schedule):
|
|
57
|
+
* `nowMs` itself with confirmed real-time access, else `nowMs` minus the
|
|
58
|
+
* served delay (the gate's own `delaySeconds` once known, the plane's delayed
|
|
59
|
+
* default until then: 10 minutes on CME, 15 on OPRA; unknown access reads
|
|
60
|
+
* delayed-safe, as the cache key does). Anything that counts bars against the
|
|
61
|
+
* schedule reads it on THIS clock: a delayed 1m CME chart is ten bars behind
|
|
62
|
+
* the wall clock by construction (an OPRA chart fifteen), and the market it
|
|
63
|
+
* shows opens and closes that much late. Venues no gate plane governs are
|
|
64
|
+
* served live.
|
|
65
|
+
*/
|
|
66
|
+
export declare function cmeServedNowMs(nowMs: number, exchange: string | undefined | null): number;
|
|
67
|
+
/**
|
|
68
|
+
* UTC ms the trading session containing `nowMs` opened, or null when the
|
|
69
|
+
* market (in the chart's session mode) is closed at `nowMs`.
|
|
70
|
+
*
|
|
71
|
+
* The cached-paint session rule counts missing bars only inside one session,
|
|
72
|
+
* never across a close, so it needs the open instant of the session that is
|
|
73
|
+
* trading right now, in the session mode the chart receives bars for:
|
|
74
|
+
*
|
|
75
|
+
* - RTH (`opts.rth`, a symbol with an RTH window): today's RTH window on a
|
|
76
|
+
* weekday, the 09:30 New York open (09:00 on NYMEX, the venue's window from
|
|
77
|
+
* rth-session.util). Outside it the RTH chart receives no
|
|
78
|
+
* bars, so it is closed; Saturday and Sunday have window bounds on the
|
|
79
|
+
* calendar but no session.
|
|
80
|
+
* - ETH, always-on roots (after their launch instant): since the last
|
|
81
|
+
* Saturday 04:00 CT maintenance end.
|
|
82
|
+
* - ETH, the weekly cycle: since the most recent 17:00 CT open.
|
|
83
|
+
*
|
|
84
|
+
* Holidays and early closes are unknown here by design (module doc): on
|
|
85
|
+
* those days the schedule reads open and consumers must degrade safely.
|
|
86
|
+
* Clock-agnostic: consumers judging served data pass `cmeServedNowMs`.
|
|
87
|
+
*/
|
|
88
|
+
export declare function currentCmeSessionStartMs(nowMs: number, opts: {
|
|
89
|
+
symbol?: string | null;
|
|
90
|
+
rth: boolean;
|
|
91
|
+
}): number | null;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Weekly session schedule for governed futures venues (the CME Globex family:
|
|
3
|
+
* CME, CBOT, NYMEX, COMEX, GLOBEX). This is deliberately NOT a holiday
|
|
4
|
+
* calendar: it encodes only the static weekly cycle, which is enough to (a)
|
|
5
|
+
* flip the market-status indicator the second the Friday close passes and (b)
|
|
6
|
+
* promise a reopen time on the ordinary weekend/daily halts. Holidays fall
|
|
7
|
+
* through to the data-driven "closed, reopen unknown" state upstream
|
|
8
|
+
* (useMarketSessionStatus): schedule says open, no trades print, and the UI
|
|
9
|
+
* says just "Market closed" without promising a time we cannot stand behind.
|
|
10
|
+
*
|
|
11
|
+
* Weekly cycle, America/Chicago wall clock (Globex):
|
|
12
|
+
* open Sun 17:00 -> Fri 16:00
|
|
13
|
+
* halt Mon-Thu 16:00 -> 17:00 (daily maintenance)
|
|
14
|
+
* Some CBOT agricultural products keep narrower pit-session hours inside this
|
|
15
|
+
* envelope; for them the schedule can read "open" during an afternoon pause
|
|
16
|
+
* until the data latch corrects it. Known-coarse by design (v1).
|
|
17
|
+
*
|
|
18
|
+
* All math is done in exchange wall-clock parts obtained through Intl with an
|
|
19
|
+
* explicit timeZone, then converted back to UTC instants with the dual-offset
|
|
20
|
+
* probe (try CST/CDT, keep the one that renders back to the intended wall
|
|
21
|
+
* time). The session boundaries (16:00/17:00) are never inside a DST jump
|
|
22
|
+
* (those happen at 02:00 local), so the probe is always unambiguous.
|
|
23
|
+
*/
|
|
24
|
+
import { cmeServedAccessForExchange } from './cme-cache-context.util.js';
|
|
25
|
+
import { getRthWindowForSymbol, rthSessionOpenMs } from './rth-session.util.js';
|
|
26
|
+
import { delayedDefaultSecondsFor, gateProviderForExchange } from '../v2/gate-plane.util.js';
|
|
27
|
+
export const GOVERNED_FUTURES_TIME_ZONE = 'America/Chicago';
|
|
28
|
+
/** Sunday-based minutes-of-week for the two boundary kinds. */
|
|
29
|
+
const MINUTES_PER_DAY = 24 * 60;
|
|
30
|
+
const OPEN_HOUR = 17;
|
|
31
|
+
const CLOSE_HOUR = 16;
|
|
32
|
+
const WEEKDAY_INDEX = { Sun: 0, Mon: 1, Tue: 2, Wed: 3, Thu: 4, Fri: 5, Sat: 6 };
|
|
33
|
+
const partsFormatter = new Intl.DateTimeFormat('en-US', {
|
|
34
|
+
timeZone: GOVERNED_FUTURES_TIME_ZONE,
|
|
35
|
+
weekday: 'short',
|
|
36
|
+
year: 'numeric',
|
|
37
|
+
month: 'numeric',
|
|
38
|
+
day: 'numeric',
|
|
39
|
+
hour: 'numeric',
|
|
40
|
+
minute: 'numeric',
|
|
41
|
+
hourCycle: 'h23',
|
|
42
|
+
});
|
|
43
|
+
function wallClockPartsAt(utcMs) {
|
|
44
|
+
const parts = {};
|
|
45
|
+
for (const p of partsFormatter.formatToParts(new Date(utcMs)))
|
|
46
|
+
parts[p.type] = p.value;
|
|
47
|
+
return {
|
|
48
|
+
year: Number(parts.year),
|
|
49
|
+
month: Number(parts.month),
|
|
50
|
+
day: Number(parts.day),
|
|
51
|
+
weekday: WEEKDAY_INDEX[parts.weekday ?? ''] ?? 0,
|
|
52
|
+
// hourCycle h23 still renders midnight as '24' on some ICU versions; normalize.
|
|
53
|
+
hour: Number(parts.hour) % 24,
|
|
54
|
+
minute: Number(parts.minute),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* UTC instant for a Chicago wall-clock time on the calendar day of `dayAnchorUtcMs`
|
|
59
|
+
* (anchored at noon UTC so day arithmetic never straddles a DST jump). Probes the
|
|
60
|
+
* two possible Central offsets and keeps the one that renders back to `hour:00`.
|
|
61
|
+
*/
|
|
62
|
+
function chicagoWallTimeToUtc(year, month, day, hour) {
|
|
63
|
+
for (const offsetHours of [5, 6]) {
|
|
64
|
+
const candidate = Date.UTC(year, month - 1, day, hour + offsetHours, 0, 0, 0);
|
|
65
|
+
const rendered = wallClockPartsAt(candidate);
|
|
66
|
+
if (rendered.day === day && rendered.hour === hour && rendered.minute === 0)
|
|
67
|
+
return candidate;
|
|
68
|
+
}
|
|
69
|
+
// Unreachable for 16:00/17:00 boundaries (DST jumps at 02:00 local); keep a
|
|
70
|
+
// deterministic fallback for safety.
|
|
71
|
+
return Date.UTC(year, month - 1, day, hour + 6, 0, 0, 0);
|
|
72
|
+
}
|
|
73
|
+
function minutesOfWeek(p) {
|
|
74
|
+
return p.weekday * MINUTES_PER_DAY + p.hour * 60 + p.minute;
|
|
75
|
+
}
|
|
76
|
+
/** Closed iff inside the weekend halt (Fri 16:00 -> Sun 17:00) or a Mon-Thu daily halt. */
|
|
77
|
+
export function isGovernedFuturesScheduleOpen(nowMs) {
|
|
78
|
+
const p = wallClockPartsAt(nowMs);
|
|
79
|
+
const mow = minutesOfWeek(p);
|
|
80
|
+
const weekendStart = 5 * MINUTES_PER_DAY + CLOSE_HOUR * 60; // Fri 16:00
|
|
81
|
+
const weekOpen = OPEN_HOUR * 60; // Sun 17:00
|
|
82
|
+
if (mow >= weekendStart || mow < weekOpen)
|
|
83
|
+
return false;
|
|
84
|
+
const inDailyHalt = p.weekday >= 1 && p.weekday <= 4 && p.hour >= CLOSE_HOUR && p.hour < OPEN_HOUR;
|
|
85
|
+
return !inDailyHalt;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Enumerate the schedule boundaries over the next `days` Chicago calendar days
|
|
89
|
+
* and return the first one of `kind` strictly after `nowMs`.
|
|
90
|
+
*/
|
|
91
|
+
function nextBoundary(nowMs, kind) {
|
|
92
|
+
for (let dayOffset = 0; dayOffset <= 8; dayOffset++) {
|
|
93
|
+
// Anchor at UTC noon of the current instant plus offset days, then read the
|
|
94
|
+
// Chicago calendar date of that anchor: immune to DST day-length changes.
|
|
95
|
+
const anchor = nowMs + dayOffset * MINUTES_PER_DAY * 60_000;
|
|
96
|
+
const p = wallClockPartsAt(anchor);
|
|
97
|
+
const isBoundaryDay = kind === 'open'
|
|
98
|
+
? p.weekday === 0 || (p.weekday >= 1 && p.weekday <= 4) // Sun + Mon-Thu 17:00
|
|
99
|
+
: p.weekday >= 1 && p.weekday <= 5; // Mon-Fri 16:00
|
|
100
|
+
if (!isBoundaryDay)
|
|
101
|
+
continue;
|
|
102
|
+
const instant = chicagoWallTimeToUtc(p.year, p.month, p.day, kind === 'open' ? OPEN_HOUR : CLOSE_HOUR);
|
|
103
|
+
if (instant > nowMs)
|
|
104
|
+
return instant;
|
|
105
|
+
}
|
|
106
|
+
// Unreachable: an 8-day sweep always contains both boundary kinds.
|
|
107
|
+
return nowMs;
|
|
108
|
+
}
|
|
109
|
+
export function getGovernedFuturesScheduleStatus(nowMs) {
|
|
110
|
+
const open = isGovernedFuturesScheduleOpen(nowMs);
|
|
111
|
+
return {
|
|
112
|
+
open,
|
|
113
|
+
nextOpenMs: open ? null : nextBoundary(nowMs, 'open'),
|
|
114
|
+
nextCloseMs: open ? nextBoundary(nowMs, 'close') : null,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
// ─── Always-on products (the CME 24/7 program) ───────────────────────────────
|
|
118
|
+
/**
|
|
119
|
+
* CME moves products onto 24/7 trading one product at a time, not venue-wide:
|
|
120
|
+
* cryptocurrency futures and options (standard + micro, plus the Bitcoin
|
|
121
|
+
* Friday weeklies) since 2026-05-29, the 1-Ounce Gold future since
|
|
122
|
+
* 2026-07-24; the 10-barrel WTI contract is announced for 2026-08-30. Spot-
|
|
123
|
+
* quoted futures are excluded by CME and stay on the weekly cycle. For these
|
|
124
|
+
* roots the Globex cycle above is wrong on its face (the 2026-08-22 report:
|
|
125
|
+
* BTC1! "Closed" on a Saturday while its book streamed): their only scheduled
|
|
126
|
+
* halt is the Saturday 02:00-04:00 CT maintenance window. The weekday
|
|
127
|
+
* 16:00-16:02 CT two-minute window is deliberately ignored: too short to
|
|
128
|
+
* announce, and a "Closed" flash every afternoon would be noise.
|
|
129
|
+
*
|
|
130
|
+
* Static on purpose, like the cycle itself (a constant, not a maintained
|
|
131
|
+
* dataset). Roots were checked against a Saturday L3/book feed before being
|
|
132
|
+
* listed; add a root only with that evidence (the NCI/MCI crypto-index pair is
|
|
133
|
+
* listed on exactly that evidence: order flow on 2026-08-22 13:15Z).
|
|
134
|
+
*/
|
|
135
|
+
const CME_ALWAYS_ON_ROOTS = new Set([
|
|
136
|
+
// Cryptocurrency futures + options: standard and micro, Bitcoin Friday weeklies.
|
|
137
|
+
'BTC',
|
|
138
|
+
'MBT',
|
|
139
|
+
'BFF',
|
|
140
|
+
'BTE', // Bitcoin Euro
|
|
141
|
+
'ETH',
|
|
142
|
+
'MET',
|
|
143
|
+
'ETE', // Ether Euro
|
|
144
|
+
'SOL',
|
|
145
|
+
'MSL',
|
|
146
|
+
'XRP',
|
|
147
|
+
'MXP',
|
|
148
|
+
'ADA',
|
|
149
|
+
'MCA',
|
|
150
|
+
'LNK',
|
|
151
|
+
'MLN',
|
|
152
|
+
'XLM',
|
|
153
|
+
'MXL',
|
|
154
|
+
'AVA',
|
|
155
|
+
'MAV',
|
|
156
|
+
'SUI',
|
|
157
|
+
'MSU',
|
|
158
|
+
'NCI',
|
|
159
|
+
'MCI',
|
|
160
|
+
// Listed by CME under cryptocurrency futures (reviewer-cited product table,
|
|
161
|
+
// 2026-08-22; the 24/7 policy covers every crypto future except spot-quoted
|
|
162
|
+
// contracts). Not yet seen on a weekend feed here; an unknown root is inert.
|
|
163
|
+
'EBM',
|
|
164
|
+
'EEM',
|
|
165
|
+
'EBR',
|
|
166
|
+
'BVI',
|
|
167
|
+
// Metals: the 1-Ounce Gold future (standard and micro gold keep the weekly cycle).
|
|
168
|
+
'1OZ',
|
|
169
|
+
]);
|
|
170
|
+
/** Saturday 02:00-04:00 CT, Sunday-based minutes-of-week. */
|
|
171
|
+
const ALWAYS_ON_MAINTENANCE_START_MIN = 6 * MINUTES_PER_DAY + 2 * 60;
|
|
172
|
+
const ALWAYS_ON_MAINTENANCE_END_MIN = 6 * MINUTES_PER_DAY + 4 * 60;
|
|
173
|
+
const ALWAYS_ON_MAINTENANCE_START_HOUR = 2;
|
|
174
|
+
const ALWAYS_ON_MAINTENANCE_END_HOUR = 4;
|
|
175
|
+
/** `<ROOT>1!` continuous symbols. */
|
|
176
|
+
const CONTINUOUS_SYMBOL_RE = /^([A-Z0-9]+?)1!$/;
|
|
177
|
+
/** Dated contracts: root, month code, 1-2 year digits, or the 3-digit weekly
|
|
178
|
+
* tail of the Bitcoin Friday futures (`BFFQ628`). */
|
|
179
|
+
const DATED_CONTRACT_RE = /^([A-Z0-9]+?)[FGHJKMNQUVXZ]\d{1,3}$/;
|
|
180
|
+
/** Futures root of a continuous (`BTC1!`), monthly (`BTCQ6`, `1OZV6`) or
|
|
181
|
+
* weekly (`BFFQ628`) CME symbol; null when the symbol has no such shape. */
|
|
182
|
+
export function cmeFuturesRootOf(symbol) {
|
|
183
|
+
if (typeof symbol !== 'string')
|
|
184
|
+
return null;
|
|
185
|
+
const upper = symbol.trim().toUpperCase();
|
|
186
|
+
const match = CONTINUOUS_SYMBOL_RE.exec(upper) ?? DATED_CONTRACT_RE.exec(upper);
|
|
187
|
+
return match ? match[1] : null;
|
|
188
|
+
}
|
|
189
|
+
/** True when the symbol's root trades on CME's 24/7 schedule. */
|
|
190
|
+
export function isCmeAlwaysOnSymbol(symbol) {
|
|
191
|
+
const root = cmeFuturesRootOf(symbol);
|
|
192
|
+
return root !== null && CME_ALWAYS_ON_ROOTS.has(root);
|
|
193
|
+
}
|
|
194
|
+
/** First always-on session open, UTC ms: crypto futures + options from the
|
|
195
|
+
* 2026-05-29 16:30 CT launch, the 1-Ounce Gold future from 2026-07-24 (its
|
|
196
|
+
* first weekend session after that Friday's 16:00 CT close). Before these
|
|
197
|
+
* instants the weekly cycle applied; history-painting consumers (session
|
|
198
|
+
* bands) split at them. Status consumers only ask about `now`. */
|
|
199
|
+
const CME_ALWAYS_ON_CRYPTO_SINCE_MS = Date.UTC(2026, 4, 29, 21, 30);
|
|
200
|
+
const CME_ALWAYS_ON_1OZ_SINCE_MS = Date.UTC(2026, 6, 24, 21, 30);
|
|
201
|
+
/** The instant the symbol's root became always-on, or null for weekly-cycle roots. */
|
|
202
|
+
export function cmeAlwaysOnSinceMs(symbol) {
|
|
203
|
+
const root = cmeFuturesRootOf(symbol);
|
|
204
|
+
if (root === null || !CME_ALWAYS_ON_ROOTS.has(root))
|
|
205
|
+
return null;
|
|
206
|
+
return root === '1OZ' ? CME_ALWAYS_ON_1OZ_SINCE_MS : CME_ALWAYS_ON_CRYPTO_SINCE_MS;
|
|
207
|
+
}
|
|
208
|
+
/** The always-on schedule: open except inside the Saturday maintenance window. */
|
|
209
|
+
export function getAlwaysOnScheduleStatus(nowMs) {
|
|
210
|
+
const p = wallClockPartsAt(nowMs);
|
|
211
|
+
const mow = minutesOfWeek(p);
|
|
212
|
+
if (mow >= ALWAYS_ON_MAINTENANCE_START_MIN && mow < ALWAYS_ON_MAINTENANCE_END_MIN) {
|
|
213
|
+
return {
|
|
214
|
+
open: false,
|
|
215
|
+
nextOpenMs: chicagoWallTimeToUtc(p.year, p.month, p.day, ALWAYS_ON_MAINTENANCE_END_HOUR),
|
|
216
|
+
nextCloseMs: null,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
// Next Saturday 02:00 CT strictly after now (same day-anchored sweep as
|
|
220
|
+
// nextBoundary; a Saturday 02:00 wall time is never inside a DST jump).
|
|
221
|
+
for (let dayOffset = 0; dayOffset <= 7; dayOffset++) {
|
|
222
|
+
const q = wallClockPartsAt(nowMs + dayOffset * MINUTES_PER_DAY * 60_000);
|
|
223
|
+
if (q.weekday !== 6)
|
|
224
|
+
continue;
|
|
225
|
+
const instant = chicagoWallTimeToUtc(q.year, q.month, q.day, ALWAYS_ON_MAINTENANCE_START_HOUR);
|
|
226
|
+
if (instant > nowMs)
|
|
227
|
+
return { open: true, nextOpenMs: null, nextCloseMs: instant };
|
|
228
|
+
}
|
|
229
|
+
// Unreachable: a 7-day sweep always contains a Saturday.
|
|
230
|
+
return { open: true, nextOpenMs: null, nextCloseMs: null };
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Schedule status for a specific governed symbol: always-on roots get the
|
|
234
|
+
* 24/7 schedule, everything else the Globex weekly cycle. Callers that have a
|
|
235
|
+
* symbol must use this; `getGovernedFuturesScheduleStatus` remains the
|
|
236
|
+
* venue-level cycle for symbol-less consumers (the region session clock's CME
|
|
237
|
+
* lane).
|
|
238
|
+
*/
|
|
239
|
+
export function getGovernedFuturesScheduleStatusForSymbol(symbol, nowMs) {
|
|
240
|
+
return isCmeAlwaysOnSymbol(symbol) ? getAlwaysOnScheduleStatus(nowMs) : getGovernedFuturesScheduleStatus(nowMs);
|
|
241
|
+
}
|
|
242
|
+
// ─── The served clock ────────────────────────────────────────────────────────
|
|
243
|
+
/**
|
|
244
|
+
* The instant a viewer's governed data has reached at `nowMs`, the server's
|
|
245
|
+
* now (`serverNowMs()`, never the device clock: everything it is compared with
|
|
246
|
+
* is a server bar time or the exchange's own schedule):
|
|
247
|
+
* `nowMs` itself with confirmed real-time access, else `nowMs` minus the
|
|
248
|
+
* served delay (the gate's own `delaySeconds` once known, the plane's delayed
|
|
249
|
+
* default until then: 10 minutes on CME, 15 on OPRA; unknown access reads
|
|
250
|
+
* delayed-safe, as the cache key does). Anything that counts bars against the
|
|
251
|
+
* schedule reads it on THIS clock: a delayed 1m CME chart is ten bars behind
|
|
252
|
+
* the wall clock by construction (an OPRA chart fifteen), and the market it
|
|
253
|
+
* shows opens and closes that much late. Venues no gate plane governs are
|
|
254
|
+
* served live.
|
|
255
|
+
*/
|
|
256
|
+
export function cmeServedNowMs(nowMs, exchange) {
|
|
257
|
+
if (gateProviderForExchange(exchange) === null)
|
|
258
|
+
return nowMs;
|
|
259
|
+
const access = cmeServedAccessForExchange(exchange);
|
|
260
|
+
if (access.status === 'known' && access.timing === 'realtime')
|
|
261
|
+
return nowMs;
|
|
262
|
+
const delaySeconds = access.status === 'known' && typeof access.delaySeconds === 'number' && Number.isFinite(access.delaySeconds)
|
|
263
|
+
? Math.max(0, access.delaySeconds)
|
|
264
|
+
: delayedDefaultSecondsFor(exchange);
|
|
265
|
+
return nowMs - delaySeconds * 1000;
|
|
266
|
+
}
|
|
267
|
+
// ─── The session containing now (cached paints) ──────────────────────────────
|
|
268
|
+
/** The Chicago calendar date `days` before a wall-clock reading, month and
|
|
269
|
+
* year rollover included. Date arithmetic on the parts, never on the instant:
|
|
270
|
+
* stepping the instant by 24 h lands on the wrong date within an hour of
|
|
271
|
+
* midnight across a DST weekend. */
|
|
272
|
+
function chicagoDateDaysBefore(p, days) {
|
|
273
|
+
const date = new Date(Date.UTC(p.year, p.month - 1, p.day - days));
|
|
274
|
+
return { year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate() };
|
|
275
|
+
}
|
|
276
|
+
/** The Globex session containing `nowMs`: the most recent 17:00 CT open at
|
|
277
|
+
* or before it (Sunday's open for Monday's session), null across a halt. */
|
|
278
|
+
function globexSessionStartMs(nowMs) {
|
|
279
|
+
if (!isGovernedFuturesScheduleOpen(nowMs))
|
|
280
|
+
return null;
|
|
281
|
+
const p = wallClockPartsAt(nowMs);
|
|
282
|
+
const openDate = p.hour >= OPEN_HOUR ? p : chicagoDateDaysBefore(p, 1);
|
|
283
|
+
return chicagoWallTimeToUtc(openDate.year, openDate.month, openDate.day, OPEN_HOUR);
|
|
284
|
+
}
|
|
285
|
+
/** The always-on session containing `nowMs`: since the most recent Saturday
|
|
286
|
+
* 04:00 CT maintenance end (or the program's launch instant during its first
|
|
287
|
+
* week), null inside the maintenance window. */
|
|
288
|
+
function alwaysOnSessionStartMs(nowMs, sinceMs) {
|
|
289
|
+
const p = wallClockPartsAt(nowMs);
|
|
290
|
+
const mow = minutesOfWeek(p);
|
|
291
|
+
if (mow >= ALWAYS_ON_MAINTENANCE_START_MIN && mow < ALWAYS_ON_MAINTENANCE_END_MIN)
|
|
292
|
+
return null;
|
|
293
|
+
// Days back to the Saturday whose 04:00 CT is at or before now: this one
|
|
294
|
+
// once past the window, the previous one before it (Sunday is one day past
|
|
295
|
+
// a Saturday, Friday six).
|
|
296
|
+
const daysBack = p.weekday === 6 ? (p.hour >= ALWAYS_ON_MAINTENANCE_END_HOUR ? 0 : 7) : p.weekday + 1;
|
|
297
|
+
const d = chicagoDateDaysBefore(p, daysBack);
|
|
298
|
+
return Math.max(sinceMs, chicagoWallTimeToUtc(d.year, d.month, d.day, ALWAYS_ON_MAINTENANCE_END_HOUR));
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* UTC ms the trading session containing `nowMs` opened, or null when the
|
|
302
|
+
* market (in the chart's session mode) is closed at `nowMs`.
|
|
303
|
+
*
|
|
304
|
+
* The cached-paint session rule counts missing bars only inside one session,
|
|
305
|
+
* never across a close, so it needs the open instant of the session that is
|
|
306
|
+
* trading right now, in the session mode the chart receives bars for:
|
|
307
|
+
*
|
|
308
|
+
* - RTH (`opts.rth`, a symbol with an RTH window): today's RTH window on a
|
|
309
|
+
* weekday, the 09:30 New York open (09:00 on NYMEX, the venue's window from
|
|
310
|
+
* rth-session.util). Outside it the RTH chart receives no
|
|
311
|
+
* bars, so it is closed; Saturday and Sunday have window bounds on the
|
|
312
|
+
* calendar but no session.
|
|
313
|
+
* - ETH, always-on roots (after their launch instant): since the last
|
|
314
|
+
* Saturday 04:00 CT maintenance end.
|
|
315
|
+
* - ETH, the weekly cycle: since the most recent 17:00 CT open.
|
|
316
|
+
*
|
|
317
|
+
* Holidays and early closes are unknown here by design (module doc): on
|
|
318
|
+
* those days the schedule reads open and consumers must degrade safely.
|
|
319
|
+
* Clock-agnostic: consumers judging served data pass `cmeServedNowMs`.
|
|
320
|
+
*/
|
|
321
|
+
export function currentCmeSessionStartMs(nowMs, opts) {
|
|
322
|
+
if (!Number.isFinite(nowMs))
|
|
323
|
+
return null;
|
|
324
|
+
if (opts.rth && getRthWindowForSymbol(opts.symbol) !== null) {
|
|
325
|
+
// Every RTH window sits inside one Chicago calendar day too (08:30-15:15
|
|
326
|
+
// CT, 08:00-13:30 CT on NYMEX), so the venue weekday is read on the same
|
|
327
|
+
// formatter as the cycle.
|
|
328
|
+
const weekday = wallClockPartsAt(nowMs).weekday;
|
|
329
|
+
if (weekday === 0 || weekday === 6)
|
|
330
|
+
return null;
|
|
331
|
+
return rthSessionOpenMs(opts.symbol, nowMs);
|
|
332
|
+
}
|
|
333
|
+
const sinceMs = cmeAlwaysOnSinceMs(opts.symbol);
|
|
334
|
+
if (sinceMs !== null && nowMs >= sinceMs)
|
|
335
|
+
return alwaysOnSessionStartMs(nowMs, sinceMs);
|
|
336
|
+
return globexSessionStartMs(nowMs);
|
|
337
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { MarketKind } from '../../interfaces/market-kind.interface.js';
|
|
2
|
+
import { type IMarketCapabilities } from '../../constants/marketCapabilities.constants.js';
|
|
3
|
+
import { type OmTargetMetadata } from './om-target.util.js';
|
|
4
|
+
/**
|
|
5
|
+
* The frontend's market-kind vocabulary: TitanCharts' `MarketKind` union plus
|
|
6
|
+
* FE-owned kinds for governed CME venues (`'futures'`), HyperLiquid
|
|
7
|
+
* prediction markets (`'hip4'`) and economic series (`'economic'`: FRED and
|
|
8
|
+
* the ECONOMICS catalog publishers, which the engine still knows as `'fred'`).
|
|
9
|
+
* TitanCharts does not know these kinds; anything handed into the engine
|
|
10
|
+
* narrows through `toTitanMarketKind`.
|
|
11
|
+
*/
|
|
12
|
+
export type VenueMarketKind = Exclude<MarketKind, 'fred'> | 'economic' | 'futures' | 'hip4' | 'options';
|
|
13
|
+
/** Which wire path serves an economic series (see `economicSource`). */
|
|
14
|
+
export type EconomicSource = 'fred' | 'observation';
|
|
15
|
+
/**
|
|
16
|
+
* The one futures policy for every CME-governed exchange. Equivalent to
|
|
17
|
+
* `checkIsFutures`; retained as the spelling used by the many data-plane call
|
|
18
|
+
* sites that read as policy checks rather than kind comparisons.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isCmeFuturesPolicyActive(exchange: string | undefined | null): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the venue's market kind for an exchange code. Case-insensitive;
|
|
23
|
+
* missing or unknown exchanges return `'crypto'`.
|
|
24
|
+
*
|
|
25
|
+
* The governed-venue branch is checked BEFORE the table lookup: CBOT / NYMEX /
|
|
26
|
+
* COMEX are also in EXCHANGE_TO_KIND as `'commodity'`, so a table hit would
|
|
27
|
+
* silently re-enter the legacy commodity treatment at every call site that
|
|
28
|
+
* consults the kind (count fetch, no order flow, no volume overlay).
|
|
29
|
+
*/
|
|
30
|
+
export declare function getMarketKind(exchange: string | undefined | null): VenueMarketKind;
|
|
31
|
+
/** Launchpad addresses are raw, case-sensitive market identities on the regular trade pipeline. */
|
|
32
|
+
export declare function isLaunchpadExchange(exchange: string | null | undefined): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The mint a memecoin market trades, or null. Memecoins ride SOLANA_ONCHAIN as
|
|
35
|
+
* per-venue pool series `<mint>/<QUOTE>:<venue>`; tokenized stocks share that
|
|
36
|
+
* exchange with ticker bases, so a base58 mint base is what marks a memecoin.
|
|
37
|
+
*/
|
|
38
|
+
export declare function memecoinMint(exchange: string | null | undefined, symbol: string | null | undefined): string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Launchpad-only chart behaviour (1s candles, sided bars, served-empty park,
|
|
41
|
+
* quiet-gap carry, COIN-quoted aggregates) applies to a memecoin pool on
|
|
42
|
+
* SOLANA_ONCHAIN exactly as to a launchpad exchange: same burst-traded tokens.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isLaunchpadMarket(exchange: string | null | undefined, symbol?: string | null): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Venues whose live gate emits ONLY sided TRADE_AGG frames. The main-bar
|
|
47
|
+
* branch in live-feed listens for the no-side stream, which for these never
|
|
48
|
+
* arrives, so their forming candle has to be built from the BUY/SELL frames
|
|
49
|
+
* instead. Every gate plane (CME, OPRA) relays the same sided-only lane; the
|
|
50
|
+
* launchpad lanes batch strictly by side too (live-feed's TradeAggBatchers
|
|
51
|
+
* keys on Series.Side, and every on-chain swap carries one), so without the
|
|
52
|
+
* bridge an on-chain chart only moves on refetch — which read as a chart that
|
|
53
|
+
* never moved at all.
|
|
54
|
+
*/
|
|
55
|
+
export declare function venueEmitsOnlySidedTradeAggregates(exchange: string | null | undefined, symbol?: string | null): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Venues where a served-empty window is the market's real state, so the blank
|
|
58
|
+
* boot parks on it instead of treating it as a miss worth retrying. Governed
|
|
59
|
+
* venues of every gate plane close (CME sessions, OPRA's regular hours, and
|
|
60
|
+
* an option contract that has not traded yet); a launchpad token that has not
|
|
61
|
+
* traded yet is the same shape — the wire answered honestly and no amount of
|
|
62
|
+
* retrying conjures rows. Without the launchpad arm a zero-swap memecoin never
|
|
63
|
+
* reaches a terminal state: empty responses record no completion, so the
|
|
64
|
+
* retry key is never suppressed and the chart re-asks forever behind
|
|
65
|
+
* "Retrying data request".
|
|
66
|
+
*/
|
|
67
|
+
export declare function venueParksOnServedEmpty(exchange: string | null | undefined, symbol?: string | null): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Session-bound venues close (nightly breaks, weekends, holidays), so "old"
|
|
70
|
+
* cached bars at boot are routinely the CURRENT state of the market, not
|
|
71
|
+
* misleading staleness. 24/7 venues (crypto, dex, prediction markets) are the
|
|
72
|
+
* opposite: wall-clock age tracks bars-behind. Cache freshness/paintability
|
|
73
|
+
* rules key on this split instead of any venue calendar (frontend holiday
|
|
74
|
+
* knowledge does not exist, and guessing open/closed would freeze a trading
|
|
75
|
+
* market or thrash a closed one). Unknown venues fail to the conservative
|
|
76
|
+
* 24/7 treatment via getMarketKind's crypto default.
|
|
77
|
+
*/
|
|
78
|
+
export declare function isSessionBoundMarketKind(exchange: string | undefined | null): boolean;
|
|
79
|
+
/** Kind-level form of the session-bound split, for call sites that already
|
|
80
|
+
* hold a resolved `VenueMarketKind` (one set, never re-declared). */
|
|
81
|
+
export declare function isSessionBoundKind(kind: VenueMarketKind): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Venues that trade around the clock (crypto spot and perps, on-chain pools,
|
|
84
|
+
* HIP-3 perps): a wire answer short of its window there is the server behind
|
|
85
|
+
* the tape, never a closed market (synthetic-provenance.util, claims never
|
|
86
|
+
* outrank rows). Session-bound venues, prediction markets and economic series
|
|
87
|
+
* are not: their quiet windows are the market.
|
|
88
|
+
*/
|
|
89
|
+
export declare function isContinuousTradingKind(kind: VenueMarketKind): boolean;
|
|
90
|
+
export declare function isContinuousTradingVenue(exchange: string | undefined | null): boolean;
|
|
91
|
+
export declare function getCapabilities(exchange: string | undefined | null): IMarketCapabilities;
|
|
92
|
+
/**
|
|
93
|
+
* Whether an interval switch must re-run every mounted indicator's
|
|
94
|
+
* `synchronizeOverlays` hook. The hook re-derives interval-scoped settings
|
|
95
|
+
* (profile bucket geometry via barHeight/minimumBarHeight, per-candle
|
|
96
|
+
* session grouping, orderbook block sizes), and those indicators exist only
|
|
97
|
+
* on venues served by the V2 TSDB pipeline: `fetchMode: 'period'`. Count-mode
|
|
98
|
+
* venues (tradfi/forex/commodity/dex) mount none of them. Keyed on fetchMode
|
|
99
|
+
* rather than barTimestamps because CME futures have irregular session bars
|
|
100
|
+
* but full order-flow surfaces: skipping them froze footprint/SVP/TPO bucket
|
|
101
|
+
* settings across interval switches (coarse leftovers render block-sized
|
|
102
|
+
* clusters on a finer chart; fine leftovers render sub-pixel, invisible
|
|
103
|
+
* clusters on a coarser one).
|
|
104
|
+
*/
|
|
105
|
+
export declare function supportsIntervalScopedIndicatorSync(exchange: string | undefined | null): boolean;
|
|
106
|
+
export declare function checkIsTradFi(exchange: string | undefined | null): boolean;
|
|
107
|
+
export declare function checkIsPolygon(exchange: string | undefined | null): boolean;
|
|
108
|
+
export declare function checkIsForex(exchange: string | undefined | null): boolean;
|
|
109
|
+
export declare function checkIsCommodity(exchange: string | undefined | null): boolean;
|
|
110
|
+
export declare function checkIsFutures(exchange: string | undefined | null): boolean;
|
|
111
|
+
export declare function checkIsForexOrCommodity(exchange: string | undefined | null): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* The legacy forex/commodity venue family WITH governed futures riding along.
|
|
114
|
+
* For gates that guard session-market semantics or a legacy treatment that must
|
|
115
|
+
* keep matching governed venues: returns what `checkIsForexOrCommodity` returned
|
|
116
|
+
* for CBOT / NYMEX / COMEX before the futures kind existed, and additionally
|
|
117
|
+
* covers CME / GLOBEX, which were never in the commodity table. Sites that
|
|
118
|
+
* instead mean "data-poor venue with no volume/book" keep the bare
|
|
119
|
+
* `checkIsForexOrCommodity`, which correctly frees governed futures.
|
|
120
|
+
*/
|
|
121
|
+
export declare function checkIsForexCommodityOrFutures(exchange: string | undefined | null): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Narrow the FE kind to TitanCharts' `MarketKind` union at the engine
|
|
124
|
+
* boundary. `'futures'` maps to `'commodity'` for session handling; `'hip4'`
|
|
125
|
+
* maps to `'polymarket'` for the prediction renderer; `'economic'` maps to
|
|
126
|
+
* the engine's `'fred'` (single-value series treatment). FE-internal code
|
|
127
|
+
* always sees the honest venue kind.
|
|
128
|
+
*/
|
|
129
|
+
export declare function toTitanMarketKind(kind: VenueMarketKind): MarketKind;
|
|
130
|
+
/**
|
|
131
|
+
* True when TitanCharts must omit the dedicated 'volume' legend overlay:
|
|
132
|
+
* economic series and forex/commodity venues ship no per-bar volume. Governed
|
|
133
|
+
* CME futures DO ship contracts volume on TRADE_AGG bars, so they keep it.
|
|
134
|
+
*/
|
|
135
|
+
export declare function venueOmitsVolumeOverlay(exchange: string | undefined | null): boolean;
|
|
136
|
+
export declare function checkIsDex(exchange: string | undefined | null): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Economic series venue: FRED, the ECONOMICS catalog venue and the observation
|
|
139
|
+
* publishers. Accepts an exchange code or an already-resolved kind, so call
|
|
140
|
+
* sites holding either need no second predicate.
|
|
141
|
+
*/
|
|
142
|
+
export declare function checkIsEconomic(exchangeOrKind: string | undefined | null): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* The wire path of an economic venue: `'fred'` keeps `FRED_OBSERVATION_AGG`,
|
|
145
|
+
* every other economic exchange rides the raw `OBSERVATION` type (C12).
|
|
146
|
+
* Gate on `checkIsEconomic` first; a non-economic code answers `'observation'`.
|
|
147
|
+
*/
|
|
148
|
+
export declare function economicSource(exchange: string | undefined | null): EconomicSource;
|
|
149
|
+
/** @deprecated FRED is one economic source of several; use `checkIsEconomic`. */
|
|
150
|
+
export declare function checkIsFred(exchange: string | undefined | null): boolean;
|
|
151
|
+
export declare function checkIsOmTarget(metadata: OmTargetMetadata): boolean;
|
|
152
|
+
export declare function checkIsHip3(exchange: string | undefined | null): boolean;
|
|
153
|
+
export declare function checkIsHip4(exchange: string | undefined | null): boolean;
|
|
154
|
+
export declare function checkIsPolymarket(exchange: string | undefined | null): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Session-gap widening for wall-clock scan windows that MEAN "N bars".
|
|
157
|
+
*
|
|
158
|
+
* A window sized as N x interval only yields N bars on a 24/7 venue. CME
|
|
159
|
+
* Globex trades ~23h x 5 days = ~115 of every 168 wall hours, so the same
|
|
160
|
+
* window on a session-bound venue under-fills by ~1.46x before holidays
|
|
161
|
+
* (the multimode/backfill/default windows that shipped this way served ~107
|
|
162
|
+
* bars where 250 were intended, 2026-08-10). 1.75 covers the weekend+nightly
|
|
163
|
+
* deficit plus holiday/maintenance margin. The widened value is a SCAN bound
|
|
164
|
+
* only: callers keep their bar-count limit, so a 24/7 venue (factor 1) and
|
|
165
|
+
* the row count served are unchanged; a session-bound venue simply scans far
|
|
166
|
+
* enough back to actually find its N bars. Count-mode venues (tradfi/forex/
|
|
167
|
+
* commodity) never derive windows from bar counts, so in practice this
|
|
168
|
+
* governs the gate planes (CME futures here, OPRA options below).
|
|
169
|
+
*/
|
|
170
|
+
export declare const SESSION_GAP_SCAN_FACTOR = 1.75;
|
|
171
|
+
/**
|
|
172
|
+
* The same widening for the `'options'` kind (OPRA). US equity and index
|
|
173
|
+
* options trade the regular session only, 09:30 to 16:00 New York on
|
|
174
|
+
* weekdays: about 34 of every 168 wall hours (6.5 h x 5, plus the index
|
|
175
|
+
* roots' few extended minutes), so an N-bar window under-fills by
|
|
176
|
+
* 168 / 34 = ~4.9x before holidays. 6 keeps CME's ~1.2x headroom over the raw
|
|
177
|
+
* ratio (1.75 over 1.46) for holidays and early closes. Still a scan bound
|
|
178
|
+
* only: the bar-count limit and the rows served are unchanged.
|
|
179
|
+
*/
|
|
180
|
+
export declare const OPTIONS_SESSION_GAP_SCAN_FACTOR = 6;
|
|
181
|
+
export declare function widenScanPeriodForSessionGaps(exchange: string | undefined | null, periodSec: number): number;
|