@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,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage for the indicator coverage planner (fan-out unification P1): the
|
|
3
|
+
* per-(chart, dataset, overlay, gap-slot) repair attempt counts and the
|
|
4
|
+
* per-(chart, overlay) proven servable floor. Verbatim move of the two
|
|
5
|
+
* module maps from titan-charts.ts. This module stores and clears, it never
|
|
6
|
+
* decides (the kscript-integration-session pattern): consumption semantics
|
|
7
|
+
* live in the planner, floor LEARNING stays with the protected repair
|
|
8
|
+
* integration callback (it needs post-integration rows).
|
|
9
|
+
*/
|
|
10
|
+
import type { IndicatorGapRange } from './indicator-gap-repair.util.js';
|
|
11
|
+
export declare function indicatorCoverageAttemptKey(chartIndex: number, datasetKey: string, overlayId: string, gap: IndicatorGapRange, intervalMs: number): string;
|
|
12
|
+
export declare function indicatorServableFloorKey(chartIndex: number, overlayId: string): string;
|
|
13
|
+
export declare function getIndicatorCoverageAttempts(attemptKey: string): number;
|
|
14
|
+
export declare function noteIndicatorCoverageAttempt(attemptKey: string): number;
|
|
15
|
+
/** Full chart-group teardown. */
|
|
16
|
+
export declare function clearAllIndicatorCoverageAttempts(): void;
|
|
17
|
+
export declare function clearIndicatorCoverageAttemptsForChart(chartIndex: number): void;
|
|
18
|
+
export declare function getIndicatorServableFloorMs(chartIndex: number, overlayId: string): number | undefined;
|
|
19
|
+
/** Max-merge the proven floor; returns the merged value (for logging). */
|
|
20
|
+
export declare function noteIndicatorServableFloor(chartIndex: number, overlayId: string, floorMs: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* Exact-set the floor, replacing any merged value. For overlays whose head
|
|
23
|
+
* boundary MOVES by design (shallow strategy windows follow the chart, so
|
|
24
|
+
* their first row slides both ways), the max-merge above would either stop
|
|
25
|
+
* clipping (window slid right) or over-clip (window grew left); the pin
|
|
26
|
+
* tracks the current truth each coverage scan.
|
|
27
|
+
*/
|
|
28
|
+
export declare function pinIndicatorServableFloor(chartIndex: number, overlayId: string, floorMs: number): void;
|
|
29
|
+
export declare function clearIndicatorServableFloorsForChart(chartIndex: number): void;
|
|
30
|
+
export declare function noteIndicatorRangeServed(chartIndex: number, overlayId: string, fromMs: number, toMs: number): void;
|
|
31
|
+
export declare function isIndicatorRangeProvenServed(chartIndex: number, overlayId: string, fromMs: number, toMs: number): boolean;
|
|
32
|
+
export declare function clearIndicatorServedRangesForOverlay(chartIndex: number, overlayId: string): void;
|
|
33
|
+
export declare function __resetIndicatorCoverageStateForTests(): void;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const attemptsByKey = new Map();
|
|
2
|
+
// Earliest timestamp the data source has proven it can serve per overlay
|
|
3
|
+
// (protected kScript history is capped server-side, e.g. the newest ~250
|
|
4
|
+
// bars). A repair for a gap older than this floor can never be filled: the
|
|
5
|
+
// fetch returns the same newest window, the gap re-detects on the next bar
|
|
6
|
+
// (the attempt key shifts with the bar clock), and the loop refetches
|
|
7
|
+
// forever. Learned from repair results, reset with the dataset.
|
|
8
|
+
const servableFloorMsByKey = new Map();
|
|
9
|
+
export function indicatorCoverageAttemptKey(chartIndex, datasetKey, overlayId, gap, intervalMs) {
|
|
10
|
+
const fromSlot = Math.floor(gap.fromMs / intervalMs);
|
|
11
|
+
const toSlot = Math.ceil(gap.toMs / intervalMs);
|
|
12
|
+
return `${chartIndex}:${datasetKey}:${overlayId}:${fromSlot}:${toSlot}`;
|
|
13
|
+
}
|
|
14
|
+
export function indicatorServableFloorKey(chartIndex, overlayId) {
|
|
15
|
+
return `${chartIndex}:${overlayId}`;
|
|
16
|
+
}
|
|
17
|
+
export function getIndicatorCoverageAttempts(attemptKey) {
|
|
18
|
+
return attemptsByKey.get(attemptKey) ?? 0;
|
|
19
|
+
}
|
|
20
|
+
export function noteIndicatorCoverageAttempt(attemptKey) {
|
|
21
|
+
const next = (attemptsByKey.get(attemptKey) ?? 0) + 1;
|
|
22
|
+
attemptsByKey.set(attemptKey, next);
|
|
23
|
+
return next;
|
|
24
|
+
}
|
|
25
|
+
/** Full chart-group teardown. */
|
|
26
|
+
export function clearAllIndicatorCoverageAttempts() {
|
|
27
|
+
attemptsByKey.clear();
|
|
28
|
+
}
|
|
29
|
+
export function clearIndicatorCoverageAttemptsForChart(chartIndex) {
|
|
30
|
+
const prefix = `${chartIndex}:`;
|
|
31
|
+
for (const key of [...attemptsByKey.keys()]) {
|
|
32
|
+
if (key.startsWith(prefix)) {
|
|
33
|
+
attemptsByKey.delete(key);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function getIndicatorServableFloorMs(chartIndex, overlayId) {
|
|
38
|
+
return servableFloorMsByKey.get(indicatorServableFloorKey(chartIndex, overlayId));
|
|
39
|
+
}
|
|
40
|
+
/** Max-merge the proven floor; returns the merged value (for logging). */
|
|
41
|
+
export function noteIndicatorServableFloor(chartIndex, overlayId, floorMs) {
|
|
42
|
+
const key = indicatorServableFloorKey(chartIndex, overlayId);
|
|
43
|
+
const merged = Math.max(servableFloorMsByKey.get(key) ?? 0, floorMs);
|
|
44
|
+
servableFloorMsByKey.set(key, merged);
|
|
45
|
+
return merged;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Exact-set the floor, replacing any merged value. For overlays whose head
|
|
49
|
+
* boundary MOVES by design (shallow strategy windows follow the chart, so
|
|
50
|
+
* their first row slides both ways), the max-merge above would either stop
|
|
51
|
+
* clipping (window slid right) or over-clip (window grew left); the pin
|
|
52
|
+
* tracks the current truth each coverage scan.
|
|
53
|
+
*/
|
|
54
|
+
export function pinIndicatorServableFloor(chartIndex, overlayId, floorMs) {
|
|
55
|
+
servableFloorMsByKey.set(indicatorServableFloorKey(chartIndex, overlayId), floorMs);
|
|
56
|
+
}
|
|
57
|
+
export function clearIndicatorServableFloorsForChart(chartIndex) {
|
|
58
|
+
const prefix = `${chartIndex}:`;
|
|
59
|
+
for (const key of [...servableFloorMsByKey.keys()]) {
|
|
60
|
+
if (key.startsWith(prefix))
|
|
61
|
+
servableFloorMsByKey.delete(key);
|
|
62
|
+
}
|
|
63
|
+
for (const key of [...servedRangesByKey.keys()]) {
|
|
64
|
+
if (key.startsWith(prefix))
|
|
65
|
+
servedRangesByKey.delete(key);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Ranges a gap-recovery reply has PROVEN as fully served: the repair fetch
|
|
69
|
+
// came back with zero novel timestamps (contained-lazy skip), so every row
|
|
70
|
+
// the source has for that stretch is already mounted. A gap re-detected
|
|
71
|
+
// inside a proven range is phantom damage — explicit NaN break rows that are
|
|
72
|
+
// legitimate script output (a strategy plotting nothing on a bar emits
|
|
73
|
+
// [ts, NaN], indistinguishable from an unloaded-stretch marker) — and
|
|
74
|
+
// repairing it refetches identical rows every scan, forever (2026-07-11
|
|
75
|
+
// dump: 9 repairs in 47s, all discarded as contained). Interval-merged on
|
|
76
|
+
// insert; reset with the dataset (chart clear above) and on init-data
|
|
77
|
+
// remounts (new identity = new world).
|
|
78
|
+
const servedRangesByKey = new Map();
|
|
79
|
+
export function noteIndicatorRangeServed(chartIndex, overlayId, fromMs, toMs) {
|
|
80
|
+
if (!Number.isFinite(fromMs) || !Number.isFinite(toMs) || toMs <= fromMs)
|
|
81
|
+
return;
|
|
82
|
+
const key = indicatorServableFloorKey(chartIndex, overlayId);
|
|
83
|
+
const merged = [];
|
|
84
|
+
let next = { fromMs, toMs };
|
|
85
|
+
for (const range of servedRangesByKey.get(key) ?? []) {
|
|
86
|
+
if (range.toMs < next.fromMs || range.fromMs > next.toMs) {
|
|
87
|
+
merged.push(range);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
next = { fromMs: Math.min(range.fromMs, next.fromMs), toMs: Math.max(range.toMs, next.toMs) };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
merged.push(next);
|
|
94
|
+
merged.sort((a, b) => a.fromMs - b.fromMs);
|
|
95
|
+
servedRangesByKey.set(key, merged);
|
|
96
|
+
}
|
|
97
|
+
export function isIndicatorRangeProvenServed(chartIndex, overlayId, fromMs, toMs) {
|
|
98
|
+
const ranges = servedRangesByKey.get(indicatorServableFloorKey(chartIndex, overlayId));
|
|
99
|
+
if (!ranges)
|
|
100
|
+
return false;
|
|
101
|
+
return ranges.some((range) => fromMs >= range.fromMs && toMs <= range.toMs);
|
|
102
|
+
}
|
|
103
|
+
export function clearIndicatorServedRangesForOverlay(chartIndex, overlayId) {
|
|
104
|
+
servedRangesByKey.delete(indicatorServableFloorKey(chartIndex, overlayId));
|
|
105
|
+
}
|
|
106
|
+
export function __resetIndicatorCoverageStateForTests() {
|
|
107
|
+
attemptsByKey.clear();
|
|
108
|
+
servableFloorMsByKey.clear();
|
|
109
|
+
servedRangesByKey.clear();
|
|
110
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure gap detector for the recovery poller (Mechanism B), extracted to a
|
|
3
|
+
* leaf module so the fan-out golden tables can load it under the node test
|
|
4
|
+
* config (the parent module imports @/environment, which needs a browser).
|
|
5
|
+
* Verbatim move; indicator-gap.util re-exports.
|
|
6
|
+
*/
|
|
7
|
+
export interface IndicatorGapRange {
|
|
8
|
+
fromMs: number;
|
|
9
|
+
toMs: number;
|
|
10
|
+
/** Stamped by findIndicatorTailHole for parameterized-threshold (profile)
|
|
11
|
+
* callers only: exempt from the live-edge sliver
|
|
12
|
+
* filter (the tail helper's own missing-row minimum governs instead). */
|
|
13
|
+
tail?: true;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Below this row count, the median cadence is unstable; fall back to the chart
|
|
17
|
+
* interval. Exported because the REPAIR_COVERED_RANGE_SKIP guard
|
|
18
|
+
* (indicator-gap-repair.util.ts) mirrors it as its small-sample fail-open
|
|
19
|
+
* floor: the poller arms sparse overlays via fallback gaps precisely because
|
|
20
|
+
* this detector refuses to judge them, so the guard must refuse too.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MIN_ROWS_FOR_MEDIAN = 4;
|
|
23
|
+
/**
|
|
24
|
+
* Bars between a gap's right edge and the main series' last row inside which
|
|
25
|
+
* the gap counts as live-edge lag, not pan-back damage. Mirrors the healthy
|
|
26
|
+
* right-edge tolerance the QA probe and the protected cache use (3 bars).
|
|
27
|
+
* Lives in this leaf (not indicator-gap.util, which re-exports it) so
|
|
28
|
+
* node-lane consumers (the fan-out goldens, the CVD control's live-edge
|
|
29
|
+
* seed bound) can import it without dragging in `@/environment`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const INDICATOR_GAP_TAIL_EXCLUSION_BARS = 3;
|
|
32
|
+
/**
|
|
33
|
+
* The main bars the SERVER sent, for gap detection against them.
|
|
34
|
+
*
|
|
35
|
+
* Bars are trade-driven: a minute with no trade has no bar upstream, on the
|
|
36
|
+
* candle series and on every overlay alike. The client fills such minutes
|
|
37
|
+
* with synthetic marker rows (titan `insertSyntheticGaps` / the live-tick
|
|
38
|
+
* bridge, flagged SYNTHETIC_GAP = 1 or SYNTHETIC_CARRY = 2 next to real rows
|
|
39
|
+
* flagged SYNTHETIC_REAL = 0) so a line plot breaks honestly instead of
|
|
40
|
+
* bridging the quiet stretch. Those rows are the client's own rendering
|
|
41
|
+
* device, not evidence that the overlay is missing anything: judged against
|
|
42
|
+
* them, an overlay that faithfully mirrors the server looks holed at every
|
|
43
|
+
* quiet minute and the recovery poller re-asks a window the server already
|
|
44
|
+
* answered (2026-09-15, PUMPBTCUSDT 1m: 21 gap fetches in 120 s for three
|
|
45
|
+
* minutes Binance recorded zero trades in; each commit also cleared the
|
|
46
|
+
* footprint's forming-bar baseline). An answered window is complete: a hole
|
|
47
|
+
* is a range never answered, never a missing minute inside an answered one.
|
|
48
|
+
*
|
|
49
|
+
* Flags are POSITIONAL against the series they were read with: a caller
|
|
50
|
+
* that clips the rows (the wave-dispatch slice) must clip the flags the same
|
|
51
|
+
* way (`sliceSortedRowsToSpanWithFlags`). A length mismatch means the
|
|
52
|
+
* alignment is unknown, and the rows are returned untouched (fail open: an
|
|
53
|
+
* unstripped bar can at worst re-ask an answered window, a misaligned strip
|
|
54
|
+
* would hide a real hole).
|
|
55
|
+
*
|
|
56
|
+
* Returns the input untouched when no flags are known or none is synthetic
|
|
57
|
+
* (the common case pays one scan, no copy).
|
|
58
|
+
*/
|
|
59
|
+
export declare function realMainRows(mainRows: number[][] | undefined, syntheticFlags: ArrayLike<number> | undefined): number[][] | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The TRADED main bars: `realMainRows` minus every row that cannot be trade
|
|
62
|
+
* evidence: a non-finite open (a NaN gap marker that reached the planner
|
|
63
|
+
* without its flag) or a volume of exactly zero (`-0` included). Gap-filled
|
|
64
|
+
* candles are the case (2026-09-16, xyz:SNDK on Hyperliquid HIP-3): the boot
|
|
65
|
+
* request asks the gateway for `gapfill`, so the response itself carries flat
|
|
66
|
+
* zero-volume bars for tradeless minutes, REAL-flagged because they came from
|
|
67
|
+
* the wire, and a trade-driven profile can never have a row where nothing
|
|
68
|
+
* traded. A volume of `undefined` (five-field ticker bars, forex) is NOT zero:
|
|
69
|
+
* those venues keep their real grid untouched.
|
|
70
|
+
*
|
|
71
|
+
* Per row and clip independent: a row's verdict never depends on which slice
|
|
72
|
+
* it sits in, so a wave clip and the full series agree. Below two traded rows
|
|
73
|
+
* the row-based detectors are blind (median cadence undefined); the planner
|
|
74
|
+
* handles that case explicitly (`detectOverlayGaps`: zero traded rows need no
|
|
75
|
+
* repair, one traded row is asked when the overlay lacks it) instead of
|
|
76
|
+
* falling back to the real rows, which would resurrect the placeholder holes
|
|
77
|
+
* this grid exists to remove.
|
|
78
|
+
*/
|
|
79
|
+
export declare function tradedMainRows(mainRows: number[][] | undefined, syntheticFlags: ArrayLike<number> | undefined): number[][] | undefined;
|
|
80
|
+
/** A main row that is not trade evidence: non-finite open, or a volume of exactly zero (gap-filled bar). */
|
|
81
|
+
export declare function isUntradedMainRow(row: number[] | undefined): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Find interior + prefix holes in an indicator overlay's series, against the
|
|
84
|
+
* main candle grid (Mechanism B, INDICATOR_GAP_FIX_PLAN.md §2.2).
|
|
85
|
+
*
|
|
86
|
+
* Threshold is cadence-relative — 1.5x the overlay's OWN median consecutive
|
|
87
|
+
* timestamp delta, not the chart interval — so an inherently sparse indicator
|
|
88
|
+
* (funding 8h on a 1m chart) is not flagged at every native step. A jump is a
|
|
89
|
+
* real, refetchable hole only when the MAIN series has bars inside it (so a
|
|
90
|
+
* genuine market gap that main also lacks is not chased).
|
|
91
|
+
*
|
|
92
|
+
* NOTE: a TOTAL failure (zero overlay rows) is invisible here; that case is
|
|
93
|
+
* armed separately by the fetch failure trigger, not by this data-shape scan.
|
|
94
|
+
*
|
|
95
|
+
* @param overlayRawData the overlay's sparse series, ascending by ts
|
|
96
|
+
* @param mainRawData the main candle series, ascending by ts (source of truth)
|
|
97
|
+
* @param chartIntervalMs the chart interval, used as the small-sample fallback cadence
|
|
98
|
+
*/
|
|
99
|
+
export declare function findIndicatorGaps(overlayRawData: number[][] | undefined, mainRawData: number[][] | undefined, chartIntervalMs: number): IndicatorGapRange[];
|
|
100
|
+
/**
|
|
101
|
+
* Tail threshold for the chart-session-following PROFILE overlays (footprint /
|
|
102
|
+
* SVP / delta profile, 2026-08-24 session-flip truncation round): a whole
|
|
103
|
+
* ladder column per bar, so a couple of missing tail bars is the live/poll
|
|
104
|
+
* lane's territory; four or more is real damage (the observed flip truncation
|
|
105
|
+
* was 45 bars). Heatmap keeps 2 (its columns close tens of seconds late).
|
|
106
|
+
*/
|
|
107
|
+
export declare const INDICATOR_TAIL_HOLE_PROFILE_MIN_MISSING_ROWS = 4;
|
|
108
|
+
/**
|
|
109
|
+
* Suffix hole for overlays whose CLOSED-bar tail is fetch-owned (the planner's
|
|
110
|
+
* `tailHoles` opt-in; today the orderbook heatmap's column grid). Measured in
|
|
111
|
+
* MAIN ROWS, never wall-clock time: the hole is the span of main rows that lie
|
|
112
|
+
* strictly after the overlay's last row, and it exists only when at least
|
|
113
|
+
* `INDICATOR_TAIL_HOLE_MIN_MISSING_ROWS` of them do. Counting rows keeps a
|
|
114
|
+
* session jump honest (on anchored RTH grids Friday's last column and
|
|
115
|
+
* Monday's first bar are one row apart across a weekend of wall time: not a
|
|
116
|
+
* hole until Monday has rows the overlay lacks) and the range starts at the
|
|
117
|
+
* FIRST MISSING main row, not at the last mounted column, so a live-edge
|
|
118
|
+
* sliver stays inside the tail-adjacent filter. The range runs to the last
|
|
119
|
+
* main bar's bucket END (`lastMain + interval`) so the final closed bar is
|
|
120
|
+
* asked explicitly, not only through the heatmap lane's bucket alignment.
|
|
121
|
+
* Plain indicators never use this: their tail belongs to the live/polling
|
|
122
|
+
* lane (`findIndicatorGaps` emits prefix + interior holes only, by design).
|
|
123
|
+
*
|
|
124
|
+
* @returns the hole, or null when the overlay reaches main's tail (or inputs
|
|
125
|
+
* are unusable: < 1 overlay row, < 2 main rows, no interval).
|
|
126
|
+
*/
|
|
127
|
+
export declare function findIndicatorTailHole(overlayRawData: number[][] | undefined, mainRawData: number[][] | undefined, chartIntervalMs: number, minMissingRows?: number, tagTail?: boolean): IndicatorGapRange | null;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Below this row count, the median cadence is unstable; fall back to the chart
|
|
3
|
+
* interval. Exported because the REPAIR_COVERED_RANGE_SKIP guard
|
|
4
|
+
* (indicator-gap-repair.util.ts) mirrors it as its small-sample fail-open
|
|
5
|
+
* floor: the poller arms sparse overlays via fallback gaps precisely because
|
|
6
|
+
* this detector refuses to judge them, so the guard must refuse too.
|
|
7
|
+
*/
|
|
8
|
+
export const MIN_ROWS_FOR_MEDIAN = 4;
|
|
9
|
+
/**
|
|
10
|
+
* Bars between a gap's right edge and the main series' last row inside which
|
|
11
|
+
* the gap counts as live-edge lag, not pan-back damage. Mirrors the healthy
|
|
12
|
+
* right-edge tolerance the QA probe and the protected cache use (3 bars).
|
|
13
|
+
* Lives in this leaf (not indicator-gap.util, which re-exports it) so
|
|
14
|
+
* node-lane consumers (the fan-out goldens, the CVD control's live-edge
|
|
15
|
+
* seed bound) can import it without dragging in `@/environment`.
|
|
16
|
+
*/
|
|
17
|
+
export const INDICATOR_GAP_TAIL_EXCLUSION_BARS = 3;
|
|
18
|
+
/**
|
|
19
|
+
* The main bars the SERVER sent, for gap detection against them.
|
|
20
|
+
*
|
|
21
|
+
* Bars are trade-driven: a minute with no trade has no bar upstream, on the
|
|
22
|
+
* candle series and on every overlay alike. The client fills such minutes
|
|
23
|
+
* with synthetic marker rows (titan `insertSyntheticGaps` / the live-tick
|
|
24
|
+
* bridge, flagged SYNTHETIC_GAP = 1 or SYNTHETIC_CARRY = 2 next to real rows
|
|
25
|
+
* flagged SYNTHETIC_REAL = 0) so a line plot breaks honestly instead of
|
|
26
|
+
* bridging the quiet stretch. Those rows are the client's own rendering
|
|
27
|
+
* device, not evidence that the overlay is missing anything: judged against
|
|
28
|
+
* them, an overlay that faithfully mirrors the server looks holed at every
|
|
29
|
+
* quiet minute and the recovery poller re-asks a window the server already
|
|
30
|
+
* answered (2026-09-15, PUMPBTCUSDT 1m: 21 gap fetches in 120 s for three
|
|
31
|
+
* minutes Binance recorded zero trades in; each commit also cleared the
|
|
32
|
+
* footprint's forming-bar baseline). An answered window is complete: a hole
|
|
33
|
+
* is a range never answered, never a missing minute inside an answered one.
|
|
34
|
+
*
|
|
35
|
+
* Flags are POSITIONAL against the series they were read with: a caller
|
|
36
|
+
* that clips the rows (the wave-dispatch slice) must clip the flags the same
|
|
37
|
+
* way (`sliceSortedRowsToSpanWithFlags`). A length mismatch means the
|
|
38
|
+
* alignment is unknown, and the rows are returned untouched (fail open: an
|
|
39
|
+
* unstripped bar can at worst re-ask an answered window, a misaligned strip
|
|
40
|
+
* would hide a real hole).
|
|
41
|
+
*
|
|
42
|
+
* Returns the input untouched when no flags are known or none is synthetic
|
|
43
|
+
* (the common case pays one scan, no copy).
|
|
44
|
+
*/
|
|
45
|
+
export function realMainRows(mainRows, syntheticFlags) {
|
|
46
|
+
if (!mainRows || !syntheticFlags || syntheticFlags.length === 0)
|
|
47
|
+
return mainRows;
|
|
48
|
+
if (syntheticFlags.length !== mainRows.length)
|
|
49
|
+
return mainRows;
|
|
50
|
+
let hasSynthetic = false;
|
|
51
|
+
for (let i = 0; i < mainRows.length; i++) {
|
|
52
|
+
if (syntheticFlags[i] !== 0) {
|
|
53
|
+
hasSynthetic = true;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (!hasSynthetic)
|
|
58
|
+
return mainRows;
|
|
59
|
+
const real = [];
|
|
60
|
+
for (let i = 0; i < mainRows.length; i++) {
|
|
61
|
+
if (syntheticFlags[i] === 0)
|
|
62
|
+
real.push(mainRows[i]);
|
|
63
|
+
}
|
|
64
|
+
return real;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The TRADED main bars: `realMainRows` minus every row that cannot be trade
|
|
68
|
+
* evidence: a non-finite open (a NaN gap marker that reached the planner
|
|
69
|
+
* without its flag) or a volume of exactly zero (`-0` included). Gap-filled
|
|
70
|
+
* candles are the case (2026-09-16, xyz:SNDK on Hyperliquid HIP-3): the boot
|
|
71
|
+
* request asks the gateway for `gapfill`, so the response itself carries flat
|
|
72
|
+
* zero-volume bars for tradeless minutes, REAL-flagged because they came from
|
|
73
|
+
* the wire, and a trade-driven profile can never have a row where nothing
|
|
74
|
+
* traded. A volume of `undefined` (five-field ticker bars, forex) is NOT zero:
|
|
75
|
+
* those venues keep their real grid untouched.
|
|
76
|
+
*
|
|
77
|
+
* Per row and clip independent: a row's verdict never depends on which slice
|
|
78
|
+
* it sits in, so a wave clip and the full series agree. Below two traded rows
|
|
79
|
+
* the row-based detectors are blind (median cadence undefined); the planner
|
|
80
|
+
* handles that case explicitly (`detectOverlayGaps`: zero traded rows need no
|
|
81
|
+
* repair, one traded row is asked when the overlay lacks it) instead of
|
|
82
|
+
* falling back to the real rows, which would resurrect the placeholder holes
|
|
83
|
+
* this grid exists to remove.
|
|
84
|
+
*/
|
|
85
|
+
export function tradedMainRows(mainRows, syntheticFlags) {
|
|
86
|
+
const real = realMainRows(mainRows, syntheticFlags);
|
|
87
|
+
if (!real)
|
|
88
|
+
return real;
|
|
89
|
+
let hasPlaceholder = false;
|
|
90
|
+
for (let i = 0; i < real.length; i++) {
|
|
91
|
+
if (isUntradedMainRow(real[i])) {
|
|
92
|
+
hasPlaceholder = true;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (!hasPlaceholder)
|
|
97
|
+
return real;
|
|
98
|
+
const traded = [];
|
|
99
|
+
for (let i = 0; i < real.length; i++) {
|
|
100
|
+
if (!isUntradedMainRow(real[i]))
|
|
101
|
+
traded.push(real[i]);
|
|
102
|
+
}
|
|
103
|
+
return traded;
|
|
104
|
+
}
|
|
105
|
+
/** A main row that is not trade evidence: non-finite open, or a volume of exactly zero (gap-filled bar). */
|
|
106
|
+
export function isUntradedMainRow(row) {
|
|
107
|
+
if (!row)
|
|
108
|
+
return true;
|
|
109
|
+
if (!Number.isFinite(row[1]))
|
|
110
|
+
return true;
|
|
111
|
+
const volume = row[5];
|
|
112
|
+
return typeof volume === 'number' && volume === 0;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Find interior + prefix holes in an indicator overlay's series, against the
|
|
116
|
+
* main candle grid (Mechanism B, INDICATOR_GAP_FIX_PLAN.md §2.2).
|
|
117
|
+
*
|
|
118
|
+
* Threshold is cadence-relative — 1.5x the overlay's OWN median consecutive
|
|
119
|
+
* timestamp delta, not the chart interval — so an inherently sparse indicator
|
|
120
|
+
* (funding 8h on a 1m chart) is not flagged at every native step. A jump is a
|
|
121
|
+
* real, refetchable hole only when the MAIN series has bars inside it (so a
|
|
122
|
+
* genuine market gap that main also lacks is not chased).
|
|
123
|
+
*
|
|
124
|
+
* NOTE: a TOTAL failure (zero overlay rows) is invisible here; that case is
|
|
125
|
+
* armed separately by the fetch failure trigger, not by this data-shape scan.
|
|
126
|
+
*
|
|
127
|
+
* @param overlayRawData the overlay's sparse series, ascending by ts
|
|
128
|
+
* @param mainRawData the main candle series, ascending by ts (source of truth)
|
|
129
|
+
* @param chartIntervalMs the chart interval, used as the small-sample fallback cadence
|
|
130
|
+
*/
|
|
131
|
+
export function findIndicatorGaps(overlayRawData, mainRawData, chartIntervalMs) {
|
|
132
|
+
if (!overlayRawData ||
|
|
133
|
+
overlayRawData.length < 2 ||
|
|
134
|
+
!mainRawData ||
|
|
135
|
+
mainRawData.length < 2 ||
|
|
136
|
+
!(chartIntervalMs > 0)) {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
const deltas = [];
|
|
140
|
+
for (let i = 1; i < overlayRawData.length; i++) {
|
|
141
|
+
const d = overlayRawData[i][0] - overlayRawData[i - 1][0];
|
|
142
|
+
if (d > 0)
|
|
143
|
+
deltas.push(d);
|
|
144
|
+
}
|
|
145
|
+
if (deltas.length === 0)
|
|
146
|
+
return [];
|
|
147
|
+
let cadence;
|
|
148
|
+
if (overlayRawData.length < MIN_ROWS_FOR_MEDIAN) {
|
|
149
|
+
cadence = chartIntervalMs;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
deltas.sort((a, b) => a - b);
|
|
153
|
+
cadence = deltas[Math.floor(deltas.length / 2)] || chartIntervalMs;
|
|
154
|
+
}
|
|
155
|
+
const threshold = cadence * 1.5;
|
|
156
|
+
// First main bar with ts strictly greater than `after`; used to test whether
|
|
157
|
+
// the main grid has any bar inside an overlay gap (binary search, ascending).
|
|
158
|
+
const firstMainTsAfter = (after) => {
|
|
159
|
+
let lo = 0;
|
|
160
|
+
let hi = mainRawData.length - 1;
|
|
161
|
+
let idx = mainRawData.length;
|
|
162
|
+
while (lo <= hi) {
|
|
163
|
+
const mid = (lo + hi) >> 1;
|
|
164
|
+
if (mainRawData[mid][0] > after) {
|
|
165
|
+
idx = mid;
|
|
166
|
+
hi = mid - 1;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
lo = mid + 1;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return idx < mainRawData.length ? mainRawData[idx][0] : undefined;
|
|
173
|
+
};
|
|
174
|
+
const mainHasBarsBetween = (a, b) => {
|
|
175
|
+
const ts = firstMainTsAfter(a);
|
|
176
|
+
return ts !== undefined && ts < b;
|
|
177
|
+
};
|
|
178
|
+
const gaps = [];
|
|
179
|
+
// Prefix hole: the older range never loaded — overlay starts well after main.
|
|
180
|
+
const mainStart = mainRawData[0][0];
|
|
181
|
+
const overlayStart = overlayRawData[0][0];
|
|
182
|
+
if (overlayStart - mainStart > threshold && mainHasBarsBetween(mainStart - 1, overlayStart)) {
|
|
183
|
+
gaps.push({ fromMs: mainStart, toMs: overlayStart });
|
|
184
|
+
}
|
|
185
|
+
// Interior holes: a jump in the overlay where main has bars.
|
|
186
|
+
for (let i = 1; i < overlayRawData.length; i++) {
|
|
187
|
+
const a = overlayRawData[i - 1][0];
|
|
188
|
+
const b = overlayRawData[i][0];
|
|
189
|
+
if (b - a > threshold && mainHasBarsBetween(a, b)) {
|
|
190
|
+
gaps.push({ fromMs: a, toMs: b });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return gaps;
|
|
194
|
+
}
|
|
195
|
+
/** Main rows missing after the overlay's last row before the suffix counts as
|
|
196
|
+
* a hole: one missing row is live-edge lag (the live lane's materialization
|
|
197
|
+
* window), two or more closed rows without a column are a real tail hole. */
|
|
198
|
+
const INDICATOR_TAIL_HOLE_MIN_MISSING_ROWS = 2;
|
|
199
|
+
/**
|
|
200
|
+
* Tail threshold for the chart-session-following PROFILE overlays (footprint /
|
|
201
|
+
* SVP / delta profile, 2026-08-24 session-flip truncation round): a whole
|
|
202
|
+
* ladder column per bar, so a couple of missing tail bars is the live/poll
|
|
203
|
+
* lane's territory; four or more is real damage (the observed flip truncation
|
|
204
|
+
* was 45 bars). Heatmap keeps 2 (its columns close tens of seconds late).
|
|
205
|
+
*/
|
|
206
|
+
export const INDICATOR_TAIL_HOLE_PROFILE_MIN_MISSING_ROWS = 4;
|
|
207
|
+
/**
|
|
208
|
+
* Suffix hole for overlays whose CLOSED-bar tail is fetch-owned (the planner's
|
|
209
|
+
* `tailHoles` opt-in; today the orderbook heatmap's column grid). Measured in
|
|
210
|
+
* MAIN ROWS, never wall-clock time: the hole is the span of main rows that lie
|
|
211
|
+
* strictly after the overlay's last row, and it exists only when at least
|
|
212
|
+
* `INDICATOR_TAIL_HOLE_MIN_MISSING_ROWS` of them do. Counting rows keeps a
|
|
213
|
+
* session jump honest (on anchored RTH grids Friday's last column and
|
|
214
|
+
* Monday's first bar are one row apart across a weekend of wall time: not a
|
|
215
|
+
* hole until Monday has rows the overlay lacks) and the range starts at the
|
|
216
|
+
* FIRST MISSING main row, not at the last mounted column, so a live-edge
|
|
217
|
+
* sliver stays inside the tail-adjacent filter. The range runs to the last
|
|
218
|
+
* main bar's bucket END (`lastMain + interval`) so the final closed bar is
|
|
219
|
+
* asked explicitly, not only through the heatmap lane's bucket alignment.
|
|
220
|
+
* Plain indicators never use this: their tail belongs to the live/polling
|
|
221
|
+
* lane (`findIndicatorGaps` emits prefix + interior holes only, by design).
|
|
222
|
+
*
|
|
223
|
+
* @returns the hole, or null when the overlay reaches main's tail (or inputs
|
|
224
|
+
* are unusable: < 1 overlay row, < 2 main rows, no interval).
|
|
225
|
+
*/
|
|
226
|
+
export function findIndicatorTailHole(overlayRawData, mainRawData, chartIntervalMs, minMissingRows = INDICATOR_TAIL_HOLE_MIN_MISSING_ROWS, tagTail = false) {
|
|
227
|
+
if (!overlayRawData?.length || !mainRawData || mainRawData.length < 2 || !(chartIntervalMs > 0))
|
|
228
|
+
return null;
|
|
229
|
+
const lastOverlayMs = overlayRawData[overlayRawData.length - 1][0];
|
|
230
|
+
const lastMainMs = mainRawData[mainRawData.length - 1][0];
|
|
231
|
+
if (!Number.isFinite(lastOverlayMs) || !Number.isFinite(lastMainMs) || lastMainMs <= lastOverlayMs)
|
|
232
|
+
return null;
|
|
233
|
+
// First main row strictly after the overlay's last row (binary search,
|
|
234
|
+
// ascending main rows); the missing count is everything from there on.
|
|
235
|
+
let lo = 0;
|
|
236
|
+
let hi = mainRawData.length - 1;
|
|
237
|
+
let firstMissingIdx = mainRawData.length;
|
|
238
|
+
while (lo <= hi) {
|
|
239
|
+
const mid = (lo + hi) >> 1;
|
|
240
|
+
if (mainRawData[mid][0] > lastOverlayMs) {
|
|
241
|
+
firstMissingIdx = mid;
|
|
242
|
+
hi = mid - 1;
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
lo = mid + 1;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const missingRows = mainRawData.length - firstMissingIdx;
|
|
249
|
+
if (missingRows < minMissingRows)
|
|
250
|
+
return null;
|
|
251
|
+
const hole = { fromMs: mainRawData[firstMissingIdx][0], toMs: lastMainMs + chartIntervalMs };
|
|
252
|
+
// The `tail` tag (sliver-filter exemption + re-detect end-anchoring) is
|
|
253
|
+
// EXPLICIT caller intent, never inferred from the threshold value: the
|
|
254
|
+
// profile lane opts in, the default-threshold callers (heatmap and
|
|
255
|
+
// book-timeline) keep their pre-existing tail-adjacent suppression
|
|
256
|
+
// semantics byte-identical whatever the constants are tuned to.
|
|
257
|
+
if (tagTail)
|
|
258
|
+
hole.tail = true;
|
|
259
|
+
return hole;
|
|
260
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export interface IndicatorGapRange {
|
|
2
|
+
fromMs: number;
|
|
3
|
+
toMs: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function isIndicatorGapRepairType(indicatorType: string | undefined): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Find indicator holes that are inconsistent with both the loaded main series
|
|
8
|
+
* and the indicator's own cadence. Funding-like indicators can naturally be
|
|
9
|
+
* sparse on a 1h chart, so the threshold is based on the overlay median delta
|
|
10
|
+
* when enough rows exist, with the chart interval as the fallback.
|
|
11
|
+
*/
|
|
12
|
+
export declare function findIndicatorDataGaps(indicatorRows: number[][] | undefined, mainRows: number[][] | undefined, intervalMs: number): IndicatorGapRange[];
|
|
13
|
+
/**
|
|
14
|
+
* REPAIR_COVERED_RANGE_SKIP decision (guard site in data-fetching.util.ts;
|
|
15
|
+
* history-fetch-fanout-contract.md).
|
|
16
|
+
*
|
|
17
|
+
* A gap-recovery fetch runs a range computed at ARM time; by drain time (the
|
|
18
|
+
* per-overlay in-flight queue, the recovery poller's cadence) the range is
|
|
19
|
+
* often already healed by the wave/chain traffic that landed in between.
|
|
20
|
+
* Re-run the repair detector against the CURRENT rows and skip only on a
|
|
21
|
+
* positive full-coverage verdict: no detected gap intersects the requested
|
|
22
|
+
* range. 2026-07-27 production dump: 10 of 16 AGG CVD repair cycles
|
|
23
|
+
* re-bought buckets whose rows were already mounted, sustaining a 1-3s
|
|
24
|
+
* wholesale reapply loop the user saw as the pane pumping in and out.
|
|
25
|
+
*
|
|
26
|
+
* The B4 poller and the one-shot heal ARM via the RECOVERY detector
|
|
27
|
+
* (indicator-gap-detector.util.ts; the two detectors' divergences are the
|
|
28
|
+
* pinned P3.1 inventory), and the cluster-scan extension arms via EXPLICIT
|
|
29
|
+
* planner demands, so this guard may only suppress where the repair
|
|
30
|
+
* detector positively vouches. It fails OPEN (fetch proceeds) whenever it
|
|
31
|
+
* cannot:
|
|
32
|
+
* - degenerate request or unknown interval,
|
|
33
|
+
* - overlay rows empty (first load, structurally row-less overlays),
|
|
34
|
+
* - fewer than two main rows (the detector is main-anchored; the pinned
|
|
35
|
+
* sequential-heal semantics in data-fetching.gap-recovery-dedupe.node.spec
|
|
36
|
+
* depend on this arm staying live),
|
|
37
|
+
* - the requested range reaching OUTSIDE the loaded main span (the detector
|
|
38
|
+
* only reports holes strictly inside it; the cluster-scan footprint
|
|
39
|
+
* extension demands bars BEFORE the mounted history and must always
|
|
40
|
+
* dispatch),
|
|
41
|
+
* - fewer than MIN_ROWS_FOR_MEDIAN overlay rows inside the main span (the
|
|
42
|
+
* recovery detector refuses to judge such sparse overlays and arms from
|
|
43
|
+
* fallback gaps; the repair detector would median a single delta into a
|
|
44
|
+
* giant cadence and declare them covered, driving the poller's backoff to
|
|
45
|
+
* a false upstream-persistent terminal with zero wire requests).
|
|
46
|
+
*/
|
|
47
|
+
export interface CoveredRepairRangeVerdictPrep {
|
|
48
|
+
mainFirstTs: number;
|
|
49
|
+
mainLastTs: number;
|
|
50
|
+
gaps: IndicatorGapRange[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Range-independent half of the covered-repair verdict: the series-sized
|
|
54
|
+
* sorts and the detector run happen ONCE per (overlayRows, mainRows)
|
|
55
|
+
* snapshot; `coveredRepairRangeVouched` then answers per range in O(gaps).
|
|
56
|
+
* Returns null whenever the detector cannot judge (the guard's fail-open
|
|
57
|
+
* classes), so callers fail open exactly as before.
|
|
58
|
+
*/
|
|
59
|
+
export declare function prepareCoveredRepairRangeVerdict(input: {
|
|
60
|
+
overlayRows: number[][] | undefined;
|
|
61
|
+
mainRows: number[][] | undefined;
|
|
62
|
+
intervalMs: number;
|
|
63
|
+
}): CoveredRepairRangeVerdictPrep | null;
|
|
64
|
+
/**
|
|
65
|
+
* Per-range half: bounds inside the judged main span AND no detected gap
|
|
66
|
+
* intersecting. A range reaching outside the loaded main span fails open
|
|
67
|
+
* (a cluster-scan history extension wants rows the chart does not hold yet)
|
|
68
|
+
* UNLESS `clampToMainSpan`: an overlay whose apply keeps only rows with a
|
|
69
|
+
* main bar (the reconcile coverage class `depth`) can never be covered
|
|
70
|
+
* outside the main span, so the judged range is cut to it and the part
|
|
71
|
+
* outside counts as served by construction. Without the clamp the
|
|
72
|
+
* planner's bucket-floored head chunk (2026-09-18 dump: 143 bars older than
|
|
73
|
+
* the chart's first candle) was re-bought and re-committed on every
|
|
74
|
+
* gap-recovery round until the attempt cap, each commit repainting the pane.
|
|
75
|
+
*/
|
|
76
|
+
export declare function coveredRepairRangeVouched(prep: CoveredRepairRangeVerdictPrep, fromSec: number, periodSec: number, options?: {
|
|
77
|
+
clampToMainSpan?: boolean;
|
|
78
|
+
}): boolean;
|
|
79
|
+
export declare function shouldSkipCoveredRepairRangeFetch(input: {
|
|
80
|
+
overlayRows: number[][] | undefined;
|
|
81
|
+
mainRows: number[][] | undefined;
|
|
82
|
+
intervalMs: number;
|
|
83
|
+
fromSec: number;
|
|
84
|
+
periodSec: number;
|
|
85
|
+
/** The overlay's apply keeps only rows with a main bar: judge the range inside the main span only. */
|
|
86
|
+
clampToMainSpan?: boolean;
|
|
87
|
+
}): boolean;
|
|
88
|
+
export declare function clampIndicatorGapToViewportCushion(gap: IndicatorGapRange, viewportStartMs: number, viewportEndMs: number, intervalMs: number): IndicatorGapRange | null;
|