@orangecharts/wrun-chart-host 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -6
- package/dist/constants/common.constants.d.ts +15 -0
- package/dist/constants/common.constants.js +23 -0
- package/dist/constants/data-source.constants.d.ts +1 -0
- package/dist/constants/data-source.constants.js +1 -0
- package/dist/constants/economic.constants.d.ts +39 -0
- package/dist/constants/economic.constants.js +77 -0
- package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
- package/dist/constants/etf-covered-coins.constants.js +9 -0
- package/dist/constants/feature-flags.constants.d.ts +60 -0
- package/dist/constants/feature-flags.constants.js +308 -0
- package/dist/constants/feature-limits.constants.d.ts +134 -0
- package/dist/constants/feature-limits.constants.js +155 -0
- package/dist/constants/marketCapabilities.constants.d.ts +87 -0
- package/dist/constants/marketCapabilities.constants.js +213 -0
- package/dist/constants/option-venues.constants.d.ts +100 -0
- package/dist/constants/option-venues.constants.js +167 -0
- package/dist/constants/overlay-data.constants.d.ts +53 -0
- package/dist/constants/overlay-data.constants.js +80 -0
- package/dist/constants/pane-grid.constants.d.ts +15 -0
- package/dist/constants/pane-grid.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +10 -0
- package/dist/constants/venue-presets.constants.js +22 -0
- package/dist/enums/chart.enum.d.ts +68 -0
- package/dist/enums/chart.enum.js +70 -0
- package/dist/helpers/data.helpers.d.ts +2 -0
- package/dist/helpers/data.helpers.js +14 -0
- package/dist/host-env.d.ts +161 -5
- package/dist/host-ports.types.d.ts +446 -0
- package/dist/host-ports.types.js +1 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.js +128 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
- package/dist/interfaces/asset-venue.interface.d.ts +91 -0
- package/dist/interfaces/asset-venue.interface.js +1 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
- package/dist/interfaces/cancel-reason.interface.js +2 -0
- package/dist/interfaces/catalog-display.interface.d.ts +3 -0
- package/dist/interfaces/catalog-display.interface.js +1 -0
- package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
- package/dist/interfaces/cme-realtime.interface.js +46 -0
- package/dist/interfaces/feed.interface.d.ts +80 -0
- package/dist/interfaces/feed.interface.js +7 -0
- package/dist/interfaces/market-kind.interface.d.ts +8 -0
- package/dist/interfaces/market-kind.interface.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
- package/dist/interfaces/opra-realtime.interface.js +105 -0
- package/dist/interfaces/option-instrument.interface.d.ts +32 -0
- package/dist/interfaces/option-instrument.interface.js +1 -0
- package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
- package/dist/interfaces/options-chain-scope.interface.js +7 -0
- package/dist/interfaces/prediction-market.interface.d.ts +88 -0
- package/dist/interfaces/prediction-market.interface.js +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
- package/dist/settings-templates/frvp-fields.d.ts +27 -0
- package/dist/settings-templates/frvp-fields.js +108 -0
- package/dist/settings-templates/index.d.ts +119 -0
- package/dist/settings-templates/index.js +442 -0
- package/dist/settings-templates/indicator-fields.d.ts +56 -0
- package/dist/settings-templates/indicator-fields.js +793 -0
- package/dist/settings-templates/tool-rules.d.ts +59 -0
- package/dist/settings-templates/tool-rules.js +49 -0
- package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
- package/dist/settings-templates/tool-tables.generated.js +1668 -0
- package/dist/utility/blk-market.util.d.ts +5 -0
- package/dist/utility/blk-market.util.js +12 -0
- package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
- package/dist/utility/chart/chart-load-phase.util.js +78 -0
- package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
- package/dist/utility/chart/cme-cache-context.util.js +166 -0
- package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
- package/dist/utility/chart/cme-session-bucket.util.js +343 -0
- package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
- package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
- package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
- package/dist/utility/chart/continuous-contracts.util.js +374 -0
- package/dist/utility/chart/feed-interval.util.d.ts +119 -0
- package/dist/utility/chart/feed-interval.util.js +321 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
- package/dist/utility/chart/footprint-band.util.d.ts +76 -0
- package/dist/utility/chart/footprint-band.util.js +205 -0
- package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
- package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
- package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
- package/dist/utility/chart/formula-calendar.util.js +59 -0
- package/dist/utility/chart/history-wall.util.d.ts +67 -0
- package/dist/utility/chart/history-wall.util.js +87 -0
- package/dist/utility/chart/index-mode.util.d.ts +66 -0
- package/dist/utility/chart/index-mode.util.js +360 -0
- package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
- package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
- package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
- package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
- package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
- package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
- package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
- package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
- package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
- package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
- package/dist/utility/chart/interval-registry.util.d.ts +23 -0
- package/dist/utility/chart/interval-registry.util.js +83 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
- package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
- package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
- package/dist/utility/chart/live-bucket.util.d.ts +66 -0
- package/dist/utility/chart/live-bucket.util.js +165 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
- package/dist/utility/chart/market-session-schedule.util.js +337 -0
- package/dist/utility/chart/marketKind.util.d.ts +181 -0
- package/dist/utility/chart/marketKind.util.js +371 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
- package/dist/utility/chart/opra-read-access.leaf.js +25 -0
- package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
- package/dist/utility/chart/prediction-identity.util.js +236 -0
- package/dist/utility/chart/rth-session.util.d.ts +352 -0
- package/dist/utility/chart/rth-session.util.js +926 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
- package/dist/utility/chart/titan-constants.pin.js +50 -0
- package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
- package/dist/utility/chart/us-equities-session.util.js +251 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
- package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
- package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
- package/dist/utility/common/safe-math-eval.d.ts +18 -0
- package/dist/utility/common/safe-math-eval.js +160 -0
- package/dist/utility/common/time.util.d.ts +134 -0
- package/dist/utility/common/time.util.js +428 -0
- package/dist/utility/common/transformations.util.d.ts +126 -0
- package/dist/utility/common/transformations.util.js +711 -0
- package/dist/utility/common/visible-timeout.util.d.ts +17 -0
- package/dist/utility/common/visible-timeout.util.js +75 -0
- package/dist/utility/exchange-normalization.util.d.ts +8 -0
- package/dist/utility/exchange-normalization.util.js +32 -0
- package/dist/utility/intl-locale.util.d.ts +2 -0
- package/dist/utility/intl-locale.util.js +28 -0
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +50 -19
- package/dist/utility/options/option-symbol.util.d.ts +28 -0
- package/dist/utility/options/option-symbol.util.js +176 -0
- package/dist/utility/options/option-trade-units.util.d.ts +190 -0
- package/dist/utility/options/option-trade-units.util.js +283 -0
- package/dist/utility/options/option-venue.util.d.ts +75 -0
- package/dist/utility/options/option-venue.util.js +85 -0
- package/dist/utility/pool-symbol.leaf.d.ts +34 -0
- package/dist/utility/pool-symbol.leaf.js +95 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
- package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
- package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
- package/dist/utility/v2/gate-plane.util.d.ts +58 -0
- package/dist/utility/v2/gate-plane.util.js +99 -0
- package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
- package/dist/utility/v2/gate-session-latch.util.js +34 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
- package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
- package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/economic.js +79 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
- package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/lanes/index.js +32 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
- package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
- package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
- package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
- package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
- package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
- package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
- package/dist/utility/wrun/sources/lanes/series.js +321 -0
- package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
- package/dist/utility/wrun/sources/registry.d.ts +21 -0
- package/dist/utility/wrun/sources/registry.js +207 -0
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
- package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
- package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
- package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
- package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
- package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
- package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-deadline.util.js +82 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
- package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
- package/dist/utility/wrun/wrun-frames.d.ts +20 -1
- package/dist/utility/wrun/wrun-frames.js +103 -49
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +27 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
- package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
- package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
- package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
- package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +30 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
- package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
- package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
- package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
- package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
- package/dist/utility/wrun/wrun-param-map.util.js +581 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +41 -1
- package/dist/utility/wrun/wrun-refusal.util.js +69 -2
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
- package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
- package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
- package/dist/utility/wrun/wrun-row-source.js +75 -0
- package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
- package/dist/utility/wrun/wrun-run-health.util.js +273 -0
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
- package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
- package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
- package/dist/utility/wrun-display-name.util.d.ts +33 -0
- package/dist/utility/wrun-display-name.util.js +64 -0
- package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
- package/dist/workers/constants/kscript-transport-codes.js +15 -0
- package/dist/workers/constants/socket-slots.d.ts +574 -0
- package/dist/workers/constants/socket-slots.js +539 -0
- package/dist/workers/utils/number.worker.util.d.ts +5 -0
- package/dist/workers/utils/number.worker.util.js +10 -0
- package/dist/workers/utils/time.worker.util.d.ts +12 -0
- package/dist/workers/utils/time.worker.util.js +24 -0
- package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
- package/dist/workers/utils/volume-profile.worker.util.js +631 -0
- package/package.json +10 -4
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The health of a finished Indicator run, for the two outcomes that draw nothing and say
|
|
3
|
+
* nothing: every bar was warm-up (`state()` never returned 1), and a drawn series that is NaN
|
|
4
|
+
* on every ready bar. Both compile clean, run clean and used to print the green check over an
|
|
5
|
+
* empty pane; the author's only way to see it was to type `rows` at the console.
|
|
6
|
+
*
|
|
7
|
+
* A short-form file (a top-level `function onBar(): void`, scaffold 29) has no warm-up row: its
|
|
8
|
+
* build returns 1 from state() on every bar and writes NaN to every output before `onBar()`,
|
|
9
|
+
* so the first verdict (`WRUN_NO_READY_ROWS`, anchored on state()) can never fire for it and
|
|
10
|
+
* its silent plot is the second one, counted over EVERY bar (`Output 'sma' is NaN on all 50
|
|
11
|
+
* ready bars`, the four-function form's 31 ready of 50 are 50 of 50 here). That row keeps its
|
|
12
|
+
* `finalize` anchor: the console resolves it onto `onBar()` in a short-form buffer
|
|
13
|
+
* (`runtimeDiagnosticToScriptEditorIssue`), the hook that runs the finalize phase.
|
|
14
|
+
*
|
|
15
|
+
* `wrunRunHealth` is the pure read over the run's output rows; `wrunRunHealthDiagnostics`
|
|
16
|
+
* turns it into runtime diagnostic rows (warnings, never errors: the run did finish) that name
|
|
17
|
+
* the export to look at (`details.anchorExport`, resolved against the buffer by
|
|
18
|
+
* `runtimeDiagnosticToScriptEditorIssue`). The run seam publishes them for DRAFT overlays only
|
|
19
|
+
* (`wrun-overlay-run.util`): on a viewer's chart a long window over a short history is an
|
|
20
|
+
* ordinary state, not a mistake to flag. A draft's live session keeps the verdict honest: a
|
|
21
|
+
* tick or reseed that makes the draft draw clears the rows (`sameWrunRunHealthVerdict` keeps
|
|
22
|
+
* a still-true verdict from being rewritten for every new bar).
|
|
23
|
+
*
|
|
24
|
+
* Only CONTINUOUS plots count as silent when all NaN (line, area, histogram, bar). An event
|
|
25
|
+
* plot (shape, scatter) with no event in the window, a candle group, and a data-only output
|
|
26
|
+
* (`none`, the `color_by` / `width_by` ladders) are legitimately empty. So is an output nobody
|
|
27
|
+
* sees: `legend: false` (drawn without a legend line: a hidden helper, a picked level that may be
|
|
28
|
+
* off) and `visible: false` (a caller folds the Style page's Visible row into it first). A silent
|
|
29
|
+
* output is named by its display label (`labels`, the legend's own words, never the raw id) on
|
|
30
|
+
* the chart's surfaces; the row's technical message keeps the id for the author's console.
|
|
31
|
+
*
|
|
32
|
+
* The refusal record (WRUN-REFUSALS): a row a viewer may read carries its completed record in
|
|
33
|
+
* `details.refusal` (a `WrunRefusal`, serialized by the publisher), so the legend and the console
|
|
34
|
+
* word it through the one text path; `message` keeps the technical words (the record's
|
|
35
|
+
* `details`, Copy details). `wrunNothingReadyRefusal` is the nothing-ready record (every bar was
|
|
36
|
+
* warm-up, never an all-NaN output); the leg rows (`WRUN_LEG_ROW_CODES`) add the markets a pinned
|
|
37
|
+
* leg found empty (`wrunEmptyLegDiagnostics`, one row for all) and the feeds the chart's fetch
|
|
38
|
+
* never serves to inputs that declared a missing fill (`wrunFeedMissingDiagnostics`).
|
|
39
|
+
*
|
|
40
|
+
* Leaf module, like wrun-debug-output.util: types and the pure refusal record only, so both
|
|
41
|
+
* drivers and the specs read it without dragging the host or the store.
|
|
42
|
+
*/
|
|
43
|
+
import type { RuntimeDiagnostic } from '../../interfaces/kscript-diagnostics.interface.js';
|
|
44
|
+
import type { WrunIndicatorMetadata, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
|
|
45
|
+
import { type WrunOptionsStopReason, type WrunRefusal, type WrunRefusalContext, type WrunRefusalMarket } from './wrun-refusal.util.js';
|
|
46
|
+
export declare const WRUN_NO_READY_ROWS_CODE = "WRUN_NO_READY_ROWS";
|
|
47
|
+
export declare const WRUN_OUTPUT_ALL_NAN_CODE = "WRUN_OUTPUT_ALL_NAN";
|
|
48
|
+
/** A pinned leg the chart could not serve (a venue the gateway serves no series for to scripts
|
|
49
|
+
* yet): the run proceeded, the leg's inputs read their missing fill on every bar. */
|
|
50
|
+
export declare const WRUN_LEG_UNSERVED_CODE = "WRUN_LEG_UNSERVED";
|
|
51
|
+
/** A leg ask the chart's history wall cut (the leg core's `wrunServedLegStart` note): the run
|
|
52
|
+
* drew from the history served, never refused for depth. */
|
|
53
|
+
export declare const WRUN_LEG_HISTORY_CLAMPED_CODE = "WRUN_LEG_HISTORY_CLAMPED";
|
|
54
|
+
/** Pinned markets that sent no rows for the window (or whose fetch failed short of a deadline)
|
|
55
|
+
* while every input reading them declared a missing fill: the run drew, those rows are empty. */
|
|
56
|
+
export declare const WRUN_LEG_EMPTY_CODE = "WRUN_LEG_EMPTY";
|
|
57
|
+
/** A feed the chart's fetch never serves on this market (the capability evidence) read by inputs
|
|
58
|
+
* that declared a missing fill: the run drew, those inputs read their fill. */
|
|
59
|
+
export declare const WRUN_FEED_MISSING_CODE = "WRUN_FEED_MISSING";
|
|
60
|
+
/** The rows the run seam owns for a run's health: replaced by every full run of a draft,
|
|
61
|
+
* cleared by a healthy one. */
|
|
62
|
+
export declare const WRUN_RUN_HEALTH_ROW_CODES: ReadonlySet<string>;
|
|
63
|
+
/** The rows the run seam owns for its legs (draft and registry runs alike): the unserved legs,
|
|
64
|
+
* the asks the history wall cut, the pinned markets found empty and the feeds the chart's fetch
|
|
65
|
+
* never serves, replaced by every full run, cleared by a run that served every leg in full. Its
|
|
66
|
+
* own set, so the draft health seam above never drops them on a tick. */
|
|
67
|
+
export declare const WRUN_LEG_ROW_CODES: ReadonlySet<string>;
|
|
68
|
+
/** One pinned leg that sent nothing for the window, or whose fetch failed short of a deadline,
|
|
69
|
+
* while every input reading its fetched rows declared a missing fill: those inputs read the fill
|
|
70
|
+
* and the run drew. */
|
|
71
|
+
export interface WrunEmptyLeg {
|
|
72
|
+
/** The declared input names reading the leg's fetched rows, ascending by index. */
|
|
73
|
+
inputNames: string[];
|
|
74
|
+
/** The leg's market (its symbol is the label the sentence names). */
|
|
75
|
+
market: WrunRefusalMarket;
|
|
76
|
+
cause: 'empty' | 'failed';
|
|
77
|
+
/** The technical words (Copy details only). */
|
|
78
|
+
details: string;
|
|
79
|
+
}
|
|
80
|
+
/** One feed the chart's fetch never serves on this market (index-mode admission, never an empty
|
|
81
|
+
* window) read by inputs that declared a missing fill: they read the fill and the run drew. */
|
|
82
|
+
export interface WrunMissingFeed {
|
|
83
|
+
/** The declared input names reading the feed, in declaration order. */
|
|
84
|
+
inputNames: string[];
|
|
85
|
+
/** A builtin source class or a poll lane key (a key of `WRUN_REFUSAL_FEED_KEYS`). */
|
|
86
|
+
feed: string;
|
|
87
|
+
/** `crypto-only` only when the chart is provably no crypto venue; `market` otherwise. */
|
|
88
|
+
variant: 'crypto-only' | 'market';
|
|
89
|
+
/** The technical words (Copy details only). */
|
|
90
|
+
details: string;
|
|
91
|
+
/**
|
|
92
|
+
* Why an options lane is not served although the chart's options exist (the flag check's `flag-off`, the plane
|
|
93
|
+
* router's `chart-kind`; opra-options-gate.util `opraOptionPlaneStop`): the note then says that reason
|
|
94
|
+
* (`options-stopped`), never "this market has no such feed".
|
|
95
|
+
*/
|
|
96
|
+
stop?: WrunOptionsStopReason;
|
|
97
|
+
}
|
|
98
|
+
/** ONE note row for every pinned leg the run found empty: the record names their markets
|
|
99
|
+
* (`legs-empty` `drew`, `count` the distinct markets, the first market as the record's), its
|
|
100
|
+
* details the legs' technical words; empty for no leg. */
|
|
101
|
+
export declare function wrunEmptyLegDiagnostics(legs: readonly WrunEmptyLeg[], ctx: WrunRefusalContext): RuntimeDiagnostic[];
|
|
102
|
+
/** One note row per feed the chart's fetch never serves on this market (entries naming the same
|
|
103
|
+
* feed and variant merge): the record is `feed-missing`, `crypto-only` where the chart is provably
|
|
104
|
+
* no crypto venue, else `market-note`; its OUT the context's switch target, else the works-on
|
|
105
|
+
* list. Empty for no feed. */
|
|
106
|
+
export declare function wrunFeedMissingDiagnostics(feeds: readonly WrunMissingFeed[], ctx: WrunRefusalContext): RuntimeDiagnostic[];
|
|
107
|
+
/** One pinned leg the run pass left unfetched because its venue serves no series to scripts
|
|
108
|
+
* yet (`WRUN_PIN_UNSERVED_EXCHANGES` in wrun-pin-venues.util: the index venues, held out of the
|
|
109
|
+
* gateway's directory until the data service opens them), so the leg is not servable. */
|
|
110
|
+
export interface WrunUnservedLeg {
|
|
111
|
+
/** The declared input names served off the leg, ascending by index. */
|
|
112
|
+
inputNames: string[];
|
|
113
|
+
/** The chart's spelling of the leg interval (`1h`, `4h`, ...). */
|
|
114
|
+
intervalKey: string;
|
|
115
|
+
/** The pinned market the leg would have read, and its `exchange/symbol` label. */
|
|
116
|
+
exchange: string;
|
|
117
|
+
symbol: string;
|
|
118
|
+
market: string;
|
|
119
|
+
reason: 'venue-unserved';
|
|
120
|
+
}
|
|
121
|
+
/** The warning rows of the unserved legs: an input is NaN on every bar (0 for an `is_new_period`
|
|
122
|
+
* view, 0 under `missing: "zero"`, an absent block for intrabar cells) and the row says why, so
|
|
123
|
+
* the author can read the input as absent and draw a words line.
|
|
124
|
+
* - Without `ctx`: one row per input, as the author's console has always read them.
|
|
125
|
+
* - With `ctx`: one row per pinned market (its legs merged, every input named in
|
|
126
|
+
* `details.inputs`), carrying the completed `index-unserved` record in `details.refusal`, so a
|
|
127
|
+
* viewer's legend words one note per market. */
|
|
128
|
+
export declare function wrunUnservedLegDiagnostics(legs: ReadonlyArray<WrunUnservedLeg>, ctx?: WrunRefusalContext): RuntimeDiagnostic[];
|
|
129
|
+
export interface WrunRunHealth {
|
|
130
|
+
/** Rows the run returned (one per bar fed). */
|
|
131
|
+
bars: number;
|
|
132
|
+
/** Rows on which `state()` returned 1 (outputs present). */
|
|
133
|
+
ready: number;
|
|
134
|
+
/** Rows on which `state()` returned 0. */
|
|
135
|
+
warmup: number;
|
|
136
|
+
/** Continuous plots that are NaN (or never finite) on every ready row, in slot order. */
|
|
137
|
+
silentOutputs: string[];
|
|
138
|
+
/** The display label of each silent output by name (the declared `label`, else the name read
|
|
139
|
+
* as words): present only while an output is silent. */
|
|
140
|
+
labels?: Readonly<Record<string, string>>;
|
|
141
|
+
}
|
|
142
|
+
export declare function wrunRunHealth(metadata: Pick<WrunIndicatorMetadata, 'outputs'>, rows: ReadonlyArray<WrunOutputRow>): WrunRunHealth;
|
|
143
|
+
/** True when two health row sets state the same verdicts (a live session recomputing its
|
|
144
|
+
* health on every tick republishes only when the verdict changes, never for a bar count). */
|
|
145
|
+
export declare function sameWrunRunHealthVerdict(current: ReadonlyArray<RuntimeDiagnostic>, next: ReadonlyArray<RuntimeDiagnostic>): boolean;
|
|
146
|
+
/** The warnings a run's health raises; empty for a run that drew something on every watched
|
|
147
|
+
* plot, and for a run over no bars at all (no data is another seam's message). `refusal` (the
|
|
148
|
+
* `wrunNothingReadyRefusal` record) rides the all-warm-up row as `details.refusal`; a silent
|
|
149
|
+
* output row never carries one. */
|
|
150
|
+
export declare function wrunRunHealthDiagnostics(health: WrunRunHealth, refusal?: WrunRefusal): RuntimeDiagnostic[];
|
|
151
|
+
/** The nothing-ready record of a run's health: only when bars arrived and EVERY one was warm-up
|
|
152
|
+
* (`ready === 0 && bars > 0`), never from an all-NaN output (a drawn series that is empty is the
|
|
153
|
+
* author's to read, not a viewer's refusal); null otherwise. Its details are the all-warm-up
|
|
154
|
+
* row's technical words. */
|
|
155
|
+
export declare function wrunNothingReadyRefusal(health: WrunRunHealth, ctx: WrunRefusalContext): WrunRefusal | null;
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { wrunLegendName } from '../chart/wrun-legend-name.util.js';
|
|
2
|
+
import { attachWrunRefusal, wrunOptionsStopSeed, wrunRefusalFor, } from './wrun-refusal.util.js';
|
|
3
|
+
export const WRUN_NO_READY_ROWS_CODE = 'WRUN_NO_READY_ROWS';
|
|
4
|
+
export const WRUN_OUTPUT_ALL_NAN_CODE = 'WRUN_OUTPUT_ALL_NAN';
|
|
5
|
+
/** A pinned leg the chart could not serve (a venue the gateway serves no series for to scripts
|
|
6
|
+
* yet): the run proceeded, the leg's inputs read their missing fill on every bar. */
|
|
7
|
+
export const WRUN_LEG_UNSERVED_CODE = 'WRUN_LEG_UNSERVED';
|
|
8
|
+
/** A leg ask the chart's history wall cut (the leg core's `wrunServedLegStart` note): the run
|
|
9
|
+
* drew from the history served, never refused for depth. */
|
|
10
|
+
export const WRUN_LEG_HISTORY_CLAMPED_CODE = 'WRUN_LEG_HISTORY_CLAMPED';
|
|
11
|
+
/** Pinned markets that sent no rows for the window (or whose fetch failed short of a deadline)
|
|
12
|
+
* while every input reading them declared a missing fill: the run drew, those rows are empty. */
|
|
13
|
+
export const WRUN_LEG_EMPTY_CODE = 'WRUN_LEG_EMPTY';
|
|
14
|
+
/** A feed the chart's fetch never serves on this market (the capability evidence) read by inputs
|
|
15
|
+
* that declared a missing fill: the run drew, those inputs read their fill. */
|
|
16
|
+
export const WRUN_FEED_MISSING_CODE = 'WRUN_FEED_MISSING';
|
|
17
|
+
/** The rows the run seam owns for a run's health: replaced by every full run of a draft,
|
|
18
|
+
* cleared by a healthy one. */
|
|
19
|
+
export const WRUN_RUN_HEALTH_ROW_CODES = new Set([
|
|
20
|
+
WRUN_NO_READY_ROWS_CODE,
|
|
21
|
+
WRUN_OUTPUT_ALL_NAN_CODE,
|
|
22
|
+
]);
|
|
23
|
+
/** The rows the run seam owns for its legs (draft and registry runs alike): the unserved legs,
|
|
24
|
+
* the asks the history wall cut, the pinned markets found empty and the feeds the chart's fetch
|
|
25
|
+
* never serves, replaced by every full run, cleared by a run that served every leg in full. Its
|
|
26
|
+
* own set, so the draft health seam above never drops them on a tick. */
|
|
27
|
+
export const WRUN_LEG_ROW_CODES = new Set([
|
|
28
|
+
WRUN_LEG_UNSERVED_CODE,
|
|
29
|
+
WRUN_LEG_HISTORY_CLAMPED_CODE,
|
|
30
|
+
WRUN_LEG_EMPTY_CODE,
|
|
31
|
+
WRUN_FEED_MISSING_CODE,
|
|
32
|
+
]);
|
|
33
|
+
/** The completed record of a seed with the raiser's technical words as its details (the attached
|
|
34
|
+
* seed wins in `wrunRefusalFor`). */
|
|
35
|
+
function wrunRowRefusal(seed, details, ctx) {
|
|
36
|
+
return wrunRefusalFor(attachWrunRefusal(new Error(details), seed), ctx);
|
|
37
|
+
}
|
|
38
|
+
/** Each text once, in first-seen order, one per line. */
|
|
39
|
+
function joinedDetails(texts) {
|
|
40
|
+
return [...new Set(texts.filter((text) => text !== ''))].join('\n');
|
|
41
|
+
}
|
|
42
|
+
/** ONE note row for every pinned leg the run found empty: the record names their markets
|
|
43
|
+
* (`legs-empty` `drew`, `count` the distinct markets, the first market as the record's), its
|
|
44
|
+
* details the legs' technical words; empty for no leg. */
|
|
45
|
+
export function wrunEmptyLegDiagnostics(legs, ctx) {
|
|
46
|
+
if (legs.length === 0)
|
|
47
|
+
return [];
|
|
48
|
+
const markets = new Map();
|
|
49
|
+
for (const leg of legs) {
|
|
50
|
+
const key = `${leg.market.exchange}|${leg.market.symbol}`;
|
|
51
|
+
if (!markets.has(key))
|
|
52
|
+
markets.set(key, leg.market);
|
|
53
|
+
}
|
|
54
|
+
const labels = [...markets.values()].map((market) => market.label);
|
|
55
|
+
const inputNames = [...new Set(legs.flatMap((leg) => leg.inputNames))];
|
|
56
|
+
const details = joinedDetails(legs.map((leg) => leg.details));
|
|
57
|
+
const refusal = wrunRowRefusal({
|
|
58
|
+
cls: 'legs-empty',
|
|
59
|
+
variant: 'drew',
|
|
60
|
+
market: [...markets.values()][0],
|
|
61
|
+
params: { markets: labels.join(', '), count: markets.size },
|
|
62
|
+
severity: 'note',
|
|
63
|
+
}, details, ctx);
|
|
64
|
+
return [
|
|
65
|
+
{
|
|
66
|
+
stage: 'compute',
|
|
67
|
+
severity: 'warning',
|
|
68
|
+
code: WRUN_LEG_EMPTY_CODE,
|
|
69
|
+
type: 'execution',
|
|
70
|
+
message: details,
|
|
71
|
+
details: { inputs: inputNames, markets: labels, causes: [...new Set(legs.map((leg) => leg.cause))], refusal },
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
/** One note row per feed the chart's fetch never serves on this market (entries naming the same
|
|
76
|
+
* feed and variant merge): the record is `feed-missing`, `crypto-only` where the chart is provably
|
|
77
|
+
* no crypto venue, else `market-note`; its OUT the context's switch target, else the works-on
|
|
78
|
+
* list. Empty for no feed. */
|
|
79
|
+
export function wrunFeedMissingDiagnostics(feeds, ctx) {
|
|
80
|
+
const merged = new Map();
|
|
81
|
+
for (const feed of feeds) {
|
|
82
|
+
// A stopped options lane merges by its reason: one note says it once for every lane it stopped.
|
|
83
|
+
const key = feed.stop !== undefined ? `stop|${feed.stop}` : `${feed.feed}|${feed.variant}`;
|
|
84
|
+
const entry = merged.get(key);
|
|
85
|
+
if (entry === undefined) {
|
|
86
|
+
merged.set(key, { ...feed, inputNames: [...feed.inputNames] });
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
for (const name of feed.inputNames)
|
|
90
|
+
if (!entry.inputNames.includes(name))
|
|
91
|
+
entry.inputNames.push(name);
|
|
92
|
+
entry.details = joinedDetails([entry.details, feed.details]);
|
|
93
|
+
}
|
|
94
|
+
return [...merged.values()].map((feed) => ({
|
|
95
|
+
stage: 'compute',
|
|
96
|
+
severity: 'warning',
|
|
97
|
+
code: WRUN_FEED_MISSING_CODE,
|
|
98
|
+
type: 'execution',
|
|
99
|
+
message: feed.details,
|
|
100
|
+
details: {
|
|
101
|
+
inputs: feed.inputNames,
|
|
102
|
+
feed: feed.feed,
|
|
103
|
+
refusal: wrunRowRefusal(feed.stop !== undefined
|
|
104
|
+
? wrunOptionsStopSeed(feed.stop, { severity: 'note' })
|
|
105
|
+
: {
|
|
106
|
+
cls: 'feed-missing',
|
|
107
|
+
variant: feed.variant === 'crypto-only' ? 'crypto-only' : 'market-note',
|
|
108
|
+
params: { feed: feed.feed },
|
|
109
|
+
severity: 'note',
|
|
110
|
+
}, feed.details, ctx),
|
|
111
|
+
},
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
/** The technical words of one input on an unserved leg: the alerts engine's for the same refusal
|
|
115
|
+
* (its wrun-input-plan), so a script reads one reason on every host. */
|
|
116
|
+
function unservedInputMessage(input, leg) {
|
|
117
|
+
return (`Input '${input}' pins ${leg.symbol} on ${leg.exchange}; index series (SPX, NDX, VIX, DJI) are not served yet: ` +
|
|
118
|
+
`the gateway holds ${leg.exchange} out of the market directory until the backend opens it, ` +
|
|
119
|
+
`so the input reads its missing fill (NaN) on every bar.`);
|
|
120
|
+
}
|
|
121
|
+
const UNSERVED_SUGGESTED_FIX = 'Treat the input as absent until the venue is served (a NaN check) and say so with a label, or pin a served market: ' +
|
|
122
|
+
'an index ETF on POLYGON (SPY/USD, QQQ/USD), a forex pair, gold or silver on FX_OTC (EUR/USD, XAU/USD, XAG/USD).';
|
|
123
|
+
/** The warning rows of the unserved legs: an input is NaN on every bar (0 for an `is_new_period`
|
|
124
|
+
* view, 0 under `missing: "zero"`, an absent block for intrabar cells) and the row says why, so
|
|
125
|
+
* the author can read the input as absent and draw a words line.
|
|
126
|
+
* - Without `ctx`: one row per input, as the author's console has always read them.
|
|
127
|
+
* - With `ctx`: one row per pinned market (its legs merged, every input named in
|
|
128
|
+
* `details.inputs`), carrying the completed `index-unserved` record in `details.refusal`, so a
|
|
129
|
+
* viewer's legend words one note per market. */
|
|
130
|
+
export function wrunUnservedLegDiagnostics(legs, ctx) {
|
|
131
|
+
if (ctx === undefined) {
|
|
132
|
+
return legs.flatMap((leg) => leg.inputNames.map((input) => ({
|
|
133
|
+
stage: 'compute',
|
|
134
|
+
severity: 'warning',
|
|
135
|
+
code: WRUN_LEG_UNSERVED_CODE,
|
|
136
|
+
type: 'execution',
|
|
137
|
+
message: unservedInputMessage(input, leg),
|
|
138
|
+
suggestedFix: UNSERVED_SUGGESTED_FIX,
|
|
139
|
+
details: { input, interval: leg.intervalKey, market: leg.market, reason: leg.reason },
|
|
140
|
+
})));
|
|
141
|
+
}
|
|
142
|
+
const byMarket = new Map();
|
|
143
|
+
for (const leg of legs) {
|
|
144
|
+
if (leg.inputNames.length === 0)
|
|
145
|
+
continue;
|
|
146
|
+
const group = byMarket.get(leg.market);
|
|
147
|
+
if (group === undefined)
|
|
148
|
+
byMarket.set(leg.market, [leg]);
|
|
149
|
+
else
|
|
150
|
+
group.push(leg);
|
|
151
|
+
}
|
|
152
|
+
return [...byMarket.values()].map((group) => {
|
|
153
|
+
const [first] = group;
|
|
154
|
+
const inputs = [...new Set(group.flatMap((leg) => leg.inputNames))];
|
|
155
|
+
const message = joinedDetails(group.flatMap((leg) => leg.inputNames.map((input) => unservedInputMessage(input, leg))));
|
|
156
|
+
const refusal = wrunRowRefusal({
|
|
157
|
+
cls: 'index-unserved',
|
|
158
|
+
market: { exchange: first.exchange, symbol: first.symbol, label: first.symbol },
|
|
159
|
+
params: { symbol: first.symbol },
|
|
160
|
+
severity: 'note',
|
|
161
|
+
}, message, ctx);
|
|
162
|
+
return {
|
|
163
|
+
stage: 'compute',
|
|
164
|
+
severity: 'warning',
|
|
165
|
+
code: WRUN_LEG_UNSERVED_CODE,
|
|
166
|
+
type: 'execution',
|
|
167
|
+
message,
|
|
168
|
+
suggestedFix: UNSERVED_SUGGESTED_FIX,
|
|
169
|
+
details: {
|
|
170
|
+
input: inputs[0],
|
|
171
|
+
inputs,
|
|
172
|
+
interval: first.intervalKey,
|
|
173
|
+
market: first.market,
|
|
174
|
+
reason: first.reason,
|
|
175
|
+
refusal,
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/** Plots that draw a value on every ready bar; a sheet output with no `plot` draws a line. */
|
|
181
|
+
const CONTINUOUS_PLOTS = new Set(['line', 'area', 'histogram', 'bar']);
|
|
182
|
+
const DEFAULT_PLOT = 'line';
|
|
183
|
+
export function wrunRunHealth(metadata, rows) {
|
|
184
|
+
const outputs = Array.isArray(metadata?.outputs) ? metadata.outputs : [];
|
|
185
|
+
const watched = outputs.filter((output) => CONTINUOUS_PLOTS.has(output.plot ?? DEFAULT_PLOT) && output.legend !== false && output.visible !== false);
|
|
186
|
+
const finite = new Set();
|
|
187
|
+
let ready = 0;
|
|
188
|
+
for (const row of rows) {
|
|
189
|
+
if (row.outputs === null)
|
|
190
|
+
continue;
|
|
191
|
+
ready += 1;
|
|
192
|
+
if (finite.size === watched.length)
|
|
193
|
+
continue;
|
|
194
|
+
for (const output of watched) {
|
|
195
|
+
if (finite.has(output.index))
|
|
196
|
+
continue;
|
|
197
|
+
if (Number.isFinite(row.outputs[output.index]))
|
|
198
|
+
finite.add(output.index);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const silent = ready === 0 ? [] : watched.filter((output) => !finite.has(output.index));
|
|
202
|
+
return {
|
|
203
|
+
bars: rows.length,
|
|
204
|
+
ready,
|
|
205
|
+
warmup: rows.length - ready,
|
|
206
|
+
silentOutputs: silent.map((output) => output.name),
|
|
207
|
+
...(silent.length > 0
|
|
208
|
+
? { labels: Object.fromEntries(silent.map((output) => [output.name, wrunLegendName(output.name, output.label)])) }
|
|
209
|
+
: {}),
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function healthRow(code, message, suggestedFix, anchorExport, health, output) {
|
|
213
|
+
return {
|
|
214
|
+
stage: 'compute',
|
|
215
|
+
severity: 'warning',
|
|
216
|
+
code,
|
|
217
|
+
message,
|
|
218
|
+
suggestedFix,
|
|
219
|
+
type: 'execution',
|
|
220
|
+
details: {
|
|
221
|
+
anchorExport,
|
|
222
|
+
bars: health.bars,
|
|
223
|
+
ready: health.ready,
|
|
224
|
+
warmup: health.warmup,
|
|
225
|
+
...(output ? { output } : {}),
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/** The verdict a health row states, without its bar counts: the same code on the same export
|
|
230
|
+
* (and output) is the same warning even after more bars arrived. */
|
|
231
|
+
function healthRowKey(row) {
|
|
232
|
+
const details = (row.details ?? {});
|
|
233
|
+
return `${row.code}|${String(details.anchorExport ?? '')}|${String(details.output ?? '')}`;
|
|
234
|
+
}
|
|
235
|
+
/** True when two health row sets state the same verdicts (a live session recomputing its
|
|
236
|
+
* health on every tick republishes only when the verdict changes, never for a bar count). */
|
|
237
|
+
export function sameWrunRunHealthVerdict(current, next) {
|
|
238
|
+
if (current.length !== next.length)
|
|
239
|
+
return false;
|
|
240
|
+
const keys = new Set(current.map(healthRowKey));
|
|
241
|
+
return next.every((row) => keys.has(healthRowKey(row)));
|
|
242
|
+
}
|
|
243
|
+
/** The technical words of the all-warm-up verdict. */
|
|
244
|
+
function noReadyRowsMessage(health) {
|
|
245
|
+
return `Nothing was drawn: state() returned 0 on all ${health.bars} bars, so every bar counted as warm-up.`;
|
|
246
|
+
}
|
|
247
|
+
/** The warnings a run's health raises; empty for a run that drew something on every watched
|
|
248
|
+
* plot, and for a run over no bars at all (no data is another seam's message). `refusal` (the
|
|
249
|
+
* `wrunNothingReadyRefusal` record) rides the all-warm-up row as `details.refusal`; a silent
|
|
250
|
+
* output row never carries one. */
|
|
251
|
+
export function wrunRunHealthDiagnostics(health, refusal) {
|
|
252
|
+
if (health.bars === 0)
|
|
253
|
+
return [];
|
|
254
|
+
if (health.ready === 0) {
|
|
255
|
+
const row = healthRow(WRUN_NO_READY_ROWS_CODE, noReadyRowsMessage(health), 'Return 1 from state() once the value is real, and check that the warm-up window is shorter than the loaded history and that every input had data on these bars.', 'state', health);
|
|
256
|
+
return [refusal === undefined ? row : { ...row, details: { ...row.details, refusal } }];
|
|
257
|
+
}
|
|
258
|
+
return health.silentOutputs.map((name) => {
|
|
259
|
+
const row = healthRow(WRUN_OUTPUT_ALL_NAN_CODE, `Output '${name}' is NaN on all ${health.ready} ready bars, so nothing is drawn for it.`, `Check the value passed to out_${name}(): a NaN input or a division by zero carries through every bar.`, 'finalize', health, name);
|
|
260
|
+
// The display label the chart's surfaces name the output by (the message keeps the id the
|
|
261
|
+
// author's writer is called by).
|
|
262
|
+
return { ...row, details: { ...row.details, label: health.labels?.[name] ?? wrunLegendName(name) } };
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/** The nothing-ready record of a run's health: only when bars arrived and EVERY one was warm-up
|
|
266
|
+
* (`ready === 0 && bars > 0`), never from an all-NaN output (a drawn series that is empty is the
|
|
267
|
+
* author's to read, not a viewer's refusal); null otherwise. Its details are the all-warm-up
|
|
268
|
+
* row's technical words. */
|
|
269
|
+
export function wrunNothingReadyRefusal(health, ctx) {
|
|
270
|
+
if (!(health.bars > 0 && health.ready === 0))
|
|
271
|
+
return null;
|
|
272
|
+
return wrunRowRefusal({ cls: 'nothing-ready' }, noReadyRowsMessage(health), ctx);
|
|
273
|
+
}
|