@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,185 @@
|
|
|
1
|
+
import { type OptionTradeUnits } from '../../utility/options/option-trade-units.util.js';
|
|
2
|
+
export declare const LIVE_MAX_CELLS_PER_BAR = 20000;
|
|
3
|
+
/** The raw TRADE table's retention (about two days): a seeded history ask never reaches behind
|
|
4
|
+
* it (older windows answer nothing and cost the gateway a scan over cold chunks). */
|
|
5
|
+
export declare const TRADES_RETENTION_SEC: number;
|
|
6
|
+
/** The `trade_large` table's retention (tsdb-gateway: the prints of at least $10k quote on
|
|
7
|
+
* USD-quoted markets, copied from TRADE and kept 90 days): the large lane's horizon. */
|
|
8
|
+
export declare const TRADES_LARGE_RETENTION_SEC: number;
|
|
9
|
+
/** tsdb-gateway's bar limit on the large lane (validateKiyoPlusBar, kiyo_plus_validation.go): an
|
|
10
|
+
* unaggregated read (TRADE_LARGE included) is estimated at one point per minute, and a tier user's
|
|
11
|
+
* window opening before now minus the tier's default max_bar_limit (15,000 on every tier of ore
|
|
12
|
+
* and cme) is trimmed to it without a word. About 10.4 days: the lane's real history horizon. */
|
|
13
|
+
export declare const TRADES_LARGE_BAR_LIMIT_SEC: number;
|
|
14
|
+
/** tsdb-gateway's trade_large floor (`write.large_trade_min_quote_amount`, default 10,000): a print
|
|
15
|
+
* is copied into the table when its quote amount reaches it. */
|
|
16
|
+
export declare const TRADES_LARGE_MIN_QUOTE_AMOUNT = 10000;
|
|
17
|
+
/** tsdb-gateway's trade_large floors on the CME Group venues (`write.large_trade_cme_contract_floors`
|
|
18
|
+
* in charts/tsdb-gateway/values.cme.yaml since !2239, 2026-10-14, which replaces the writer's code
|
|
19
|
+
* defaults wholesale): contracts per product root, the copy's quote amount priced with the root's
|
|
20
|
+
* point value. A root the list lacks is never copied: the writer skips it, and its large acquisition
|
|
21
|
+
* reads the raw tape's two hours instead (tradesLaneLimits). So a root the server floors and this
|
|
22
|
+
* map lacks draws two hours where the table holds days (Discord #557-saturn: 6E after !2239). A copy
|
|
23
|
+
* of the server's list until the floor rides the symbol metadata the chart already loads; then this
|
|
24
|
+
* map goes. Until then it changes in the same round as the values file. */
|
|
25
|
+
export declare const TRADES_LARGE_CME_CONTRACT_FLOORS: Readonly<Record<string, number>>;
|
|
26
|
+
/** A raw-tape acquisition's seed cap: a longer window over the raw TRADE table costs the gateway a
|
|
27
|
+
* scan over cold chunks (measured 18-30 s, or a server-side internal error, for ten days). */
|
|
28
|
+
export declare const TRADES_MAX_HISTORY_SEC: number;
|
|
29
|
+
/** The market a large-lane rule judges: the venue (the series envelope's, else the chart's), the
|
|
30
|
+
* normalized symbol (`ES-USD`, `BTC-USDT`) and, failing one, the raw symbol (`6AZ6`, `ES1!`). */
|
|
31
|
+
export interface TradesLargeMarket {
|
|
32
|
+
exchange?: unknown;
|
|
33
|
+
normalizedSymbol?: unknown;
|
|
34
|
+
symbol?: unknown;
|
|
35
|
+
/** An option book's registry trade units (`optionTradeUnitsOf` of its registry record): its live
|
|
36
|
+
* prints are floored on the premium the resolver's live-print rule reads (`tradePrintNotional`),
|
|
37
|
+
* never on price x size. */
|
|
38
|
+
optionUnits?: OptionTradeUnits | null;
|
|
39
|
+
}
|
|
40
|
+
/** The large-print table's floor on a market: contracts per product root on a CME Group venue (the
|
|
41
|
+
* writer's `largeCMEPoints`), notional on a market quoted in dollars (`largeDollarPoints`). */
|
|
42
|
+
export type TradesLargeFloor = {
|
|
43
|
+
kind: 'contracts';
|
|
44
|
+
min: number;
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'notional';
|
|
47
|
+
min: number;
|
|
48
|
+
};
|
|
49
|
+
/** The tape lane an acquisition rides on a market (`tradesLaneLimits`). */
|
|
50
|
+
export interface TradesLaneLimits {
|
|
51
|
+
/** The history reads the TRADE_LARGE table: a `large` acquisition on a market the table holds. */
|
|
52
|
+
readsLargeTable: boolean;
|
|
53
|
+
/** The seed cap: the table's retention on the large lane, two hours on the raw tape. */
|
|
54
|
+
historyCapSec: number;
|
|
55
|
+
retentionSec: number;
|
|
56
|
+
/** The gateway's bar limit on the large lane (`tradesBarLimitStartMs`); none on the raw tape. */
|
|
57
|
+
barLimitSec?: number;
|
|
58
|
+
}
|
|
59
|
+
export type LiveTradeCell = [number, number, number, number];
|
|
60
|
+
export type LiveTradesRow = [number, ...LiveTradeCell[]];
|
|
61
|
+
export interface LiveTradesMergeOptions {
|
|
62
|
+
/** The acquisition's size floor (the payload's `minSize`): a print below it never folds;
|
|
63
|
+
* absent, non-finite or non-positive = no floor. */
|
|
64
|
+
minSize?: unknown;
|
|
65
|
+
/** The large lane's table floor (the `large` acquisition): a print the large-print table never
|
|
66
|
+
* holds (`tradesBelowLargeFloor`; the print's envelope names the market, else this one) never
|
|
67
|
+
* folds, so no live print appears that the next reconcile cannot answer. */
|
|
68
|
+
largeFloor?: TradesLargeMarket;
|
|
69
|
+
/** Called when the fold trimmed the live bar to the cap (the oldest prints dropped), so the
|
|
70
|
+
* caller can warn once (the kScript lane) or refuse the bar by name (the wrun lane). */
|
|
71
|
+
onCapped?: (cap: number) => void;
|
|
72
|
+
}
|
|
73
|
+
/** One raw TRADE print as the fold reads it. */
|
|
74
|
+
export interface LiveTradePrint {
|
|
75
|
+
tsMs: number;
|
|
76
|
+
price: number;
|
|
77
|
+
size: number;
|
|
78
|
+
side: 1 | -1;
|
|
79
|
+
/** The series envelope's exchange (the CME Group lattice reads it), when the frame names one. */
|
|
80
|
+
exchange?: string;
|
|
81
|
+
/** The print's quote amount, when the frame carries a positive one. */
|
|
82
|
+
quoteAmount?: number;
|
|
83
|
+
/** The series envelope's normalized symbol (`BTC-USDT`), when the frame names one. */
|
|
84
|
+
normalizedSymbol?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The chart bar a print at `tsMs` lands in, keyed the way the chart's candles of that market are:
|
|
88
|
+
* the CME Group session lattice at 4h, 1d and 1w on a CME venue (the gateway's
|
|
89
|
+
* cmeSessionBucketExpression), else a week bar on its Monday (`findMonday`, the chart's week: the
|
|
90
|
+
* epoch week opens on a Thursday no weekly candle carries), else the UTC floor (the calendar
|
|
91
|
+
* boundary on a month-class bar).
|
|
92
|
+
*/
|
|
93
|
+
export declare function tradesBarStartMs(tsMs: number, intervalMs: number, exchange?: unknown): number;
|
|
94
|
+
/**
|
|
95
|
+
* Where a seeded history ask opens: the open of the chart bar holding `nowMs - historySec`, so the
|
|
96
|
+
* seed covers whole bars and a bar is never bought from its middle (it would be replaced by its
|
|
97
|
+
* later prints on every poll). A CME session lattice bar opens where the lattice opens it (a daily
|
|
98
|
+
* bar at the prior 17:00 Chicago open, ahead of its 00:00Z label); every other bar on
|
|
99
|
+
* `tradesBarStartMs` (a Monday on a week chart). Without a history the live edge itself.
|
|
100
|
+
*/
|
|
101
|
+
export declare function tradesSeedStartMs(nowMs: number, historySec: number, intervalMs: number, exchange?: unknown): number;
|
|
102
|
+
/**
|
|
103
|
+
* The instant the chart bar holding `tsMs` opens: on a CME Group venue the session lattice's open
|
|
104
|
+
* (a daily-class bar opens at the 17:00 Chicago open before its 00:00Z trade-date label,
|
|
105
|
+
* `cmeSessionBarOpenMs`), else the bar's own key (`tradesBarStartMs`: off the lattice a bar is keyed
|
|
106
|
+
* at its open).
|
|
107
|
+
*/
|
|
108
|
+
export declare function tradesBarOpenMs(tsMs: number, intervalMs: number, exchange?: unknown): number;
|
|
109
|
+
/** The open of the first chart bar opening at or after `tsMs`: the bar holding it when it opens
|
|
110
|
+
* right there, else the bar after it (the lattice's next session bar, the next calendar or fixed
|
|
111
|
+
* bar), so an ask that may not reach behind `tsMs` still covers whole bars only. */
|
|
112
|
+
export declare function tradesFirstBarOpenFromMs(tsMs: number, intervalMs: number, exchange?: unknown): number;
|
|
113
|
+
/** Where a large-lane ask opens at the earliest: the first bar open at or after now minus the
|
|
114
|
+
* gateway's bar limit (TRADES_LARGE_BAR_LIMIT_SEC, kept a margin inside it), so the gateway never
|
|
115
|
+
* trims the window it was handed and the worker's grid opens where the answer does. */
|
|
116
|
+
export declare function tradesBarLimitStartMs(nowMs: number, barLimitSec: number, intervalMs: number, exchange?: unknown): number;
|
|
117
|
+
/**
|
|
118
|
+
* The first stamp a seeded history ask serves prints from, whichever of these is latest (K_TRADES's
|
|
119
|
+
* request builder honors them all): the open of the bar holding the ask's own window start (an ask
|
|
120
|
+
* never opens inside a bar: a CME daily-class bar's key runs ahead of its open), the seed start
|
|
121
|
+
* (`tradesSeedStartMs`), the table's retention horizon, and on the large lane the gateway's bar
|
|
122
|
+
* limit (`barLimitSec`, `tradesBarLimitStartMs`). A reader of the answer (the wrun reconcile) tells
|
|
123
|
+
* a PARTIAL first bucket, one that opened before this stamp, from a bucket served whole.
|
|
124
|
+
*/
|
|
125
|
+
export declare function tradesServedStartMs(nowMs: number, historySec: number, intervalMs: number, options?: {
|
|
126
|
+
windowFromMs?: number;
|
|
127
|
+
retentionSec?: number;
|
|
128
|
+
barLimitSec?: number;
|
|
129
|
+
exchange?: unknown;
|
|
130
|
+
}): number;
|
|
131
|
+
/** One raw TRADE point read the way the fold reads it: the print's stamp in ms, its price, size,
|
|
132
|
+
* signed side and envelope exchange; null for a point the fold rejects (no side, a non-positive
|
|
133
|
+
* or non-finite size, a bad price or stamp). */
|
|
134
|
+
export declare function readLiveTradePrint(newPoint: unknown): LiveTradePrint | null;
|
|
135
|
+
/** Whether the large-print table floors a market's prints by notional: its normalized symbol's
|
|
136
|
+
* quote (the second field, the gateway writer's `quoteAsset`: `BTC-USDT` quotes USDT) is USD or a
|
|
137
|
+
* dollar stablecoin. Any other quote (KRW, a coin) is never copied: the table holds none of its
|
|
138
|
+
* prints at all. */
|
|
139
|
+
export declare function tradesLargeQuotedInDollars(normalizedSymbol: unknown): boolean;
|
|
140
|
+
/** A live print's notional: its quote amount when the frame carries one, else price x size. On an option
|
|
141
|
+
* book (`optionUnits`) the premium in the book's own currency by the resolver's live-print rule
|
|
142
|
+
* (option-trade-units.util `liveOptionPrintPremium`): a live print's size arrives in coin, live-feed having
|
|
143
|
+
* applied the contract multiplier, so the premium is price x size x point value / multiplier on a USD book
|
|
144
|
+
* and price x size on a coin book, the value the writer's floor reads once quote amounts follow the same
|
|
145
|
+
* rule; NaN when the units cannot say, which never reaches a floor. An option price is a premium, so
|
|
146
|
+
* neither price x size nor a frame's quote amount (a contract-multiplied figure on Binance and OKX coin
|
|
147
|
+
* books before that rule) is the notional there. Live prints only: a history row (the gateway's raw
|
|
148
|
+
* TRADE, stored units) never floors here. */
|
|
149
|
+
export declare function tradePrintNotional(print: Pick<LiveTradePrint, 'price' | 'size' | 'quoteAmount'>, optionUnits?: OptionTradeUnits | null): number;
|
|
150
|
+
/** A CME Group market's product root: the normalized symbol's first field (the gateway normalizer
|
|
151
|
+
* builds `<root>-USD`), else the raw symbol's root (`6AZ6` is 6A, the continuous `ES1!` is ES, a
|
|
152
|
+
* bare root is itself); undefined without either. */
|
|
153
|
+
export declare function tradesCmeProductRoot(market: TradesLargeMarket): string | undefined;
|
|
154
|
+
/** The large-print table's floor on a market, the writer's rule: on a CME Group venue (the session
|
|
155
|
+
* lattice venues) the product root's contracts floor, null for a root the list lacks (the writer
|
|
156
|
+
* skips it); elsewhere the notional floor on a market quoted in dollars, null on any other quote
|
|
157
|
+
* (KRW, a coin): the table holds none of its prints. */
|
|
158
|
+
export declare function tradesLargeFloorOfMarket(market: TradesLargeMarket): TradesLargeFloor | null;
|
|
159
|
+
/** The tape lane an acquisition rides on a market: the large lane (the table's retention, the
|
|
160
|
+
* gateway's bar limit, the declared history) when it asks `large` and the large-print table holds
|
|
161
|
+
* the market, else the raw tape (a two-hour seed inside the raw table's retention). On a CME Group
|
|
162
|
+
* venue a product root the writer lists no floor for is never copied, so a large acquisition on it
|
|
163
|
+
* reads the raw tape in place of an empty table and its live prints fold unfloored, the same rows
|
|
164
|
+
* either way, until the server lists the root. A market quoted outside dollars keeps the table
|
|
165
|
+
* (the control cannot tell its quote: the table answers it empty, by its own rule). */
|
|
166
|
+
export declare function tradesLaneLimits(large: boolean, market?: TradesLargeMarket): TradesLaneLimits;
|
|
167
|
+
/** Whether a history re-ask on a large acquisition answers a market's prints (the tape reconcile
|
|
168
|
+
* restoring what the queue cap dropped): the table on a market it holds, the raw tape on a CME
|
|
169
|
+
* Group root it skips; never a market quoted outside dollars. A market naming no normalized symbol
|
|
170
|
+
* is assumed held. */
|
|
171
|
+
export declare function tradesLargeHistoryAnswers(market: TradesLargeMarket): boolean;
|
|
172
|
+
/** True for a live print the large-print table never holds on a market it floors: a dollar-quoted
|
|
173
|
+
* print whose notional is under TRADES_LARGE_MIN_QUOTE_AMOUNT (the gateway copies a print whose
|
|
174
|
+
* quote amount reaches the floor), a CME Group print of fewer contracts than its root's floor (the
|
|
175
|
+
* frame's quote amount is price x contracts, no point value, so it never counts there). On an option
|
|
176
|
+
* book (`market.optionUnits`) the notional is the premium the resolver reads (`tradePrintNotional`),
|
|
177
|
+
* and a print it cannot price is under the floor. The print's
|
|
178
|
+
* envelope names the market, else `market`. A market the table never holds is never floored here:
|
|
179
|
+
* its lane reads the raw tape (a CME root without a floor) or the table answers it empty (a KRW or
|
|
180
|
+
* coin quote), and in both the live prints fold. */
|
|
181
|
+
export declare function tradesBelowLargeFloor(print: LiveTradePrint, market?: TradesLargeMarket): boolean;
|
|
182
|
+
/** Fold one raw TRADE point onto the tape rows: the NEW rows array (the touched row a new array,
|
|
183
|
+
* every other row shared by reference), or null when the point is rejected (the caller keeps
|
|
184
|
+
* its rows). */
|
|
185
|
+
export declare function mergeLiveTradesDataPoint(lastDataPoint: ReadonlyArray<ArrayLike<unknown>>, newPoint: unknown, intervalMs: number, options?: LiveTradesMergeOptions): LiveTradesRow[] | null;
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
// K_TRADES's tape rules, shared by the lane's three readers: a pure leaf like
|
|
2
|
+
// live-ohlcv-merge.util.ts, store-free and worker-safe. The history worker
|
|
3
|
+
// (k-trades.worker.ts), the control's live fold (k-trades.control.ts) and the
|
|
4
|
+
// wrun live intake's `tape` lane all key a print on the same chart bar, open a
|
|
5
|
+
// seeded history ask on the same bar and fold live prints by the same rules,
|
|
6
|
+
// so the lanes can never drift.
|
|
7
|
+
//
|
|
8
|
+
// The fold's rules, in order: a print needs a BUY or SELL series side, a
|
|
9
|
+
// finite positive amount, a finite price and a wire timestamp; a print below
|
|
10
|
+
// the acquisition's `minSize` is rejected, and on the large lane a print the
|
|
11
|
+
// large-print table never holds (`tradesBelowLargeFloor`: a dollar-quoted
|
|
12
|
+
// market's print under the notional floor, a CME Group print under its
|
|
13
|
+
// product root's contracts floor); the print lands in the chart bar
|
|
14
|
+
// holding it (`tradesBarStartMs`); a delayed print for a bar older than the
|
|
15
|
+
// newest row never appends an out-of-order row; a live bar keeps its newest
|
|
16
|
+
// LIVE_MAX_CELLS_PER_BAR prints (the oldest are dropped and the caller is told
|
|
17
|
+
// through `onCapped`); the fold never mutates the rows or the cells it is
|
|
18
|
+
// handed (the touched row is a new array in a new container).
|
|
19
|
+
import { Intervals } from '../../constants/interval.constants.js';
|
|
20
|
+
import { barEndMs, barStartMs } from '../../utility/chart/calendar-interval.util.js';
|
|
21
|
+
import { cmeSessionBarEndMs, cmeSessionBarOpenMs, cmeSessionBucketMs, isCmeSessionLatticeExchange, isCmeSessionLatticeIntervalMs, } from '../../utility/chart/cme-session-bucket.util.js';
|
|
22
|
+
import { findMonday } from '../../workers/utils/time.worker.util.js';
|
|
23
|
+
import { liveOptionPrintPremium } from '../../utility/options/option-trade-units.util.js';
|
|
24
|
+
export const LIVE_MAX_CELLS_PER_BAR = 20_000;
|
|
25
|
+
/** The raw TRADE table's retention (about two days): a seeded history ask never reaches behind
|
|
26
|
+
* it (older windows answer nothing and cost the gateway a scan over cold chunks). */
|
|
27
|
+
export const TRADES_RETENTION_SEC = 2 * 24 * 3600;
|
|
28
|
+
/** The `trade_large` table's retention (tsdb-gateway: the prints of at least $10k quote on
|
|
29
|
+
* USD-quoted markets, copied from TRADE and kept 90 days): the large lane's horizon. */
|
|
30
|
+
export const TRADES_LARGE_RETENTION_SEC = 90 * 24 * 3600;
|
|
31
|
+
/** tsdb-gateway's bar limit on the large lane (validateKiyoPlusBar, kiyo_plus_validation.go): an
|
|
32
|
+
* unaggregated read (TRADE_LARGE included) is estimated at one point per minute, and a tier user's
|
|
33
|
+
* window opening before now minus the tier's default max_bar_limit (15,000 on every tier of ore
|
|
34
|
+
* and cme) is trimmed to it without a word. About 10.4 days: the lane's real history horizon. */
|
|
35
|
+
export const TRADES_LARGE_BAR_LIMIT_SEC = 15_000 * 60;
|
|
36
|
+
/** How far inside that horizon the large lane opens: the gateway reads its own clock when the ask
|
|
37
|
+
* lands, later than this one (the worker queue, the wire, a slow client clock), and a horizon that
|
|
38
|
+
* moved past the ask's first bar would cut that bar in two again. */
|
|
39
|
+
const TRADES_LARGE_BAR_LIMIT_MARGIN_SEC = 600;
|
|
40
|
+
/** tsdb-gateway's trade_large floor (`write.large_trade_min_quote_amount`, default 10,000): a print
|
|
41
|
+
* is copied into the table when its quote amount reaches it. */
|
|
42
|
+
export const TRADES_LARGE_MIN_QUOTE_AMOUNT = 10_000;
|
|
43
|
+
/** The quote assets whose quote amount is dollars (the gateway writer's `peggedUSDQuotes`): only the
|
|
44
|
+
* prints of a market quoted in one of these are copied into trade_large, every other quote never. */
|
|
45
|
+
const TRADES_LARGE_USD_QUOTES = new Set([
|
|
46
|
+
'USD',
|
|
47
|
+
'USDT',
|
|
48
|
+
'USDC',
|
|
49
|
+
'FDUSD',
|
|
50
|
+
'GUSD',
|
|
51
|
+
'USDH',
|
|
52
|
+
'USD1',
|
|
53
|
+
'USDE',
|
|
54
|
+
'USDT0',
|
|
55
|
+
'DAI',
|
|
56
|
+
'TUSD',
|
|
57
|
+
'RLUSD',
|
|
58
|
+
]);
|
|
59
|
+
/** tsdb-gateway's trade_large floors on the CME Group venues (`write.large_trade_cme_contract_floors`
|
|
60
|
+
* in charts/tsdb-gateway/values.cme.yaml since !2239, 2026-10-14, which replaces the writer's code
|
|
61
|
+
* defaults wholesale): contracts per product root, the copy's quote amount priced with the root's
|
|
62
|
+
* point value. A root the list lacks is never copied: the writer skips it, and its large acquisition
|
|
63
|
+
* reads the raw tape's two hours instead (tradesLaneLimits). So a root the server floors and this
|
|
64
|
+
* map lacks draws two hours where the table holds days (Discord #557-saturn: 6E after !2239). A copy
|
|
65
|
+
* of the server's list until the floor rides the symbol metadata the chart already loads; then this
|
|
66
|
+
* map goes. Until then it changes in the same round as the values file. */
|
|
67
|
+
export const TRADES_LARGE_CME_CONTRACT_FLOORS = {
|
|
68
|
+
// Equity index
|
|
69
|
+
ES: 10,
|
|
70
|
+
NQ: 5,
|
|
71
|
+
YM: 10,
|
|
72
|
+
RTY: 10,
|
|
73
|
+
MES: 50,
|
|
74
|
+
MNQ: 50,
|
|
75
|
+
// Energy and metals
|
|
76
|
+
CL: 20,
|
|
77
|
+
NG: 20,
|
|
78
|
+
GC: 10,
|
|
79
|
+
SI: 5,
|
|
80
|
+
HG: 5,
|
|
81
|
+
// FX
|
|
82
|
+
'6A': 10,
|
|
83
|
+
'6B': 10,
|
|
84
|
+
'6C': 10,
|
|
85
|
+
'6E': 10,
|
|
86
|
+
'6J': 10,
|
|
87
|
+
'6S': 10,
|
|
88
|
+
'6N': 10,
|
|
89
|
+
'6M': 10,
|
|
90
|
+
// Rates
|
|
91
|
+
ZN: 50,
|
|
92
|
+
ZF: 50,
|
|
93
|
+
ZT: 50,
|
|
94
|
+
TN: 25,
|
|
95
|
+
ZB: 25,
|
|
96
|
+
UB: 20,
|
|
97
|
+
// Grains
|
|
98
|
+
ZC: 50,
|
|
99
|
+
ZS: 25,
|
|
100
|
+
ZM: 25,
|
|
101
|
+
ZL: 25,
|
|
102
|
+
ZW: 25,
|
|
103
|
+
// Crypto
|
|
104
|
+
BTC: 5,
|
|
105
|
+
MBT: 50,
|
|
106
|
+
ETH: 10,
|
|
107
|
+
};
|
|
108
|
+
/** A raw-tape acquisition's seed cap: a longer window over the raw TRADE table costs the gateway a
|
|
109
|
+
* scan over cold chunks (measured 18-30 s, or a server-side internal error, for ten days). */
|
|
110
|
+
export const TRADES_MAX_HISTORY_SEC = 2 * 3600;
|
|
111
|
+
/** A CME Group contract code: the product root, a delivery month letter, one or two year digits. */
|
|
112
|
+
const CME_CONTRACT_CODE = /^([A-Z0-9]+?)[FGHJKMNQUVXZ]\d{1,2}$/;
|
|
113
|
+
/**
|
|
114
|
+
* The chart bar a print at `tsMs` lands in, keyed the way the chart's candles of that market are:
|
|
115
|
+
* the CME Group session lattice at 4h, 1d and 1w on a CME venue (the gateway's
|
|
116
|
+
* cmeSessionBucketExpression), else a week bar on its Monday (`findMonday`, the chart's week: the
|
|
117
|
+
* epoch week opens on a Thursday no weekly candle carries), else the UTC floor (the calendar
|
|
118
|
+
* boundary on a month-class bar).
|
|
119
|
+
*/
|
|
120
|
+
export function tradesBarStartMs(tsMs, intervalMs, exchange) {
|
|
121
|
+
if (isCmeSessionLatticeExchange(exchange) && isCmeSessionLatticeIntervalMs(intervalMs)) {
|
|
122
|
+
return cmeSessionBucketMs(tsMs, intervalMs) ?? barStartMs(tsMs, intervalMs);
|
|
123
|
+
}
|
|
124
|
+
return intervalMs === Intervals.WEEK ? findMonday(tsMs) : barStartMs(tsMs, intervalMs);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Where a seeded history ask opens: the open of the chart bar holding `nowMs - historySec`, so the
|
|
128
|
+
* seed covers whole bars and a bar is never bought from its middle (it would be replaced by its
|
|
129
|
+
* later prints on every poll). A CME session lattice bar opens where the lattice opens it (a daily
|
|
130
|
+
* bar at the prior 17:00 Chicago open, ahead of its 00:00Z label); every other bar on
|
|
131
|
+
* `tradesBarStartMs` (a Monday on a week chart). Without a history the live edge itself.
|
|
132
|
+
*/
|
|
133
|
+
export function tradesSeedStartMs(nowMs, historySec, intervalMs, exchange) {
|
|
134
|
+
const seedMs = nowMs - historySec * 1000;
|
|
135
|
+
if (!(historySec > 0) || !Number.isFinite(intervalMs) || intervalMs <= 0)
|
|
136
|
+
return seedMs;
|
|
137
|
+
if (isCmeSessionLatticeExchange(exchange) && isCmeSessionLatticeIntervalMs(intervalMs)) {
|
|
138
|
+
return cmeSessionBarOpenMs(seedMs, intervalMs) ?? barStartMs(seedMs, intervalMs);
|
|
139
|
+
}
|
|
140
|
+
return tradesBarStartMs(seedMs, intervalMs, exchange);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The instant the chart bar holding `tsMs` opens: on a CME Group venue the session lattice's open
|
|
144
|
+
* (a daily-class bar opens at the 17:00 Chicago open before its 00:00Z trade-date label,
|
|
145
|
+
* `cmeSessionBarOpenMs`), else the bar's own key (`tradesBarStartMs`: off the lattice a bar is keyed
|
|
146
|
+
* at its open).
|
|
147
|
+
*/
|
|
148
|
+
export function tradesBarOpenMs(tsMs, intervalMs, exchange) {
|
|
149
|
+
if (!Number.isFinite(intervalMs) || intervalMs <= 0)
|
|
150
|
+
return tsMs;
|
|
151
|
+
if (isCmeSessionLatticeExchange(exchange) && isCmeSessionLatticeIntervalMs(intervalMs)) {
|
|
152
|
+
return cmeSessionBarOpenMs(tsMs, intervalMs) ?? barStartMs(tsMs, intervalMs);
|
|
153
|
+
}
|
|
154
|
+
return tradesBarStartMs(tsMs, intervalMs, exchange);
|
|
155
|
+
}
|
|
156
|
+
/** The open of the first chart bar opening at or after `tsMs`: the bar holding it when it opens
|
|
157
|
+
* right there, else the bar after it (the lattice's next session bar, the next calendar or fixed
|
|
158
|
+
* bar), so an ask that may not reach behind `tsMs` still covers whole bars only. */
|
|
159
|
+
export function tradesFirstBarOpenFromMs(tsMs, intervalMs, exchange) {
|
|
160
|
+
const open = tradesBarOpenMs(tsMs, intervalMs, exchange);
|
|
161
|
+
if (open >= tsMs || !Number.isFinite(intervalMs) || intervalMs <= 0)
|
|
162
|
+
return open;
|
|
163
|
+
if (isCmeSessionLatticeExchange(exchange) && isCmeSessionLatticeIntervalMs(intervalMs)) {
|
|
164
|
+
const key = cmeSessionBucketMs(tsMs, intervalMs);
|
|
165
|
+
const end = key === null ? null : cmeSessionBarEndMs(key, intervalMs);
|
|
166
|
+
if (end !== null && end > tsMs)
|
|
167
|
+
return tradesBarOpenMs(end, intervalMs, exchange);
|
|
168
|
+
}
|
|
169
|
+
return barEndMs(tradesBarStartMs(tsMs, intervalMs, exchange), intervalMs);
|
|
170
|
+
}
|
|
171
|
+
/** Where a large-lane ask opens at the earliest: the first bar open at or after now minus the
|
|
172
|
+
* gateway's bar limit (TRADES_LARGE_BAR_LIMIT_SEC, kept a margin inside it), so the gateway never
|
|
173
|
+
* trims the window it was handed and the worker's grid opens where the answer does. */
|
|
174
|
+
export function tradesBarLimitStartMs(nowMs, barLimitSec, intervalMs, exchange) {
|
|
175
|
+
return tradesFirstBarOpenFromMs(nowMs - (barLimitSec - TRADES_LARGE_BAR_LIMIT_MARGIN_SEC) * 1000, intervalMs, exchange);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The first stamp a seeded history ask serves prints from, whichever of these is latest (K_TRADES's
|
|
179
|
+
* request builder honors them all): the open of the bar holding the ask's own window start (an ask
|
|
180
|
+
* never opens inside a bar: a CME daily-class bar's key runs ahead of its open), the seed start
|
|
181
|
+
* (`tradesSeedStartMs`), the table's retention horizon, and on the large lane the gateway's bar
|
|
182
|
+
* limit (`barLimitSec`, `tradesBarLimitStartMs`). A reader of the answer (the wrun reconcile) tells
|
|
183
|
+
* a PARTIAL first bucket, one that opened before this stamp, from a bucket served whole.
|
|
184
|
+
*/
|
|
185
|
+
export function tradesServedStartMs(nowMs, historySec, intervalMs, options = {}) {
|
|
186
|
+
return Math.max(options.windowFromMs === undefined
|
|
187
|
+
? Number.NEGATIVE_INFINITY
|
|
188
|
+
: tradesBarOpenMs(options.windowFromMs, intervalMs, options.exchange), tradesSeedStartMs(nowMs, historySec, intervalMs, options.exchange), nowMs - (options.retentionSec ?? TRADES_RETENTION_SEC) * 1000, options.barLimitSec === undefined
|
|
189
|
+
? Number.NEGATIVE_INFINITY
|
|
190
|
+
: tradesBarLimitStartMs(nowMs, options.barLimitSec, intervalMs, options.exchange));
|
|
191
|
+
}
|
|
192
|
+
/** One raw TRADE point read the way the fold reads it: the print's stamp in ms, its price, size,
|
|
193
|
+
* signed side and envelope exchange; null for a point the fold rejects (no side, a non-positive
|
|
194
|
+
* or non-finite size, a bad price or stamp). */
|
|
195
|
+
export function readLiveTradePrint(newPoint) {
|
|
196
|
+
if (!newPoint || typeof newPoint !== 'object')
|
|
197
|
+
return null;
|
|
198
|
+
const point = newPoint;
|
|
199
|
+
const trade = point.trade;
|
|
200
|
+
const side = point.series?.side === 'BUY' ? 1 : point.series?.side === 'SELL' ? -1 : 0;
|
|
201
|
+
const size = Number(trade?.amount);
|
|
202
|
+
const price = Number(trade?.price);
|
|
203
|
+
const seconds = Number(trade?.timestamp?.seconds);
|
|
204
|
+
if (!side || !Number.isFinite(size) || size <= 0 || !Number.isFinite(price) || !Number.isFinite(seconds)) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
const nanos = Number(trade?.timestamp?.nanoseconds ?? trade?.timestamp?.nanos ?? 0);
|
|
208
|
+
const tsMs = seconds * 1000 + (Number.isFinite(nanos) ? Math.round(nanos / 1e6) : 0);
|
|
209
|
+
if (!Number.isFinite(tsMs))
|
|
210
|
+
return null;
|
|
211
|
+
const exchange = point.series?.exchange;
|
|
212
|
+
const normalizedSymbol = point.series?.normalizedSymbol;
|
|
213
|
+
const quoteAmount = Number(trade?.quoteAmount);
|
|
214
|
+
return {
|
|
215
|
+
tsMs,
|
|
216
|
+
price,
|
|
217
|
+
size,
|
|
218
|
+
side,
|
|
219
|
+
...(typeof exchange === 'string' ? { exchange } : {}),
|
|
220
|
+
...(Number.isFinite(quoteAmount) && quoteAmount > 0 ? { quoteAmount } : {}),
|
|
221
|
+
...(typeof normalizedSymbol === 'string' && normalizedSymbol !== '' ? { normalizedSymbol } : {}),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/** Whether the large-print table floors a market's prints by notional: its normalized symbol's
|
|
225
|
+
* quote (the second field, the gateway writer's `quoteAsset`: `BTC-USDT` quotes USDT) is USD or a
|
|
226
|
+
* dollar stablecoin. Any other quote (KRW, a coin) is never copied: the table holds none of its
|
|
227
|
+
* prints at all. */
|
|
228
|
+
export function tradesLargeQuotedInDollars(normalizedSymbol) {
|
|
229
|
+
if (typeof normalizedSymbol !== 'string')
|
|
230
|
+
return false;
|
|
231
|
+
const quote = normalizedSymbol.split('-')[1];
|
|
232
|
+
return quote !== undefined && TRADES_LARGE_USD_QUOTES.has(quote);
|
|
233
|
+
}
|
|
234
|
+
/** A live print's notional: its quote amount when the frame carries one, else price x size. On an option
|
|
235
|
+
* book (`optionUnits`) the premium in the book's own currency by the resolver's live-print rule
|
|
236
|
+
* (option-trade-units.util `liveOptionPrintPremium`): a live print's size arrives in coin, live-feed having
|
|
237
|
+
* applied the contract multiplier, so the premium is price x size x point value / multiplier on a USD book
|
|
238
|
+
* and price x size on a coin book, the value the writer's floor reads once quote amounts follow the same
|
|
239
|
+
* rule; NaN when the units cannot say, which never reaches a floor. An option price is a premium, so
|
|
240
|
+
* neither price x size nor a frame's quote amount (a contract-multiplied figure on Binance and OKX coin
|
|
241
|
+
* books before that rule) is the notional there. Live prints only: a history row (the gateway's raw
|
|
242
|
+
* TRADE, stored units) never floors here. */
|
|
243
|
+
export function tradePrintNotional(print, optionUnits) {
|
|
244
|
+
if (optionUnits)
|
|
245
|
+
return liveOptionPrintPremium(print.price, print.size, optionUnits) ?? Number.NaN;
|
|
246
|
+
return print.quoteAmount ?? print.price * print.size;
|
|
247
|
+
}
|
|
248
|
+
/** A CME Group market's product root: the normalized symbol's first field (the gateway normalizer
|
|
249
|
+
* builds `<root>-USD`), else the raw symbol's root (`6AZ6` is 6A, the continuous `ES1!` is ES, a
|
|
250
|
+
* bare root is itself); undefined without either. */
|
|
251
|
+
export function tradesCmeProductRoot(market) {
|
|
252
|
+
if (typeof market.normalizedSymbol === 'string' && market.normalizedSymbol.includes('-')) {
|
|
253
|
+
const root = market.normalizedSymbol.split('-')[0];
|
|
254
|
+
if (root)
|
|
255
|
+
return root;
|
|
256
|
+
}
|
|
257
|
+
const symbol = typeof market.symbol === 'string' ? market.symbol.trim().toUpperCase() : '';
|
|
258
|
+
if (!symbol)
|
|
259
|
+
return undefined;
|
|
260
|
+
if (symbol.endsWith('1!'))
|
|
261
|
+
return symbol.slice(0, -2) || undefined;
|
|
262
|
+
return CME_CONTRACT_CODE.exec(symbol)?.[1] ?? symbol;
|
|
263
|
+
}
|
|
264
|
+
/** The large-print table's floor on a market, the writer's rule: on a CME Group venue (the session
|
|
265
|
+
* lattice venues) the product root's contracts floor, null for a root the list lacks (the writer
|
|
266
|
+
* skips it); elsewhere the notional floor on a market quoted in dollars, null on any other quote
|
|
267
|
+
* (KRW, a coin): the table holds none of its prints. */
|
|
268
|
+
export function tradesLargeFloorOfMarket(market) {
|
|
269
|
+
if (isCmeSessionLatticeExchange(market.exchange)) {
|
|
270
|
+
const root = tradesCmeProductRoot(market);
|
|
271
|
+
const min = root === undefined ? undefined : TRADES_LARGE_CME_CONTRACT_FLOORS[root];
|
|
272
|
+
return min === undefined ? null : { kind: 'contracts', min };
|
|
273
|
+
}
|
|
274
|
+
return tradesLargeQuotedInDollars(market.normalizedSymbol)
|
|
275
|
+
? { kind: 'notional', min: TRADES_LARGE_MIN_QUOTE_AMOUNT }
|
|
276
|
+
: null;
|
|
277
|
+
}
|
|
278
|
+
/** The tape lane an acquisition rides on a market: the large lane (the table's retention, the
|
|
279
|
+
* gateway's bar limit, the declared history) when it asks `large` and the large-print table holds
|
|
280
|
+
* the market, else the raw tape (a two-hour seed inside the raw table's retention). On a CME Group
|
|
281
|
+
* venue a product root the writer lists no floor for is never copied, so a large acquisition on it
|
|
282
|
+
* reads the raw tape in place of an empty table and its live prints fold unfloored, the same rows
|
|
283
|
+
* either way, until the server lists the root. A market quoted outside dollars keeps the table
|
|
284
|
+
* (the control cannot tell its quote: the table answers it empty, by its own rule). */
|
|
285
|
+
export function tradesLaneLimits(large, market = {}) {
|
|
286
|
+
const readsLargeTable = large && (!isCmeSessionLatticeExchange(market.exchange) || tradesLargeFloorOfMarket(market) !== null);
|
|
287
|
+
return readsLargeTable
|
|
288
|
+
? {
|
|
289
|
+
readsLargeTable,
|
|
290
|
+
historyCapSec: TRADES_LARGE_RETENTION_SEC,
|
|
291
|
+
retentionSec: TRADES_LARGE_RETENTION_SEC,
|
|
292
|
+
barLimitSec: TRADES_LARGE_BAR_LIMIT_SEC,
|
|
293
|
+
}
|
|
294
|
+
: { readsLargeTable, historyCapSec: TRADES_MAX_HISTORY_SEC, retentionSec: TRADES_RETENTION_SEC };
|
|
295
|
+
}
|
|
296
|
+
/** Whether a history re-ask on a large acquisition answers a market's prints (the tape reconcile
|
|
297
|
+
* restoring what the queue cap dropped): the table on a market it holds, the raw tape on a CME
|
|
298
|
+
* Group root it skips; never a market quoted outside dollars. A market naming no normalized symbol
|
|
299
|
+
* is assumed held. */
|
|
300
|
+
export function tradesLargeHistoryAnswers(market) {
|
|
301
|
+
if (isCmeSessionLatticeExchange(market.exchange))
|
|
302
|
+
return true;
|
|
303
|
+
return market.normalizedSymbol === undefined || tradesLargeQuotedInDollars(market.normalizedSymbol);
|
|
304
|
+
}
|
|
305
|
+
/** True for a live print the large-print table never holds on a market it floors: a dollar-quoted
|
|
306
|
+
* print whose notional is under TRADES_LARGE_MIN_QUOTE_AMOUNT (the gateway copies a print whose
|
|
307
|
+
* quote amount reaches the floor), a CME Group print of fewer contracts than its root's floor (the
|
|
308
|
+
* frame's quote amount is price x contracts, no point value, so it never counts there). On an option
|
|
309
|
+
* book (`market.optionUnits`) the notional is the premium the resolver reads (`tradePrintNotional`),
|
|
310
|
+
* and a print it cannot price is under the floor. The print's
|
|
311
|
+
* envelope names the market, else `market`. A market the table never holds is never floored here:
|
|
312
|
+
* its lane reads the raw tape (a CME root without a floor) or the table answers it empty (a KRW or
|
|
313
|
+
* coin quote), and in both the live prints fold. */
|
|
314
|
+
export function tradesBelowLargeFloor(print, market) {
|
|
315
|
+
const floor = tradesLargeFloorOfMarket({
|
|
316
|
+
exchange: print.exchange ?? market?.exchange,
|
|
317
|
+
normalizedSymbol: print.normalizedSymbol ?? market?.normalizedSymbol,
|
|
318
|
+
symbol: market?.symbol,
|
|
319
|
+
});
|
|
320
|
+
if (floor === null)
|
|
321
|
+
return false;
|
|
322
|
+
if (floor.kind === 'contracts')
|
|
323
|
+
return print.size < floor.min;
|
|
324
|
+
return !(tradePrintNotional(print, market?.optionUnits) >= floor.min);
|
|
325
|
+
}
|
|
326
|
+
/** Fold one raw TRADE point onto the tape rows: the NEW rows array (the touched row a new array,
|
|
327
|
+
* every other row shared by reference), or null when the point is rejected (the caller keeps
|
|
328
|
+
* its rows). */
|
|
329
|
+
export function mergeLiveTradesDataPoint(lastDataPoint, newPoint, intervalMs, options = {}) {
|
|
330
|
+
if (!Number.isFinite(intervalMs) || intervalMs <= 0)
|
|
331
|
+
return null;
|
|
332
|
+
const print = readLiveTradePrint(newPoint);
|
|
333
|
+
if (print === null)
|
|
334
|
+
return null;
|
|
335
|
+
const minSize = Number(options.minSize);
|
|
336
|
+
if (Number.isFinite(minSize) && minSize > 0 && print.size < minSize)
|
|
337
|
+
return null;
|
|
338
|
+
if (options.largeFloor !== undefined && tradesBelowLargeFloor(print, options.largeFloor))
|
|
339
|
+
return null;
|
|
340
|
+
const barTs = tradesBarStartMs(print.tsMs, intervalMs, print.exchange);
|
|
341
|
+
const rows = lastDataPoint;
|
|
342
|
+
const last = rows.length > 0 ? rows[rows.length - 1] : undefined;
|
|
343
|
+
// A delayed closed-bar print must not append an out-of-order row.
|
|
344
|
+
if (last && last[0] > barTs)
|
|
345
|
+
return null;
|
|
346
|
+
const cell = [print.tsMs - barTs, print.price, print.size, print.side];
|
|
347
|
+
if (!last || last[0] !== barTs)
|
|
348
|
+
return [...rows, [barTs, cell]];
|
|
349
|
+
// Live folds receive a shallow snapshot copy: never mutate its shared row
|
|
350
|
+
// or cells, or a sibling variant's re-fold would count a print twice.
|
|
351
|
+
const row = [...last, cell];
|
|
352
|
+
if (row.length - 1 > LIVE_MAX_CELLS_PER_BAR) {
|
|
353
|
+
row.splice(1, row.length - 1 - LIVE_MAX_CELLS_PER_BAR);
|
|
354
|
+
options.onCapped?.(LIVE_MAX_CELLS_PER_BAR);
|
|
355
|
+
}
|
|
356
|
+
return [...rows.slice(0, -1), row];
|
|
357
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DeclaredFieldRow } from './indicator-fields.js';
|
|
2
|
+
/**
|
|
3
|
+
* The Fixed Range Volume Profile field table (moved from web src/utility/chart/frvp-fields.util.ts, content
|
|
4
|
+
* unchanged): every key an FRVP holds, the object that owns it, and the lanes it is saved in. One table, so no list of
|
|
5
|
+
* FRVP keys is written by hand anywhere else: the box's copy of its profile, the template and the saved defaults all
|
|
6
|
+
* derive from it (fieldSpecs('tool', FRVP_TOOL_TYPE)).
|
|
7
|
+
*
|
|
8
|
+
* An FRVP is two objects. The range box is a drawing (the tools endpoint saves it); its companion profile overlay
|
|
9
|
+
* `FIXED_RANGE_VOLUME_PROFILE_<toolId>` is a workspace row. The companion pushes a copy of its settings onto the box
|
|
10
|
+
* with every commit (the control's postDataRetrieval), and every profile that is rebuilt from its box mounts that
|
|
11
|
+
* copy: a symbol switch and back (the swap clears the box, which removes the companion, and the restore heal attaches
|
|
12
|
+
* a new one), a paste, a Drawings-sync member, a pair split. A per-box choice the copy does not carry comes back at its
|
|
13
|
+
* default: before 2026-10-17 the copy was a hand-kept list without Follow Chart, session hours and the row layout,
|
|
14
|
+
* and a symbol round trip turned Follow Chart off.
|
|
15
|
+
*
|
|
16
|
+
* The lanes of an FRVP key:
|
|
17
|
+
* - `row`: the companion's workspace row (the workspace save keeps it).
|
|
18
|
+
* - `mirror`: the box's copy of its companion, so a profile rebuilt from the box mounts it.
|
|
19
|
+
* - `template`: a named FRVP template (a drawing template: the box's style and Show on, the profile's preferences).
|
|
20
|
+
* - `default`: the saved FRVP defaults the next FRVP starts from (Save as default, every profile save).
|
|
21
|
+
*
|
|
22
|
+
* Generic drawing keys every tool has (`isLocked`, `isHidden`, ...) are not FRVP fields and are not listed. Imports
|
|
23
|
+
* nothing at run time: the tool tables' generator reads this table at package build.
|
|
24
|
+
*/
|
|
25
|
+
/** The FRVP's drawing type (chart-schema TOOLS), the key its templates are filed under. */
|
|
26
|
+
export declare const FRVP_TOOL_TYPE = "FixedRangeVolumeProfile";
|
|
27
|
+
export declare const FRVP_FIELD_ROWS: readonly DeclaredFieldRow[];
|