@orangecharts/wrun-chart-host 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -8
- package/dist/constants/common.constants.d.ts +15 -0
- package/dist/constants/common.constants.js +23 -0
- package/dist/constants/data-source.constants.d.ts +1 -0
- package/dist/constants/data-source.constants.js +1 -0
- package/dist/constants/economic.constants.d.ts +39 -0
- package/dist/constants/economic.constants.js +77 -0
- package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
- package/dist/constants/etf-covered-coins.constants.js +9 -0
- package/dist/constants/feature-flags.constants.d.ts +60 -0
- package/dist/constants/feature-flags.constants.js +308 -0
- package/dist/constants/feature-limits.constants.d.ts +134 -0
- package/dist/constants/feature-limits.constants.js +155 -0
- package/dist/constants/marketCapabilities.constants.d.ts +87 -0
- package/dist/constants/marketCapabilities.constants.js +213 -0
- package/dist/constants/option-venues.constants.d.ts +100 -0
- package/dist/constants/option-venues.constants.js +167 -0
- package/dist/constants/overlay-data.constants.d.ts +53 -0
- package/dist/constants/overlay-data.constants.js +80 -0
- package/dist/constants/pane-grid.constants.d.ts +15 -0
- package/dist/constants/pane-grid.constants.js +17 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +133 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -0
- package/dist/constants/venue-presets.constants.d.ts +10 -0
- package/dist/constants/venue-presets.constants.js +22 -0
- package/dist/enums/chart.enum.d.ts +68 -0
- package/dist/enums/chart.enum.js +70 -0
- package/dist/helpers/data.helpers.d.ts +2 -0
- package/dist/helpers/data.helpers.js +14 -0
- package/dist/host-env.d.ts +163 -5
- package/dist/host-ports.types.d.ts +431 -0
- package/dist/host-ports.types.js +1 -0
- package/dist/index.d.ts +138 -0
- package/dist/index.js +138 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
- package/dist/interfaces/asset-venue.interface.d.ts +91 -0
- package/dist/interfaces/asset-venue.interface.js +1 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
- package/dist/interfaces/cancel-reason.interface.js +2 -0
- package/dist/interfaces/catalog-display.interface.d.ts +3 -0
- package/dist/interfaces/catalog-display.interface.js +1 -0
- package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
- package/dist/interfaces/cme-realtime.interface.js +46 -0
- package/dist/interfaces/feed.interface.d.ts +80 -0
- package/dist/interfaces/feed.interface.js +7 -0
- package/dist/interfaces/market-kind.interface.d.ts +8 -0
- package/dist/interfaces/market-kind.interface.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
- package/dist/interfaces/opra-realtime.interface.js +105 -0
- package/dist/interfaces/option-instrument.interface.d.ts +32 -0
- package/dist/interfaces/option-instrument.interface.js +1 -0
- package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
- package/dist/interfaces/options-chain-scope.interface.js +7 -0
- package/dist/interfaces/prediction-market.interface.d.ts +88 -0
- package/dist/interfaces/prediction-market.interface.js +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
- package/dist/settings-templates/frvp-fields.d.ts +27 -0
- package/dist/settings-templates/frvp-fields.js +108 -0
- package/dist/settings-templates/index.d.ts +119 -0
- package/dist/settings-templates/index.js +442 -0
- package/dist/settings-templates/indicator-fields.d.ts +56 -0
- package/dist/settings-templates/indicator-fields.js +793 -0
- package/dist/settings-templates/tool-rules.d.ts +59 -0
- package/dist/settings-templates/tool-rules.js +49 -0
- package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
- package/dist/settings-templates/tool-tables.generated.js +1668 -0
- package/dist/utility/blk-market.util.d.ts +5 -0
- package/dist/utility/blk-market.util.js +12 -0
- package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
- package/dist/utility/chart/chart-load-phase.util.js +78 -0
- package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
- package/dist/utility/chart/cme-cache-context.util.js +166 -0
- package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
- package/dist/utility/chart/cme-session-bucket.util.js +343 -0
- package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
- package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
- package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
- package/dist/utility/chart/continuous-contracts.util.js +374 -0
- package/dist/utility/chart/date-labelled-interval.leaf.d.ts +15 -0
- package/dist/utility/chart/date-labelled-interval.leaf.js +19 -0
- package/dist/utility/chart/feed-interval.util.d.ts +119 -0
- package/dist/utility/chart/feed-interval.util.js +321 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
- package/dist/utility/chart/footprint-band.util.d.ts +76 -0
- package/dist/utility/chart/footprint-band.util.js +205 -0
- package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
- package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
- package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
- package/dist/utility/chart/formula-calendar.util.js +59 -0
- package/dist/utility/chart/history-wall.util.d.ts +67 -0
- package/dist/utility/chart/history-wall.util.js +87 -0
- package/dist/utility/chart/index-mode.util.d.ts +66 -0
- package/dist/utility/chart/index-mode.util.js +360 -0
- package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
- package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
- package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
- package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
- package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
- package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
- package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
- package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
- package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
- package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
- package/dist/utility/chart/indicator-run-interval.util.d.ts +130 -0
- package/dist/utility/chart/indicator-run-interval.util.js +268 -0
- package/dist/utility/chart/interval-registry.util.d.ts +23 -0
- package/dist/utility/chart/interval-registry.util.js +83 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
- package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
- package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
- package/dist/utility/chart/live-bucket.util.d.ts +66 -0
- package/dist/utility/chart/live-bucket.util.js +165 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
- package/dist/utility/chart/market-session-schedule.util.js +337 -0
- package/dist/utility/chart/marketKind.util.d.ts +181 -0
- package/dist/utility/chart/marketKind.util.js +371 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
- package/dist/utility/chart/opra-read-access.leaf.js +25 -0
- package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
- package/dist/utility/chart/prediction-identity.util.js +236 -0
- package/dist/utility/chart/rth-session.util.d.ts +352 -0
- package/dist/utility/chart/rth-session.util.js +926 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
- package/dist/utility/chart/titan-constants.pin.js +50 -0
- package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
- package/dist/utility/chart/us-equities-session.util.js +251 -0
- package/dist/utility/chart/window-geometry.leaf.d.ts +119 -0
- package/dist/utility/chart/window-geometry.leaf.js +391 -0
- package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
- package/dist/utility/chart/window-owner.leaf.js +24 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
- package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
- package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
- package/dist/utility/common/safe-math-eval.d.ts +18 -0
- package/dist/utility/common/safe-math-eval.js +160 -0
- package/dist/utility/common/time.util.d.ts +134 -0
- package/dist/utility/common/time.util.js +428 -0
- package/dist/utility/common/transformations.util.d.ts +126 -0
- package/dist/utility/common/transformations.util.js +711 -0
- package/dist/utility/common/visible-timeout.util.d.ts +17 -0
- package/dist/utility/common/visible-timeout.util.js +75 -0
- package/dist/utility/exchange-normalization.util.d.ts +8 -0
- package/dist/utility/exchange-normalization.util.js +32 -0
- package/dist/utility/html-escape.leaf.d.ts +11 -0
- package/dist/utility/html-escape.leaf.js +20 -0
- package/dist/utility/intl-locale.util.d.ts +2 -0
- package/dist/utility/intl-locale.util.js +28 -0
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +50 -19
- package/dist/utility/options/option-symbol.util.d.ts +28 -0
- package/dist/utility/options/option-symbol.util.js +176 -0
- package/dist/utility/options/option-trade-units.util.d.ts +190 -0
- package/dist/utility/options/option-trade-units.util.js +283 -0
- package/dist/utility/options/option-venue.util.d.ts +75 -0
- package/dist/utility/options/option-venue.util.js +85 -0
- package/dist/utility/pool-symbol.leaf.d.ts +34 -0
- package/dist/utility/pool-symbol.leaf.js +95 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
- package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
- package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
- package/dist/utility/v2/gate-plane.util.d.ts +58 -0
- package/dist/utility/v2/gate-plane.util.js +99 -0
- package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
- package/dist/utility/v2/gate-session-latch.util.js +34 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
- package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
- package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/economic.js +79 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
- package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/lanes/index.js +32 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +58 -0
- package/dist/utility/wrun/sources/lanes/option_daily.js +111 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +21 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
- package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
- package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
- package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
- package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
- package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
- package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
- package/dist/utility/wrun/sources/lanes/series.js +321 -0
- package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +215 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +477 -0
- package/dist/utility/wrun/sources/registry.d.ts +21 -0
- package/dist/utility/wrun/sources/registry.js +237 -0
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
- package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
- package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +55 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +126 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +62 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +147 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +70 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +144 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +309 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +350 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +576 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +275 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +207 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +450 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
- package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
- package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
- package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
- package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-deadline.util.js +82 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
- package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
- package/dist/utility/wrun/wrun-frames.d.ts +20 -1
- package/dist/utility/wrun/wrun-frames.js +103 -49
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +27 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
- package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
- package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
- package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
- package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +49 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +115 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
- package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
- package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
- package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
- package/dist/utility/wrun/wrun-panel-mount.lazy.d.ts +10 -0
- package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +377 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +2251 -0
- package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
- package/dist/utility/wrun/wrun-param-map.util.js +581 -0
- package/dist/utility/wrun/wrun-pause-dim.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-pause-dim.util.js +153 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
- package/dist/utility/wrun/wrun-plot-gate.types.d.ts +23 -0
- package/dist/utility/wrun/wrun-plot-gate.types.js +7 -0
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +41 -1
- package/dist/utility/wrun/wrun-refusal.util.js +69 -2
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
- package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
- package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
- package/dist/utility/wrun/wrun-row-source.js +75 -0
- package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
- package/dist/utility/wrun/wrun-run-health.util.js +273 -0
- package/dist/utility/wrun/wrun-run-interval-projection.types.d.ts +14 -0
- package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -0
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
- package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
- package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
- package/dist/utility/wrun-display-name.util.d.ts +33 -0
- package/dist/utility/wrun-display-name.util.js +64 -0
- package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
- package/dist/workers/constants/kscript-transport-codes.js +15 -0
- package/dist/workers/constants/socket-slots.d.ts +574 -0
- package/dist/workers/constants/socket-slots.js +539 -0
- package/dist/workers/utils/number.worker.util.d.ts +5 -0
- package/dist/workers/utils/number.worker.util.js +10 -0
- package/dist/workers/utils/time.worker.util.d.ts +12 -0
- package/dist/workers/utils/time.worker.util.js +24 -0
- package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
- package/dist/workers/utils/volume-profile.worker.util.js +631 -0
- package/package.json +10 -4
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The main-grid stages of the kScript run result's preparation for TitanCharts, split out of
|
|
3
|
+
* kscript-titancharts-integration.util.ts with no change (the adapter imports them back):
|
|
4
|
+
* `alignKScriptIndexDecoratorsToMainChart` lays every plot of a tree that holds an index decorator (a `bgcolor` or
|
|
5
|
+
* `barcolor`) on the chart's bars, and `padContinuousKScriptOutputGapsOnMainGrid` gives a continuous plot a NaN row
|
|
6
|
+
* on every chart bar its own covered span skips. Both read the chart's main bars and nothing else of the chart. A leaf
|
|
7
|
+
* with no app edge, so the wrun chart-host package runs the stages web runs
|
|
8
|
+
* (docs/features/kscript/wrun/wrun-chart-host.md, "Leaves").
|
|
9
|
+
*/
|
|
10
|
+
import { isRecord } from './kscript-run-result-shape.util.js';
|
|
11
|
+
const KSCRIPT_MAIN_INDEX_ALIGNED_PLOT_TYPES = new Set(['bgcolor', 'barcolor']);
|
|
12
|
+
const KSCRIPT_MAIN_INDEX_ALIGNMENT_EXCLUDED_PLOT_TYPES = new Set([
|
|
13
|
+
'hline',
|
|
14
|
+
'label',
|
|
15
|
+
'priceLabel',
|
|
16
|
+
'table',
|
|
17
|
+
'text',
|
|
18
|
+
'verticalLine',
|
|
19
|
+
]);
|
|
20
|
+
// Continuous plot families draw a segment between consecutive rows, so a
|
|
21
|
+
// sparse row set (orderbook buckets with holes, partially covered history)
|
|
22
|
+
// renders as lines connecting across bars the script never computed. Gap
|
|
23
|
+
// padding is bounded to each output's own [first, last] covered span: rows
|
|
24
|
+
// outside the span must stay ABSENT (not explicit NaN) so windowed replays
|
|
25
|
+
// and live batches keep merging as no-ops beyond their window instead of
|
|
26
|
+
// overwriting mounted history, and mounted arrays are never edited in place
|
|
27
|
+
// (the reverted full-grid force-realign blanked cumulative native series).
|
|
28
|
+
const KSCRIPT_CONTINUOUS_GAP_PAD_PLOT_TYPES = new Set([
|
|
29
|
+
'area',
|
|
30
|
+
'band',
|
|
31
|
+
'baseline',
|
|
32
|
+
'deltaFillSpline',
|
|
33
|
+
'fillBetween',
|
|
34
|
+
'histogram',
|
|
35
|
+
'hlcArea',
|
|
36
|
+
'line',
|
|
37
|
+
'momentumFillSpline',
|
|
38
|
+
'spline',
|
|
39
|
+
'stepLine',
|
|
40
|
+
]);
|
|
41
|
+
function plotTypeOf(container) {
|
|
42
|
+
const plotType = container.plotType ?? container.plot;
|
|
43
|
+
return typeof plotType === 'string' ? plotType : undefined;
|
|
44
|
+
}
|
|
45
|
+
function finiteRowTime(row) {
|
|
46
|
+
if (!Array.isArray(row))
|
|
47
|
+
return null;
|
|
48
|
+
const time = row[0];
|
|
49
|
+
return typeof time === 'number' && Number.isFinite(time) ? time : null;
|
|
50
|
+
}
|
|
51
|
+
function outputTreeHasMainIndexAlignedPlot(output, seen = new WeakSet()) {
|
|
52
|
+
if (!isRecord(output) || seen.has(output))
|
|
53
|
+
return false;
|
|
54
|
+
seen.add(output);
|
|
55
|
+
const plotType = plotTypeOf(output);
|
|
56
|
+
if (plotType && KSCRIPT_MAIN_INDEX_ALIGNED_PLOT_TYPES.has(plotType))
|
|
57
|
+
return true;
|
|
58
|
+
if (isRecord(output.outputs) &&
|
|
59
|
+
Object.values(output.outputs).some((child) => outputTreeHasMainIndexAlignedPlot(child, seen))) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return (Array.isArray(output.nestedMeta) &&
|
|
63
|
+
output.nestedMeta.some((child) => outputTreeHasMainIndexAlignedPlot(child, seen)));
|
|
64
|
+
}
|
|
65
|
+
function mainChartMetaForKScript(tc) {
|
|
66
|
+
if (!Array.isArray(tc.metadata))
|
|
67
|
+
return null;
|
|
68
|
+
const mainMeta = tc.metadata.find((meta) => isRecord(meta) && meta.id === 'main') ??
|
|
69
|
+
tc.metadata.find((meta) => isRecord(meta) && meta.type === 'main') ??
|
|
70
|
+
tc.metadata[0];
|
|
71
|
+
return isRecord(mainMeta) ? mainMeta : null;
|
|
72
|
+
}
|
|
73
|
+
function mainChartRowsForKScriptIndexAlignment(tc) {
|
|
74
|
+
const mainMeta = mainChartMetaForKScript(tc);
|
|
75
|
+
if (!mainMeta)
|
|
76
|
+
return [];
|
|
77
|
+
if (Array.isArray(mainMeta.rawData))
|
|
78
|
+
return mainMeta.rawData;
|
|
79
|
+
return Array.isArray(mainMeta.activeData) ? mainMeta.activeData : [];
|
|
80
|
+
}
|
|
81
|
+
function mainChartTimesForKScriptIndexAlignment(tc) {
|
|
82
|
+
const rows = mainChartRowsForKScriptIndexAlignment(tc);
|
|
83
|
+
const times = rows.map(finiteRowTime);
|
|
84
|
+
return times.every((time) => time !== null) ? times : [];
|
|
85
|
+
}
|
|
86
|
+
/** Whether the main times strictly increase (no repeated bar): read once per times array. */
|
|
87
|
+
const strictlyIncreasingMainTimes = new WeakMap();
|
|
88
|
+
function mainTimesStrictlyIncrease(mainTimes) {
|
|
89
|
+
let verdict = strictlyIncreasingMainTimes.get(mainTimes);
|
|
90
|
+
if (verdict === undefined) {
|
|
91
|
+
verdict = true;
|
|
92
|
+
for (let index = 1; index < mainTimes.length; index += 1) {
|
|
93
|
+
if (!(mainTimes[index] > mainTimes[index - 1])) {
|
|
94
|
+
verdict = false;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
strictlyIncreasingMainTimes.set(mainTimes, verdict);
|
|
99
|
+
}
|
|
100
|
+
return verdict;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The aligned rows of a row set that already sits on a prefix of the main
|
|
104
|
+
* grid (row i stamped mainTimes[i], every row an array, the grid strictly
|
|
105
|
+
* increasing): the rows themselves when they cover the grid, else the rows
|
|
106
|
+
* followed by a NaN filler per newer bar. Exactly what the general walk below
|
|
107
|
+
* returns for such rows, without its per-call set, map and copy (a mounted
|
|
108
|
+
* overlay's rows sit on the grid after every apply, so the live realigns of
|
|
109
|
+
* an index-decorated overlay take this branch). Null when the rows are off
|
|
110
|
+
* the grid prefix: the general walk decides.
|
|
111
|
+
*/
|
|
112
|
+
function alignRowsOnMainGridPrefix(rows, mainTimes) {
|
|
113
|
+
if (rows.length > mainTimes.length || !mainTimesStrictlyIncrease(mainTimes))
|
|
114
|
+
return null;
|
|
115
|
+
let payloadWidth = 1;
|
|
116
|
+
for (let index = 0; index < rows.length; index += 1) {
|
|
117
|
+
const row = rows[index];
|
|
118
|
+
if (!Array.isArray(row) || row[0] !== mainTimes[index])
|
|
119
|
+
return null;
|
|
120
|
+
payloadWidth = Math.max(payloadWidth, row.length - 1);
|
|
121
|
+
}
|
|
122
|
+
if (rows.length === mainTimes.length)
|
|
123
|
+
return rows;
|
|
124
|
+
const aligned = rows.slice();
|
|
125
|
+
for (let index = rows.length; index < mainTimes.length; index += 1) {
|
|
126
|
+
aligned.push([mainTimes[index], ...Array.from({ length: payloadWidth }, () => Number.NaN)]);
|
|
127
|
+
}
|
|
128
|
+
return aligned;
|
|
129
|
+
}
|
|
130
|
+
function alignRowsToMainChartIndex(rows, mainTimes, options = {}) {
|
|
131
|
+
if (!Array.isArray(rows) || rows.length === 0 || mainTimes.length === 0)
|
|
132
|
+
return rows;
|
|
133
|
+
const onGrid = alignRowsOnMainGridPrefix(rows, mainTimes);
|
|
134
|
+
if (onGrid !== null)
|
|
135
|
+
return onGrid;
|
|
136
|
+
const mainTimeSet = new Set(mainTimes);
|
|
137
|
+
const rowsByTime = new Map();
|
|
138
|
+
let finiteRows = 0;
|
|
139
|
+
let matchedRows = 0;
|
|
140
|
+
let payloadWidth = 1;
|
|
141
|
+
for (const row of rows) {
|
|
142
|
+
if (!Array.isArray(row))
|
|
143
|
+
continue;
|
|
144
|
+
payloadWidth = Math.max(payloadWidth, row.length - 1);
|
|
145
|
+
const timestamp = finiteRowTime(row);
|
|
146
|
+
if (timestamp === null)
|
|
147
|
+
continue;
|
|
148
|
+
finiteRows += 1;
|
|
149
|
+
if (!mainTimeSet.has(timestamp))
|
|
150
|
+
continue;
|
|
151
|
+
matchedRows += 1;
|
|
152
|
+
rowsByTime.set(timestamp, row);
|
|
153
|
+
}
|
|
154
|
+
if (finiteRows === 0)
|
|
155
|
+
return rows;
|
|
156
|
+
if (!options.force && matchedRows === 0)
|
|
157
|
+
return rows;
|
|
158
|
+
if (!options.force && matchedRows < Math.ceil(finiteRows * 0.8))
|
|
159
|
+
return rows;
|
|
160
|
+
let changed = rows.length !== mainTimes.length;
|
|
161
|
+
const alignedRows = mainTimes.map((timestamp, index) => {
|
|
162
|
+
const existingRow = rowsByTime.get(timestamp);
|
|
163
|
+
if (existingRow) {
|
|
164
|
+
changed ||= existingRow !== rows[index];
|
|
165
|
+
return existingRow;
|
|
166
|
+
}
|
|
167
|
+
changed = true;
|
|
168
|
+
return [timestamp, ...Array.from({ length: payloadWidth }, () => Number.NaN)];
|
|
169
|
+
});
|
|
170
|
+
return changed ? alignedRows : rows;
|
|
171
|
+
}
|
|
172
|
+
function shouldAlignOutputRowsToMainChartIndex(output) {
|
|
173
|
+
const plotType = plotTypeOf(output);
|
|
174
|
+
return !plotType || !KSCRIPT_MAIN_INDEX_ALIGNMENT_EXCLUDED_PLOT_TYPES.has(plotType);
|
|
175
|
+
}
|
|
176
|
+
function alignKScriptOutputTreeToMainChartIndex(output, mainTimes) {
|
|
177
|
+
if (!isRecord(output))
|
|
178
|
+
return output;
|
|
179
|
+
let normalized = output;
|
|
180
|
+
const clone = () => {
|
|
181
|
+
if (normalized === output)
|
|
182
|
+
normalized = { ...output };
|
|
183
|
+
return normalized;
|
|
184
|
+
};
|
|
185
|
+
if (shouldAlignOutputRowsToMainChartIndex(output)) {
|
|
186
|
+
for (const key of ['data', 'rawData', 'activeData']) {
|
|
187
|
+
const alignedRows = alignRowsToMainChartIndex(output[key], mainTimes, { force: true });
|
|
188
|
+
if (alignedRows !== output[key])
|
|
189
|
+
clone()[key] = alignedRows;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (isRecord(output.outputs)) {
|
|
193
|
+
let outputs = output.outputs;
|
|
194
|
+
let outputsChanged = false;
|
|
195
|
+
for (const [key, childOutput] of Object.entries(output.outputs)) {
|
|
196
|
+
const normalizedChild = alignKScriptOutputTreeToMainChartIndex(childOutput, mainTimes);
|
|
197
|
+
if (normalizedChild !== childOutput) {
|
|
198
|
+
if (!outputsChanged) {
|
|
199
|
+
outputs = { ...output.outputs };
|
|
200
|
+
outputsChanged = true;
|
|
201
|
+
}
|
|
202
|
+
outputs[key] = normalizedChild;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (outputsChanged)
|
|
206
|
+
clone().outputs = outputs;
|
|
207
|
+
}
|
|
208
|
+
if (Array.isArray(output.nestedMeta)) {
|
|
209
|
+
let nestedChanged = false;
|
|
210
|
+
const nestedMeta = output.nestedMeta.map((childOutput) => {
|
|
211
|
+
const normalizedChild = alignKScriptOutputTreeToMainChartIndex(childOutput, mainTimes);
|
|
212
|
+
nestedChanged ||= normalizedChild !== childOutput;
|
|
213
|
+
return normalizedChild;
|
|
214
|
+
});
|
|
215
|
+
if (nestedChanged)
|
|
216
|
+
clone().nestedMeta = nestedMeta;
|
|
217
|
+
}
|
|
218
|
+
return normalized;
|
|
219
|
+
}
|
|
220
|
+
function alignKScriptIndexDecoratorsToMainChart(runResult, tc) {
|
|
221
|
+
if (!outputTreeHasMainIndexAlignedPlot(runResult))
|
|
222
|
+
return runResult;
|
|
223
|
+
const mainTimes = mainChartTimesForKScriptIndexAlignment(tc);
|
|
224
|
+
if (mainTimes.length === 0)
|
|
225
|
+
return runResult;
|
|
226
|
+
return alignKScriptOutputTreeToMainChartIndex(runResult, mainTimes);
|
|
227
|
+
}
|
|
228
|
+
function outputTreeHasContinuousGapPadPlot(output, seen = new WeakSet()) {
|
|
229
|
+
if (!isRecord(output) || seen.has(output))
|
|
230
|
+
return false;
|
|
231
|
+
seen.add(output);
|
|
232
|
+
const plotType = plotTypeOf(output);
|
|
233
|
+
if (plotType && KSCRIPT_CONTINUOUS_GAP_PAD_PLOT_TYPES.has(plotType))
|
|
234
|
+
return true;
|
|
235
|
+
if (isRecord(output.outputs) &&
|
|
236
|
+
Object.values(output.outputs).some((child) => outputTreeHasContinuousGapPadPlot(child, seen))) {
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
return (Array.isArray(output.nestedMeta) &&
|
|
240
|
+
output.nestedMeta.some((child) => outputTreeHasContinuousGapPadPlot(child, seen)));
|
|
241
|
+
}
|
|
242
|
+
function padContinuousRowGapsWithinSpan(rows, mainTimes) {
|
|
243
|
+
if (!Array.isArray(rows) || rows.length < 2 || mainTimes.length === 0)
|
|
244
|
+
return rows;
|
|
245
|
+
let firstTs = Number.POSITIVE_INFINITY;
|
|
246
|
+
let lastTs = Number.NEGATIVE_INFINITY;
|
|
247
|
+
let payloadWidth = 1;
|
|
248
|
+
const rowTimes = new Set();
|
|
249
|
+
for (const row of rows) {
|
|
250
|
+
const timestamp = finiteRowTime(row);
|
|
251
|
+
// A row we cannot place on the time axis makes ordering ambiguous; padding
|
|
252
|
+
// must be a no-op rather than risk resorting rows it does not understand.
|
|
253
|
+
if (timestamp === null)
|
|
254
|
+
return rows;
|
|
255
|
+
payloadWidth = Math.max(payloadWidth, row.length - 1);
|
|
256
|
+
rowTimes.add(timestamp);
|
|
257
|
+
if (timestamp < firstTs)
|
|
258
|
+
firstTs = timestamp;
|
|
259
|
+
if (timestamp > lastTs)
|
|
260
|
+
lastTs = timestamp;
|
|
261
|
+
}
|
|
262
|
+
if (!(firstTs < lastTs))
|
|
263
|
+
return rows;
|
|
264
|
+
const gapRows = [];
|
|
265
|
+
for (const timestamp of mainTimes) {
|
|
266
|
+
if (timestamp <= firstTs || timestamp >= lastTs || rowTimes.has(timestamp))
|
|
267
|
+
continue;
|
|
268
|
+
rowTimes.add(timestamp);
|
|
269
|
+
gapRows.push([timestamp, ...Array.from({ length: payloadWidth }, () => Number.NaN)]);
|
|
270
|
+
}
|
|
271
|
+
if (gapRows.length === 0)
|
|
272
|
+
return rows;
|
|
273
|
+
const padded = [...rows, ...gapRows];
|
|
274
|
+
padded.sort((left, right) => finiteRowTime(left) - finiteRowTime(right));
|
|
275
|
+
return padded;
|
|
276
|
+
}
|
|
277
|
+
function padContinuousKScriptOutputTreeGaps(output, mainTimes) {
|
|
278
|
+
if (!isRecord(output))
|
|
279
|
+
return output;
|
|
280
|
+
let normalized = output;
|
|
281
|
+
const clone = () => {
|
|
282
|
+
if (normalized === output)
|
|
283
|
+
normalized = { ...output };
|
|
284
|
+
return normalized;
|
|
285
|
+
};
|
|
286
|
+
const plotType = plotTypeOf(output);
|
|
287
|
+
if (plotType && KSCRIPT_CONTINUOUS_GAP_PAD_PLOT_TYPES.has(plotType)) {
|
|
288
|
+
for (const key of ['data', 'rawData', 'activeData']) {
|
|
289
|
+
const paddedRows = padContinuousRowGapsWithinSpan(output[key], mainTimes);
|
|
290
|
+
if (paddedRows !== output[key])
|
|
291
|
+
clone()[key] = paddedRows;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (isRecord(output.outputs)) {
|
|
295
|
+
let outputs = output.outputs;
|
|
296
|
+
let outputsChanged = false;
|
|
297
|
+
for (const [key, childOutput] of Object.entries(output.outputs)) {
|
|
298
|
+
const paddedChild = padContinuousKScriptOutputTreeGaps(childOutput, mainTimes);
|
|
299
|
+
if (paddedChild !== childOutput) {
|
|
300
|
+
if (!outputsChanged) {
|
|
301
|
+
outputs = { ...output.outputs };
|
|
302
|
+
outputsChanged = true;
|
|
303
|
+
}
|
|
304
|
+
outputs[key] = paddedChild;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (outputsChanged)
|
|
308
|
+
clone().outputs = outputs;
|
|
309
|
+
}
|
|
310
|
+
if (Array.isArray(output.nestedMeta)) {
|
|
311
|
+
let nestedChanged = false;
|
|
312
|
+
const nestedMeta = output.nestedMeta.map((childOutput) => {
|
|
313
|
+
const paddedChild = padContinuousKScriptOutputTreeGaps(childOutput, mainTimes);
|
|
314
|
+
nestedChanged ||= paddedChild !== childOutput;
|
|
315
|
+
return paddedChild;
|
|
316
|
+
});
|
|
317
|
+
if (nestedChanged)
|
|
318
|
+
clone().nestedMeta = nestedMeta;
|
|
319
|
+
}
|
|
320
|
+
return normalized;
|
|
321
|
+
}
|
|
322
|
+
function padContinuousKScriptOutputGapsOnMainGrid(runResult, tc) {
|
|
323
|
+
if (!outputTreeHasContinuousGapPadPlot(runResult))
|
|
324
|
+
return runResult;
|
|
325
|
+
const mainTimes = mainChartTimesForKScriptIndexAlignment(tc);
|
|
326
|
+
if (mainTimes.length === 0)
|
|
327
|
+
return runResult;
|
|
328
|
+
return padContinuousKScriptOutputTreeGaps(runResult, mainTimes);
|
|
329
|
+
}
|
|
330
|
+
export { alignKScriptIndexDecoratorsToMainChart, padContinuousKScriptOutputGapsOnMainGrid,
|
|
331
|
+
// The adapter's own steps read these too (the mounted realign, the run-interval projection, the live tail view).
|
|
332
|
+
alignRowsToMainChartIndex, finiteRowTime, mainChartMetaForKScript, mainChartRowsForKScriptIndexAlignment, mainChartTimesForKScriptIndexAlignment, outputTreeHasMainIndexAlignedPlot, plotTypeOf, shouldAlignOutputRowsToMainChartIndex, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The listing-venue rewrite of legacy-exchange.util.ts (which re-exports `normalizeLegacyExchange` and reads the table
|
|
3
|
+
* for its formula tokens) as a leaf with no imports: the wrun pin steps read it, and they move into the wrun
|
|
4
|
+
* chart-host package, which the util's feed repair (the metadata service) and its formula delimiter
|
|
5
|
+
* (constants/chart.constants, which loads the i18n plugin) may not reach.
|
|
6
|
+
*
|
|
7
|
+
* Pre-flip persisted records carry the translated listing venue as the query exchange (e.g. NASDAQ): the table maps
|
|
8
|
+
* each to the raw vendor code the backend queries (legacy-exchange.util tells the whole lazy migration).
|
|
9
|
+
*/
|
|
10
|
+
export declare const LEGACY_VENUE_TO_QUERY_EXCHANGE: Readonly<Record<string, string>>;
|
|
11
|
+
export declare function normalizeLegacyExchange(exchange: string | undefined | null): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The listing-venue rewrite of legacy-exchange.util.ts (which re-exports `normalizeLegacyExchange` and reads the table
|
|
3
|
+
* for its formula tokens) as a leaf with no imports: the wrun pin steps read it, and they move into the wrun
|
|
4
|
+
* chart-host package, which the util's feed repair (the metadata service) and its formula delimiter
|
|
5
|
+
* (constants/chart.constants, which loads the i18n plugin) may not reach.
|
|
6
|
+
*
|
|
7
|
+
* Pre-flip persisted records carry the translated listing venue as the query exchange (e.g. NASDAQ): the table maps
|
|
8
|
+
* each to the raw vendor code the backend queries (legacy-exchange.util tells the whole lazy migration).
|
|
9
|
+
*/
|
|
10
|
+
export const LEGACY_VENUE_TO_QUERY_EXCHANGE = {
|
|
11
|
+
NYSE: 'POLYGON',
|
|
12
|
+
NYSE_AMERICAN: 'POLYGON',
|
|
13
|
+
NYSE_NATIONAL: 'POLYGON',
|
|
14
|
+
NYSE_ARCA: 'POLYGON',
|
|
15
|
+
NYSE_CHICAGO: 'POLYGON',
|
|
16
|
+
NASDAQ: 'POLYGON',
|
|
17
|
+
NASDAQ_BX: 'POLYGON',
|
|
18
|
+
NASDAQ_ISE: 'POLYGON',
|
|
19
|
+
NASDAQ_PHILADELPHIA: 'POLYGON',
|
|
20
|
+
NASDAQ_PSX: 'POLYGON',
|
|
21
|
+
NASDAQ_INT: 'POLYGON',
|
|
22
|
+
CBOE: 'POLYGON',
|
|
23
|
+
CBOE_EDGA: 'POLYGON',
|
|
24
|
+
CBOE_EDGX: 'POLYGON',
|
|
25
|
+
CBOE_BYX: 'POLYGON',
|
|
26
|
+
CBOE_BZX: 'POLYGON',
|
|
27
|
+
IEX: 'POLYGON',
|
|
28
|
+
LTSE: 'POLYGON',
|
|
29
|
+
MIAX_PEARL: 'POLYGON',
|
|
30
|
+
MEMBERS_EXCHANGE: 'POLYGON',
|
|
31
|
+
OTC_EQUITY_SECURITY: 'POLYGON',
|
|
32
|
+
FINRA: 'POLYGON',
|
|
33
|
+
// Display-form venue strings found stored AS the exchange in prod
|
|
34
|
+
// (historical write bugs; 2026-07-28 prod discovery).
|
|
35
|
+
'NYSE.F': 'POLYGON',
|
|
36
|
+
'NASDAQ.F': 'POLYGON',
|
|
37
|
+
'CBOE.F': 'POLYGON',
|
|
38
|
+
};
|
|
39
|
+
export function normalizeLegacyExchange(exchange) {
|
|
40
|
+
if (!exchange)
|
|
41
|
+
return exchange ?? '';
|
|
42
|
+
return LEGACY_VENUE_TO_QUERY_EXCHANGE[exchange.toUpperCase()] ?? exchange;
|
|
43
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bar a live frame belongs to: ONE boundary source for every live writer
|
|
3
|
+
* (titan's main merger, the CME forming-bar bridge, the cache-paint gate, the
|
|
4
|
+
* lite-pane tick queue, the live fetch window), keyed exactly the way the
|
|
5
|
+
* gateway buckets the history those writers extend. A writer that floors on
|
|
6
|
+
* its own grid splits the forming bar wherever the grids disagree.
|
|
7
|
+
*
|
|
8
|
+
* `venue` is the SERIES being merged (a comparison leg passes its own
|
|
9
|
+
* exchange and symbol, never the chart's). Precedence:
|
|
10
|
+
* 1. calendar (1M 3M 6M 1Y): the CME trade-date months on a CME venue
|
|
11
|
+
* (cme-session-bucket.util), else the UTC calendar boundary (the month's
|
|
12
|
+
* 1st, quarters and halves from January, January 1; calendar-interval.util),
|
|
13
|
+
* never the average-length floor;
|
|
14
|
+
* 2. weekly: the CME trade-date week on a CME venue, else `findMonday`;
|
|
15
|
+
* 3. chart RTH above the 30m grid: the bucket anchored at the venue's RTH
|
|
16
|
+
* open (09:30 New York, 09:00 on NYMEX; rth-session.util);
|
|
17
|
+
* 4. regular-session US equities: the 09:30 anchored bucket from 45m to 12h,
|
|
18
|
+
* the three-trade-date group at 3d;
|
|
19
|
+
* 5. a CME venue on the Chicago session lattice (45m to 12h, 1d, 3d:
|
|
20
|
+
* cme-session-bucket.util);
|
|
21
|
+
* 6. everything else: the UTC floor.
|
|
22
|
+
* Null means the frame has no bucket (off-session under 3 or 4): drop it.
|
|
23
|
+
*/
|
|
24
|
+
export interface LiveBucketVenue {
|
|
25
|
+
exchange?: unknown;
|
|
26
|
+
symbol?: unknown;
|
|
27
|
+
sessionType?: unknown;
|
|
28
|
+
/** A formula chart's expression: its legs, not `exchange`, decide the lattice. */
|
|
29
|
+
transformations?: unknown;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A chart's bar-grid identity as a worker reads it (plain, cloneable fields only): the venue a worker
|
|
33
|
+
* keys its rows by, so they land on the chart's own candles (`liveBucketStartMs`).
|
|
34
|
+
*/
|
|
35
|
+
export declare function liveBucketVenueOf(metadata: {
|
|
36
|
+
exchange?: unknown;
|
|
37
|
+
symbol?: unknown;
|
|
38
|
+
sessionType?: unknown;
|
|
39
|
+
transformations?: unknown;
|
|
40
|
+
} | null | undefined): LiveBucketVenue;
|
|
41
|
+
/** Whether the series' history rides the CME session lattice: its formula's timeline legs, else its exchange. */
|
|
42
|
+
export declare function isCmeSessionLatticeVenue(venue: LiveBucketVenue | null | undefined): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The plain bar grid: calendar bars start on their UTC calendar boundary,
|
|
45
|
+
* weekly bars on `findMonday`, everything else on the UTC floor.
|
|
46
|
+
*/
|
|
47
|
+
export declare function plainBucketStartMs(tsMs: number, intervalMs: number): number;
|
|
48
|
+
/**
|
|
49
|
+
* The CME session-lattice bar for a series whose history never anchors to a
|
|
50
|
+
* trading-hours grid of its own (overlays and script sources fetching the
|
|
51
|
+
* full session), or null off the lattice, where the caller keeps
|
|
52
|
+
* `plainBucketStartMs`. `venue` is the SERIES' own market (a comparison leg
|
|
53
|
+
* or a CVD basket names its own). Its `sessionType` is ignored on purpose,
|
|
54
|
+
* so these writers never start anchoring to chart RTH or the regular
|
|
55
|
+
* equities session.
|
|
56
|
+
*/
|
|
57
|
+
export declare function cmeSessionLatticeBucketMs(tsMs: number, intervalMs: number, venue: LiveBucketVenue | null | undefined): number | null;
|
|
58
|
+
export declare function liveBucketStartMs(tsMs: number, intervalMs: number, venue?: LiveBucketVenue | null): number | null;
|
|
59
|
+
/**
|
|
60
|
+
* The starts of the venue's bars that open inside `[fromMs, toMs]`, ascending, each keyed by
|
|
61
|
+
* `liveBucketStartMs`: a regular-session stock chart's hourly columns sit on its 13:30Z (EDT) candles,
|
|
62
|
+
* a CME chart's on its session lattice, and an off-session instant contributes none. The bar holding
|
|
63
|
+
* `fromMs` counts only when it opens inside the range. A probe still inside the last bar (a lattice
|
|
64
|
+
* bar the fall-back Sunday stretches) or off session steps forward a quarter hour at most.
|
|
65
|
+
*/
|
|
66
|
+
export declare function liveBucketStartsInRange(fromMs: number, toMs: number, intervalMs: number, venue?: LiveBucketVenue | null): number[];
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bar a live frame belongs to: ONE boundary source for every live writer
|
|
3
|
+
* (titan's main merger, the CME forming-bar bridge, the cache-paint gate, the
|
|
4
|
+
* lite-pane tick queue, the live fetch window), keyed exactly the way the
|
|
5
|
+
* gateway buckets the history those writers extend. A writer that floors on
|
|
6
|
+
* its own grid splits the forming bar wherever the grids disagree.
|
|
7
|
+
*
|
|
8
|
+
* `venue` is the SERIES being merged (a comparison leg passes its own
|
|
9
|
+
* exchange and symbol, never the chart's). Precedence:
|
|
10
|
+
* 1. calendar (1M 3M 6M 1Y): the CME trade-date months on a CME venue
|
|
11
|
+
* (cme-session-bucket.util), else the UTC calendar boundary (the month's
|
|
12
|
+
* 1st, quarters and halves from January, January 1; calendar-interval.util),
|
|
13
|
+
* never the average-length floor;
|
|
14
|
+
* 2. weekly: the CME trade-date week on a CME venue, else `findMonday`;
|
|
15
|
+
* 3. chart RTH above the 30m grid: the bucket anchored at the venue's RTH
|
|
16
|
+
* open (09:30 New York, 09:00 on NYMEX; rth-session.util);
|
|
17
|
+
* 4. regular-session US equities: the 09:30 anchored bucket from 45m to 12h,
|
|
18
|
+
* the three-trade-date group at 3d;
|
|
19
|
+
* 5. a CME venue on the Chicago session lattice (45m to 12h, 1d, 3d:
|
|
20
|
+
* cme-session-bucket.util);
|
|
21
|
+
* 6. everything else: the UTC floor.
|
|
22
|
+
* Null means the frame has no bucket (off-session under 3 or 4): drop it.
|
|
23
|
+
*/
|
|
24
|
+
import { findMonday, TimeIntervalConstant } from './titan-constants.pin.js';
|
|
25
|
+
import { cmeSessionBucketMs, isCmeSessionLatticeExchange, isCmeSessionLatticeIntervalMs, } from './cme-session-bucket.util.js';
|
|
26
|
+
import { Intervals } from '../../constants/interval.constants.js';
|
|
27
|
+
import { calendarBarStartMs, calendarMonthsOfMs } from './calendar-interval.util.js';
|
|
28
|
+
import { formulaCalendarPlan, formulaLegExchange } from './formula-calendar.util.js';
|
|
29
|
+
import { checkIsEconomic } from './marketKind.util.js';
|
|
30
|
+
import { extractTokensFromTransformations, parsedTransformations } from '../common/transformations.util.js';
|
|
31
|
+
import { isChartRthActive, isFootprintRthFoldTfMs, isRthBucketExactIntervalMs, rthAnchoredBucketStartMs, } from './rth-session.util.js';
|
|
32
|
+
import { isEquityRegularSessionGated, usEquityAnchoredBucketStartMs, usEquitySessionGridBucketStartMs, } from './us-equities-session.util.js';
|
|
33
|
+
const THREE_DAYS_MS = Intervals.map_unit['3d'];
|
|
34
|
+
/**
|
|
35
|
+
* A chart's bar-grid identity as a worker reads it (plain, cloneable fields only): the venue a worker
|
|
36
|
+
* keys its rows by, so they land on the chart's own candles (`liveBucketStartMs`).
|
|
37
|
+
*/
|
|
38
|
+
export function liveBucketVenueOf(metadata) {
|
|
39
|
+
return {
|
|
40
|
+
exchange: metadata?.exchange,
|
|
41
|
+
symbol: metadata?.symbol,
|
|
42
|
+
sessionType: metadata?.sessionType,
|
|
43
|
+
...(typeof metadata?.transformations === 'string' && { transformations: metadata.transformations }),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const formulaLatticeByExpression = new Map();
|
|
47
|
+
const FORMULA_CACHE_MAX = 256;
|
|
48
|
+
/**
|
|
49
|
+
* Whether a formula's bars ride the CME session lattice, null for a plain
|
|
50
|
+
* expression. The history worker builds a formula on its TIMELINE legs
|
|
51
|
+
* (ohlcv.worker): economic series are carried as of the market legs' bars,
|
|
52
|
+
* and a cross-calendar formula rides its anchor leg (formulaCalendarPlan).
|
|
53
|
+
* Legs are fetched one venue each, so the formula rides the lattice when
|
|
54
|
+
* every timeline leg is a CME Group venue; a CME + crypto formula at 4h
|
|
55
|
+
* shares no stamps to join on and stays off it.
|
|
56
|
+
*/
|
|
57
|
+
function formulaTimelineOnLattice(expression) {
|
|
58
|
+
const cached = formulaLatticeByExpression.get(expression);
|
|
59
|
+
if (cached !== undefined)
|
|
60
|
+
return cached;
|
|
61
|
+
let onLattice = null;
|
|
62
|
+
if (parsedTransformations(expression).length > 1) {
|
|
63
|
+
const legs = extractTokensFromTransformations(expression).map((token) => ({
|
|
64
|
+
token: token.token,
|
|
65
|
+
exchange: formulaLegExchange(token.exchange, token.symbol),
|
|
66
|
+
}));
|
|
67
|
+
const plan = formulaCalendarPlan(expression);
|
|
68
|
+
const timeline = plan
|
|
69
|
+
? legs.filter((leg) => leg.token === plan.anchor)
|
|
70
|
+
: legs.filter((leg) => !checkIsEconomic(leg.exchange));
|
|
71
|
+
onLattice = timeline.length > 0 && timeline.every((leg) => isCmeSessionLatticeExchange(leg.exchange));
|
|
72
|
+
}
|
|
73
|
+
if (formulaLatticeByExpression.size >= FORMULA_CACHE_MAX)
|
|
74
|
+
formulaLatticeByExpression.clear();
|
|
75
|
+
formulaLatticeByExpression.set(expression, onLattice);
|
|
76
|
+
return onLattice;
|
|
77
|
+
}
|
|
78
|
+
/** Whether the series' history rides the CME session lattice: its formula's timeline legs, else its exchange. */
|
|
79
|
+
export function isCmeSessionLatticeVenue(venue) {
|
|
80
|
+
if (!venue)
|
|
81
|
+
return false;
|
|
82
|
+
const expression = venue.transformations;
|
|
83
|
+
const formula = typeof expression === 'string' && expression.length > 0 ? formulaTimelineOnLattice(expression) : null;
|
|
84
|
+
return formula ?? isCmeSessionLatticeExchange(venue.exchange);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The plain bar grid: calendar bars start on their UTC calendar boundary,
|
|
88
|
+
* weekly bars on `findMonday`, everything else on the UTC floor.
|
|
89
|
+
*/
|
|
90
|
+
export function plainBucketStartMs(tsMs, intervalMs) {
|
|
91
|
+
const months = calendarMonthsOfMs(intervalMs);
|
|
92
|
+
if (months !== null)
|
|
93
|
+
return calendarBarStartMs(tsMs, months);
|
|
94
|
+
return intervalMs === TimeIntervalConstant.week ? findMonday(tsMs) : tsMs - (tsMs % intervalMs);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The CME session-lattice bar for a series whose history never anchors to a
|
|
98
|
+
* trading-hours grid of its own (overlays and script sources fetching the
|
|
99
|
+
* full session), or null off the lattice, where the caller keeps
|
|
100
|
+
* `plainBucketStartMs`. `venue` is the SERIES' own market (a comparison leg
|
|
101
|
+
* or a CVD basket names its own). Its `sessionType` is ignored on purpose,
|
|
102
|
+
* so these writers never start anchoring to chart RTH or the regular
|
|
103
|
+
* equities session.
|
|
104
|
+
*/
|
|
105
|
+
export function cmeSessionLatticeBucketMs(tsMs, intervalMs, venue) {
|
|
106
|
+
if (!venue || !isCmeSessionLatticeIntervalMs(intervalMs))
|
|
107
|
+
return null;
|
|
108
|
+
return isCmeSessionLatticeVenue(venue) ? cmeSessionBucketMs(tsMs, intervalMs) : null;
|
|
109
|
+
}
|
|
110
|
+
export function liveBucketStartMs(tsMs, intervalMs, venue) {
|
|
111
|
+
// Calendar and weekly bars: a CME venue's trade-date months and weeks (a
|
|
112
|
+
// month opens at the 17:00 Chicago open before its first trade date), else
|
|
113
|
+
// the plain grid. Regular-session US equities group the session's daily bars
|
|
114
|
+
// by month and are ASSUMED stamped on the 1st at 00:00 UTC like every other
|
|
115
|
+
// market; if the gateway stamps them on the first trade date's open instead,
|
|
116
|
+
// this branch needs the session's own month key.
|
|
117
|
+
if (calendarMonthsOfMs(intervalMs) !== null || intervalMs === TimeIntervalConstant.week) {
|
|
118
|
+
return isCmeSessionLatticeVenue(venue)
|
|
119
|
+
? cmeSessionBucketMs(tsMs, intervalMs)
|
|
120
|
+
: plainBucketStartMs(tsMs, intervalMs);
|
|
121
|
+
}
|
|
122
|
+
if (venue && !isRthBucketExactIntervalMs(intervalMs)) {
|
|
123
|
+
if (isChartRthActive(venue.exchange, venue.symbol, venue.sessionType, intervalMs)) {
|
|
124
|
+
return rthAnchoredBucketStartMs(venue.symbol, tsMs, intervalMs);
|
|
125
|
+
}
|
|
126
|
+
if (isEquityRegularSessionGated(venue.exchange, venue.sessionType)) {
|
|
127
|
+
if (isFootprintRthFoldTfMs(intervalMs))
|
|
128
|
+
return usEquityAnchoredBucketStartMs(tsMs, intervalMs);
|
|
129
|
+
if (intervalMs === THREE_DAYS_MS)
|
|
130
|
+
return usEquitySessionGridBucketStartMs(tsMs);
|
|
131
|
+
}
|
|
132
|
+
if (isCmeSessionLatticeIntervalMs(intervalMs) && isCmeSessionLatticeVenue(venue)) {
|
|
133
|
+
return cmeSessionBucketMs(tsMs, intervalMs);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return tsMs - (tsMs % intervalMs);
|
|
137
|
+
}
|
|
138
|
+
/** The probe step through an off-session gap: every open the anchored grids sit on is on the quarter hour. */
|
|
139
|
+
const OFF_SESSION_PROBE_MS = 15 * 60_000;
|
|
140
|
+
/**
|
|
141
|
+
* The starts of the venue's bars that open inside `[fromMs, toMs]`, ascending, each keyed by
|
|
142
|
+
* `liveBucketStartMs`: a regular-session stock chart's hourly columns sit on its 13:30Z (EDT) candles,
|
|
143
|
+
* a CME chart's on its session lattice, and an off-session instant contributes none. The bar holding
|
|
144
|
+
* `fromMs` counts only when it opens inside the range. A probe still inside the last bar (a lattice
|
|
145
|
+
* bar the fall-back Sunday stretches) or off session steps forward a quarter hour at most.
|
|
146
|
+
*/
|
|
147
|
+
export function liveBucketStartsInRange(fromMs, toMs, intervalMs, venue) {
|
|
148
|
+
const starts = [];
|
|
149
|
+
if (!(intervalMs > 0) || !Number.isFinite(fromMs) || !Number.isFinite(toMs))
|
|
150
|
+
return starts;
|
|
151
|
+
const stepMs = Math.min(intervalMs, OFF_SESSION_PROBE_MS);
|
|
152
|
+
let last = -Infinity;
|
|
153
|
+
for (let probe = fromMs; probe <= toMs;) {
|
|
154
|
+
const start = liveBucketStartMs(probe, intervalMs, venue);
|
|
155
|
+
if (start === null || start <= last) {
|
|
156
|
+
probe += stepMs;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
last = start;
|
|
160
|
+
if (start >= fromMs)
|
|
161
|
+
starts.push(start);
|
|
162
|
+
probe = start + intervalMs;
|
|
163
|
+
}
|
|
164
|
+
return starts;
|
|
165
|
+
}
|