@orangecharts/wrun-chart-host 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -6
- package/dist/constants/common.constants.d.ts +15 -0
- package/dist/constants/common.constants.js +23 -0
- package/dist/constants/data-source.constants.d.ts +1 -0
- package/dist/constants/data-source.constants.js +1 -0
- package/dist/constants/economic.constants.d.ts +39 -0
- package/dist/constants/economic.constants.js +77 -0
- package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
- package/dist/constants/etf-covered-coins.constants.js +9 -0
- package/dist/constants/feature-flags.constants.d.ts +60 -0
- package/dist/constants/feature-flags.constants.js +308 -0
- package/dist/constants/feature-limits.constants.d.ts +134 -0
- package/dist/constants/feature-limits.constants.js +155 -0
- package/dist/constants/marketCapabilities.constants.d.ts +87 -0
- package/dist/constants/marketCapabilities.constants.js +213 -0
- package/dist/constants/option-venues.constants.d.ts +100 -0
- package/dist/constants/option-venues.constants.js +167 -0
- package/dist/constants/overlay-data.constants.d.ts +53 -0
- package/dist/constants/overlay-data.constants.js +80 -0
- package/dist/constants/pane-grid.constants.d.ts +15 -0
- package/dist/constants/pane-grid.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +10 -0
- package/dist/constants/venue-presets.constants.js +22 -0
- package/dist/enums/chart.enum.d.ts +68 -0
- package/dist/enums/chart.enum.js +70 -0
- package/dist/helpers/data.helpers.d.ts +2 -0
- package/dist/helpers/data.helpers.js +14 -0
- package/dist/host-env.d.ts +161 -5
- package/dist/host-ports.types.d.ts +446 -0
- package/dist/host-ports.types.js +1 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +131 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
- package/dist/interfaces/asset-venue.interface.d.ts +91 -0
- package/dist/interfaces/asset-venue.interface.js +1 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
- package/dist/interfaces/cancel-reason.interface.js +2 -0
- package/dist/interfaces/catalog-display.interface.d.ts +3 -0
- package/dist/interfaces/catalog-display.interface.js +1 -0
- package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
- package/dist/interfaces/cme-realtime.interface.js +46 -0
- package/dist/interfaces/feed.interface.d.ts +80 -0
- package/dist/interfaces/feed.interface.js +7 -0
- package/dist/interfaces/market-kind.interface.d.ts +8 -0
- package/dist/interfaces/market-kind.interface.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
- package/dist/interfaces/opra-realtime.interface.js +105 -0
- package/dist/interfaces/option-instrument.interface.d.ts +32 -0
- package/dist/interfaces/option-instrument.interface.js +1 -0
- package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
- package/dist/interfaces/options-chain-scope.interface.js +7 -0
- package/dist/interfaces/prediction-market.interface.d.ts +88 -0
- package/dist/interfaces/prediction-market.interface.js +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
- package/dist/settings-templates/frvp-fields.d.ts +27 -0
- package/dist/settings-templates/frvp-fields.js +108 -0
- package/dist/settings-templates/index.d.ts +119 -0
- package/dist/settings-templates/index.js +442 -0
- package/dist/settings-templates/indicator-fields.d.ts +56 -0
- package/dist/settings-templates/indicator-fields.js +793 -0
- package/dist/settings-templates/tool-rules.d.ts +59 -0
- package/dist/settings-templates/tool-rules.js +49 -0
- package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
- package/dist/settings-templates/tool-tables.generated.js +1668 -0
- package/dist/utility/blk-market.util.d.ts +5 -0
- package/dist/utility/blk-market.util.js +12 -0
- package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
- package/dist/utility/chart/chart-load-phase.util.js +78 -0
- package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
- package/dist/utility/chart/cme-cache-context.util.js +166 -0
- package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
- package/dist/utility/chart/cme-session-bucket.util.js +343 -0
- package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
- package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
- package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
- package/dist/utility/chart/continuous-contracts.util.js +374 -0
- package/dist/utility/chart/feed-interval.util.d.ts +119 -0
- package/dist/utility/chart/feed-interval.util.js +321 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
- package/dist/utility/chart/footprint-band.util.d.ts +76 -0
- package/dist/utility/chart/footprint-band.util.js +205 -0
- package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
- package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
- package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
- package/dist/utility/chart/formula-calendar.util.js +59 -0
- package/dist/utility/chart/history-wall.util.d.ts +67 -0
- package/dist/utility/chart/history-wall.util.js +87 -0
- package/dist/utility/chart/index-mode.util.d.ts +66 -0
- package/dist/utility/chart/index-mode.util.js +360 -0
- package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
- package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
- package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
- package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
- package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
- package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
- package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
- package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
- package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
- package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
- package/dist/utility/chart/interval-registry.util.d.ts +23 -0
- package/dist/utility/chart/interval-registry.util.js +83 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
- package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
- package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
- package/dist/utility/chart/live-bucket.util.d.ts +66 -0
- package/dist/utility/chart/live-bucket.util.js +165 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
- package/dist/utility/chart/market-session-schedule.util.js +337 -0
- package/dist/utility/chart/marketKind.util.d.ts +181 -0
- package/dist/utility/chart/marketKind.util.js +371 -0
- package/dist/utility/chart/om-panel.util.js +6 -0
- package/dist/utility/chart/om-widget.util.d.ts +4 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
- package/dist/utility/chart/opra-read-access.leaf.js +25 -0
- package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
- package/dist/utility/chart/prediction-identity.util.js +236 -0
- package/dist/utility/chart/rth-session.util.d.ts +352 -0
- package/dist/utility/chart/rth-session.util.js +926 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
- package/dist/utility/chart/titan-constants.pin.js +50 -0
- package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
- package/dist/utility/chart/us-equities-session.util.js +251 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
- package/dist/utility/chart/wrun-run-result.util.js +10 -0
- package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
- package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
- package/dist/utility/common/safe-math-eval.d.ts +18 -0
- package/dist/utility/common/safe-math-eval.js +160 -0
- package/dist/utility/common/time.util.d.ts +134 -0
- package/dist/utility/common/time.util.js +428 -0
- package/dist/utility/common/transformations.util.d.ts +126 -0
- package/dist/utility/common/transformations.util.js +711 -0
- package/dist/utility/common/visible-timeout.util.d.ts +17 -0
- package/dist/utility/common/visible-timeout.util.js +75 -0
- package/dist/utility/exchange-normalization.util.d.ts +8 -0
- package/dist/utility/exchange-normalization.util.js +32 -0
- package/dist/utility/intl-locale.util.d.ts +2 -0
- package/dist/utility/intl-locale.util.js +28 -0
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +50 -19
- package/dist/utility/options/option-symbol.util.d.ts +28 -0
- package/dist/utility/options/option-symbol.util.js +176 -0
- package/dist/utility/options/option-trade-units.util.d.ts +190 -0
- package/dist/utility/options/option-trade-units.util.js +283 -0
- package/dist/utility/options/option-venue.util.d.ts +75 -0
- package/dist/utility/options/option-venue.util.js +85 -0
- package/dist/utility/pool-symbol.leaf.d.ts +34 -0
- package/dist/utility/pool-symbol.leaf.js +95 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
- package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
- package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
- package/dist/utility/v2/gate-plane.util.d.ts +58 -0
- package/dist/utility/v2/gate-plane.util.js +99 -0
- package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
- package/dist/utility/v2/gate-session-latch.util.js +34 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
- package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
- package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/economic.js +79 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
- package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/lanes/index.js +32 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
- package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
- package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
- package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
- package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
- package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
- package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
- package/dist/utility/wrun/sources/lanes/series.js +321 -0
- package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
- package/dist/utility/wrun/sources/registry.d.ts +21 -0
- package/dist/utility/wrun/sources/registry.js +207 -0
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
- package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
- package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
- package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +1 -1
- package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
- package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
- package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-deadline.util.js +82 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
- package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
- package/dist/utility/wrun/wrun-failure-cause.d.ts +39 -0
- package/dist/utility/wrun/wrun-failure-cause.js +94 -0
- package/dist/utility/wrun/wrun-frames.d.ts +28 -3
- package/dist/utility/wrun/wrun-frames.js +132 -52
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +167 -4
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +47 -2
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +5 -2
- package/dist/utility/wrun/wrun-hosted-wire.util.js +4 -2
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
- package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
- package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
- package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
- package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +30 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
- package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
- package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
- package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
- package/dist/utility/wrun/wrun-pack.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-pack.util.js +13 -3
- package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
- package/dist/utility/wrun/wrun-param-map.util.js +581 -0
- package/dist/utility/wrun/wrun-param-values.util.d.ts +8 -0
- package/dist/utility/wrun/wrun-param-values.util.js +8 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +95 -7
- package/dist/utility/wrun/wrun-refusal.util.js +314 -18
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
- package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
- package/dist/utility/wrun/wrun-render-select.util.js +1 -0
- package/dist/utility/wrun/wrun-row-market.util.d.ts +29 -0
- package/dist/utility/wrun/wrun-row-market.util.js +92 -0
- package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
- package/dist/utility/wrun/wrun-row-source.js +75 -0
- package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
- package/dist/utility/wrun/wrun-run-health.util.js +273 -0
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
- package/dist/utility/wrun/wrun-symbol-code.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-symbol-code.util.js +56 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
- package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
- package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
- package/dist/utility/wrun-display-name.util.d.ts +33 -0
- package/dist/utility/wrun-display-name.util.js +64 -0
- package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
- package/dist/workers/constants/kscript-transport-codes.js +15 -0
- package/dist/workers/constants/socket-slots.d.ts +574 -0
- package/dist/workers/constants/socket-slots.js +539 -0
- package/dist/workers/utils/number.worker.util.d.ts +5 -0
- package/dist/workers/utils/number.worker.util.js +10 -0
- package/dist/workers/utils/time.worker.util.d.ts +12 -0
- package/dist/workers/utils/time.worker.util.js +24 -0
- package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
- package/dist/workers/utils/volume-profile.worker.util.js +631 -0
- package/package.json +10 -4
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `ethena_positions` poll lane: Ethena's collateral in the chart's coin, summed over the
|
|
3
|
+
* venues it is held on, as served (`input("ethena", ethena_positions.collateral)`).
|
|
4
|
+
*
|
|
5
|
+
* Rides the `K_ETHENA_POSITIONS` control (`src/kscript-data/controls/k-ethena-positions.control.ts`
|
|
6
|
+
* and its worker twin). The control reads `settings.coin` and asks `ETHENA_COLLATERAL_INFO_AGG`
|
|
7
|
+
* once per venue leg of a fixed map (BTC: Binance, Deribit, Bybit, OKX; ETH: seven legs over the
|
|
8
|
+
* same venues, the staked and wrapped forms included), then emits `[ts, sum of collateral]` for
|
|
9
|
+
* every bar on which EVERY leg has a row. Rows are stamped at the chart's bar opens, so an input
|
|
10
|
+
* exact-joins its bar (`join: 'bar'`) under the `missing` policy. Units: the venue-summed
|
|
11
|
+
* collateral as the gateway serves it, not converted.
|
|
12
|
+
*
|
|
13
|
+
* The map lists BTC and ETH only: for any other coin the control builds an empty formula and the
|
|
14
|
+
* legacy worker used to return before creating its queue element, so the request never ended.
|
|
15
|
+
* The lane refuses such a chart by name BEFORE any fetch (the only place a lane refuses). No
|
|
16
|
+
* knobs: the lane reads the chart's own coin, so every input of the class shares one fetch.
|
|
17
|
+
*/
|
|
18
|
+
import { refuseWrunPollInput, wrunPollCoinGateSeed, } from '../wrun-poll-lane.types.js';
|
|
19
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.ethenaPositions`). */
|
|
20
|
+
const WRUN_ETHENA_POSITIONS_LANE_KEY = 'ethena_positions';
|
|
21
|
+
/** The coins the control maps venue legs for (`KEthenaPositionsControl.EXCHANGE_MAPPINGS`). */
|
|
22
|
+
export const WRUN_ETHENA_POSITIONS_COINS = Object.freeze(['BTC', 'ETH']);
|
|
23
|
+
/** The chart's coin as the control compares it: trimmed and upper-cased ('' when absent). */
|
|
24
|
+
function chartCoinWord(coin) {
|
|
25
|
+
return typeof coin === 'string' ? coin.trim().toUpperCase() : '';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Refuse by name unless the chart's coin is one Ethena holds collateral in (the coin gate's record:
|
|
29
|
+
* the lane, its coins, the chart's coin; the market words when the chart names no coin); answer
|
|
30
|
+
* the one payload field the control reads, as the placeholder the chart's fetch resolves to the
|
|
31
|
+
* chart's coin.
|
|
32
|
+
*/
|
|
33
|
+
export function planWrunEthenaPositionsInput(ctx) {
|
|
34
|
+
const coin = chartCoinWord(ctx.coin);
|
|
35
|
+
if (coin === '') {
|
|
36
|
+
return refuseWrunPollInput(ctx, `needs a BTC or ETH chart (Ethena holds collateral in those coins only), and this chart has no coin`, wrunPollCoinGateSeed(WRUN_ETHENA_POSITIONS_LANE_KEY, WRUN_ETHENA_POSITIONS_COINS, ''));
|
|
37
|
+
}
|
|
38
|
+
if (!WRUN_ETHENA_POSITIONS_COINS.includes(coin)) {
|
|
39
|
+
return refuseWrunPollInput(ctx, `needs a BTC or ETH chart (Ethena holds collateral in those coins only): this chart's coin is ${coin}`, wrunPollCoinGateSeed(WRUN_ETHENA_POSITIONS_LANE_KEY, WRUN_ETHENA_POSITIONS_COINS, coin));
|
|
40
|
+
}
|
|
41
|
+
return { coin: 'currentCoin' };
|
|
42
|
+
}
|
|
43
|
+
export const lane = {
|
|
44
|
+
sourceClass: 'ethena_positions',
|
|
45
|
+
laneKey: WRUN_ETHENA_POSITIONS_LANE_KEY,
|
|
46
|
+
kType: 'ethena_positions',
|
|
47
|
+
fields: { collateral: 1 },
|
|
48
|
+
plan: (_source, ctx) => planWrunEthenaPositionsInput(ctx),
|
|
49
|
+
join: 'bar',
|
|
50
|
+
label: 'Ethena positions',
|
|
51
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as lane_bitfinex_funding from './bitfinex_funding.js';
|
|
2
|
+
import * as lane_economic from './economic.js';
|
|
3
|
+
import * as lane_etf_holdings from './etf_holdings.js';
|
|
4
|
+
import * as lane_etf_premium from './etf_premium.js';
|
|
5
|
+
import * as lane_ethena_positions from './ethena_positions.js';
|
|
6
|
+
import * as lane_long_short_ratio from './long_short_ratio.js';
|
|
7
|
+
import * as lane_option_daily from './option_daily.js';
|
|
8
|
+
import * as lane_option_stats_10m from './option_stats_10m.js';
|
|
9
|
+
import * as lane_options_flow from './options_flow.js';
|
|
10
|
+
import * as lane_options_oi from './options_oi.js';
|
|
11
|
+
import * as lane_options_volume from './options_volume.js';
|
|
12
|
+
import * as lane_series from './series.js';
|
|
13
|
+
import * as lane_token_supply from './token_supply.js';
|
|
14
|
+
import * as lane_treasury_balance from './treasury_balance.js';
|
|
15
|
+
import * as lane_volatility_index from './volatility_index.js';
|
|
16
|
+
export const WRUN_POLL_LANE_MODULES = {
|
|
17
|
+
'./lanes/bitfinex_funding.ts': lane_bitfinex_funding,
|
|
18
|
+
'./lanes/economic.ts': lane_economic,
|
|
19
|
+
'./lanes/etf_holdings.ts': lane_etf_holdings,
|
|
20
|
+
'./lanes/etf_premium.ts': lane_etf_premium,
|
|
21
|
+
'./lanes/ethena_positions.ts': lane_ethena_positions,
|
|
22
|
+
'./lanes/long_short_ratio.ts': lane_long_short_ratio,
|
|
23
|
+
'./lanes/option_daily.ts': lane_option_daily,
|
|
24
|
+
'./lanes/option_stats_10m.ts': lane_option_stats_10m,
|
|
25
|
+
'./lanes/options_flow.ts': lane_options_flow,
|
|
26
|
+
'./lanes/options_oi.ts': lane_options_oi,
|
|
27
|
+
'./lanes/options_volume.ts': lane_options_volume,
|
|
28
|
+
'./lanes/series.ts': lane_series,
|
|
29
|
+
'./lanes/token_supply.ts': lane_token_supply,
|
|
30
|
+
'./lanes/treasury_balance.ts': lane_treasury_balance,
|
|
31
|
+
'./lanes/volatility_index.ts': lane_volatility_index,
|
|
32
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `long_short_ratio` poll lane: the chart market's long/short ratios off the chart's
|
|
3
|
+
* `K_LONG_SHORT_RATIO` control (`LONG_SHORT_RATIO_AGG` for `<exchange>|<symbol>`, built by the
|
|
4
|
+
* control from the `symbol` and `exchange` the host's placeholders resolve to), one row per chart
|
|
5
|
+
* bar: `[ts, total_account, top_trader_account, top_trader_position]`, plain ratios of longs over
|
|
6
|
+
* shorts (the worker already reads a ratio at or below 0 as NaN, which the row builder treats as
|
|
7
|
+
* no observation under `carry`).
|
|
8
|
+
*
|
|
9
|
+
* No knobs, the chart's own market, an exact join at the bar opens. The data exists on 5m and
|
|
10
|
+
* coarser charts only (the chart's fetch gate, `KSCRIPT_DATA_INTERVAL_RESTRICTIONS`, refuses the
|
|
11
|
+
* K type at 1s, 1m, 2m and 3m, where the ask would come back declined and read as unavailable),
|
|
12
|
+
* so `plan` refuses a finer chart by name before any fetch (the record: `interval-unserved`
|
|
13
|
+
* `fine`, the 5m minimum as the interval to try); otherwise the placeholders are the whole ask and
|
|
14
|
+
* the plan answers nothing.
|
|
15
|
+
*/
|
|
16
|
+
import { type WrunPollLane } from '../wrun-poll-lane.types.js';
|
|
17
|
+
export declare const lane: WrunPollLane;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `long_short_ratio` poll lane: the chart market's long/short ratios off the chart's
|
|
3
|
+
* `K_LONG_SHORT_RATIO` control (`LONG_SHORT_RATIO_AGG` for `<exchange>|<symbol>`, built by the
|
|
4
|
+
* control from the `symbol` and `exchange` the host's placeholders resolve to), one row per chart
|
|
5
|
+
* bar: `[ts, total_account, top_trader_account, top_trader_position]`, plain ratios of longs over
|
|
6
|
+
* shorts (the worker already reads a ratio at or below 0 as NaN, which the row builder treats as
|
|
7
|
+
* no observation under `carry`).
|
|
8
|
+
*
|
|
9
|
+
* No knobs, the chart's own market, an exact join at the bar opens. The data exists on 5m and
|
|
10
|
+
* coarser charts only (the chart's fetch gate, `KSCRIPT_DATA_INTERVAL_RESTRICTIONS`, refuses the
|
|
11
|
+
* K type at 1s, 1m, 2m and 3m, where the ask would come back declined and read as unavailable),
|
|
12
|
+
* so `plan` refuses a finer chart by name before any fetch (the record: `interval-unserved`
|
|
13
|
+
* `fine`, the 5m minimum as the interval to try); otherwise the placeholders are the whole ask and
|
|
14
|
+
* the plan answers nothing.
|
|
15
|
+
*/
|
|
16
|
+
import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
|
|
17
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.longShortRatio`). */
|
|
18
|
+
const WRUN_LONG_SHORT_RATIO_LANE_KEY = 'long_short_ratio';
|
|
19
|
+
/** The finest chart interval the series exists on, and its picker word. */
|
|
20
|
+
const WRUN_LONG_SHORT_RATIO_MIN_INTERVAL_MS = 5 * 60_000;
|
|
21
|
+
const WRUN_LONG_SHORT_RATIO_MIN_INTERVAL = '5m';
|
|
22
|
+
/** A chart interval finer than 5m as the picker spells it (`1s`, `1m`, `2m`, `3m`), for the
|
|
23
|
+
* refusal; a length outside the picker's grid reads in whole seconds. */
|
|
24
|
+
function finerIntervalLabel(intervalMs) {
|
|
25
|
+
if (intervalMs >= 60_000 && intervalMs % 60_000 === 0)
|
|
26
|
+
return `${intervalMs / 60_000}m`;
|
|
27
|
+
return `${Math.max(1, Math.round(intervalMs / 1000))}s`;
|
|
28
|
+
}
|
|
29
|
+
export const lane = {
|
|
30
|
+
sourceClass: 'long_short_ratio',
|
|
31
|
+
laneKey: WRUN_LONG_SHORT_RATIO_LANE_KEY,
|
|
32
|
+
kType: 'long_short_ratio',
|
|
33
|
+
fields: { total_account: 1, top_trader_account: 2, top_trader_position: 3 },
|
|
34
|
+
plan(_source, ctx) {
|
|
35
|
+
if (ctx.intervalMs < WRUN_LONG_SHORT_RATIO_MIN_INTERVAL_MS) {
|
|
36
|
+
const chartInterval = finerIntervalLabel(ctx.intervalMs);
|
|
37
|
+
return refuseWrunPollInput(ctx, `needs a 5m or coarser chart: long/short ratio data exists on 5m and coarser charts, and this chart is ${chartInterval}`, {
|
|
38
|
+
cls: 'interval-unserved',
|
|
39
|
+
variant: 'fine',
|
|
40
|
+
params: { feed: WRUN_LONG_SHORT_RATIO_LANE_KEY, interval: WRUN_LONG_SHORT_RATIO_MIN_INTERVAL, chartInterval },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
},
|
|
45
|
+
join: 'bar',
|
|
46
|
+
label: 'Long/short ratio',
|
|
47
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `option_daily` lane (UW-PARITY source S5a): the chart underlying's daily options statistics (US listed options,
|
|
3
|
+
* OPRA) as 31 scalars, a daily join (`input("iv30", option_daily.atm_iv_30d, { missing: "nan" })`): the underlying as
|
|
4
|
+
* a symbol code, its price, the at-the-money IV at nine tenors, the 30-day 25-delta risk reversal, call and put
|
|
5
|
+
* volume, premium and open interest, the net exposures, the walls, the gamma flip and magnet, the front expiry's max
|
|
6
|
+
* pain and implied move, and the contracts counted (wrun-opra-stats.leaf).
|
|
7
|
+
*
|
|
8
|
+
* It reads OPTION_UNDERLYING_STATS DAY rows by coin through `K_OPTION_UNDERLYING_STATS_DAY` (om's fetch type
|
|
9
|
+
* `option_underlying_stats_day`) and its worker twin. A DAY row is stamped at its New York session date's UTC
|
|
10
|
+
* midnight and written after that session's close, so the daily `last` landing lands it on the first chart bar of
|
|
11
|
+
* that UTC day and carries it across the day; the day before's row stands until the session's row is written
|
|
12
|
+
* (`lookbackDays` 7 keeps it in the ask after a holiday weekend). Not `global`: it follows the chart's underlying,
|
|
13
|
+
* read on the OPRA plane's native-rows path (`nativeRows` with a daily join), so the index-mode stock chart serves it.
|
|
14
|
+
*
|
|
15
|
+
* Refused by name before any fetch: `opra-official-only:option_daily` for a package that may not read US options, a
|
|
16
|
+
* chart that names no underlying, and `protocol-pending:OPTION_UNDERLYING_STATS` until the protocol release. An
|
|
17
|
+
* underlying with no row in the window answers empty: the empty-answer rule speaks for it.
|
|
18
|
+
*/
|
|
19
|
+
import { type WrunPollLane, type WrunPollLaneContext, type WrunPollLaneExtras } from '../wrun-poll-lane.types.js';
|
|
20
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionDaily`). */
|
|
21
|
+
export declare const WRUN_OPTION_DAILY_LANE_KEY = "option_daily";
|
|
22
|
+
/** The days before the chart window the ask opens: a session's row is written after its close, so the newest row
|
|
23
|
+
* standing at the window's head can be a few days old (a weekend, a holiday). */
|
|
24
|
+
export declare const WRUN_OPTION_DAILY_LOOKBACK_DAYS = 7;
|
|
25
|
+
/**
|
|
26
|
+
* One input against the chart: its underlying (the chart's coin, upper case), then the protocol gate. Shared with
|
|
27
|
+
* `option_stats_10m`, which reads the same underlying at ten minutes.
|
|
28
|
+
*/
|
|
29
|
+
export declare function planWrunOptionStatsInput(ctx: WrunPollLaneContext, feed: string, series: string): Promise<WrunPollLaneExtras>;
|
|
30
|
+
export declare const lane: WrunPollLane;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `option_daily` lane (UW-PARITY source S5a): the chart underlying's daily options statistics (US listed options,
|
|
3
|
+
* OPRA) as 31 scalars, a daily join (`input("iv30", option_daily.atm_iv_30d, { missing: "nan" })`): the underlying as
|
|
4
|
+
* a symbol code, its price, the at-the-money IV at nine tenors, the 30-day 25-delta risk reversal, call and put
|
|
5
|
+
* volume, premium and open interest, the net exposures, the walls, the gamma flip and magnet, the front expiry's max
|
|
6
|
+
* pain and implied move, and the contracts counted (wrun-opra-stats.leaf).
|
|
7
|
+
*
|
|
8
|
+
* It reads OPTION_UNDERLYING_STATS DAY rows by coin through `K_OPTION_UNDERLYING_STATS_DAY` (om's fetch type
|
|
9
|
+
* `option_underlying_stats_day`) and its worker twin. A DAY row is stamped at its New York session date's UTC
|
|
10
|
+
* midnight and written after that session's close, so the daily `last` landing lands it on the first chart bar of
|
|
11
|
+
* that UTC day and carries it across the day; the day before's row stands until the session's row is written
|
|
12
|
+
* (`lookbackDays` 7 keeps it in the ask after a holiday weekend). Not `global`: it follows the chart's underlying,
|
|
13
|
+
* read on the OPRA plane's native-rows path (`nativeRows` with a daily join), so the index-mode stock chart serves it.
|
|
14
|
+
*
|
|
15
|
+
* Refused by name before any fetch: `opra-official-only:option_daily` for a package that may not read US options, a
|
|
16
|
+
* chart that names no underlying, and `protocol-pending:OPTION_UNDERLYING_STATS` until the protocol release. An
|
|
17
|
+
* underlying with no row in the window answers empty: the empty-answer rule speaks for it.
|
|
18
|
+
*/
|
|
19
|
+
import { refuseWrunPollInput, } from '../wrun-poll-lane.types.js';
|
|
20
|
+
import { WRUN_OPTION_STATS_FIELDS, WRUN_OPTION_STATS_KTYPES, WRUN_OPTION_STATS_TYPE } from '../../wrun-opra-stats.leaf.js';
|
|
21
|
+
import { assertWrunProtocolType } from '../../wrun-protocol-pending.util.js';
|
|
22
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionDaily`). */
|
|
23
|
+
export const WRUN_OPTION_DAILY_LANE_KEY = 'option_daily';
|
|
24
|
+
/** The days before the chart window the ask opens: a session's row is written after its close, so the newest row
|
|
25
|
+
* standing at the window's head can be a few days old (a weekend, a holiday). */
|
|
26
|
+
export const WRUN_OPTION_DAILY_LOOKBACK_DAYS = 7;
|
|
27
|
+
/**
|
|
28
|
+
* One input against the chart: its underlying (the chart's coin, upper case), then the protocol gate. Shared with
|
|
29
|
+
* `option_stats_10m`, which reads the same underlying at ten minutes.
|
|
30
|
+
*/
|
|
31
|
+
export async function planWrunOptionStatsInput(ctx, feed, series) {
|
|
32
|
+
const coin = ctx.coin.trim().toUpperCase();
|
|
33
|
+
if (coin === '') {
|
|
34
|
+
return refuseWrunPollInput(ctx, `reads the ${series} of the chart's underlying, and this chart names none`, {
|
|
35
|
+
cls: 'feed-missing',
|
|
36
|
+
variant: 'market-paused',
|
|
37
|
+
params: { feed },
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
await assertWrunProtocolType(ctx, WRUN_OPTION_STATS_TYPE, feed);
|
|
41
|
+
return { coin };
|
|
42
|
+
}
|
|
43
|
+
export const lane = {
|
|
44
|
+
sourceClass: 'option_daily',
|
|
45
|
+
laneKey: WRUN_OPTION_DAILY_LANE_KEY,
|
|
46
|
+
kType: WRUN_OPTION_STATS_KTYPES.day,
|
|
47
|
+
fields: Object.freeze(Object.fromEntries(WRUN_OPTION_STATS_FIELDS.map((field, at) => [field, at + 1]))),
|
|
48
|
+
plan: (_source, ctx) => planWrunOptionStatsInput(ctx, WRUN_OPTION_DAILY_LANE_KEY, 'daily options statistics'),
|
|
49
|
+
join: { kind: 'daily', landing: 'last', lookbackDays: WRUN_OPTION_DAILY_LOOKBACK_DAYS },
|
|
50
|
+
label: 'Daily options statistics',
|
|
51
|
+
nativeRows: true,
|
|
52
|
+
opra: true,
|
|
53
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `option_stats_10m` lane (UW-PARITY source S5b): the chart underlying's options statistics every ten minutes, the
|
|
3
|
+
* same 31 scalars as `option_daily` (wrun-opra-stats.leaf), each ten-minute row on the chart bar holding it
|
|
4
|
+
* (`input("gex", option_stats_10m.net_gex, { missing: "carry" })`).
|
|
5
|
+
*
|
|
6
|
+
* It reads OPTION_UNDERLYING_STATS TEN_MINUTES rows by coin through `K_OPTION_UNDERLYING_STATS_10M` (om's fetch type
|
|
7
|
+
* `option_underlying_stats_10m`) and its worker twin, at ten minutes whatever the chart's interval (`interval`), and
|
|
8
|
+
* lands them on the chart's bars (`nativeRows` + `barGrid` snapshot, no tiers: a ten-minute row is the chain as it
|
|
9
|
+
* stood at its stamp, so it lands on the bar holding that stamp, and a bar holding several reads the newest): an
|
|
10
|
+
* as-of join, since a bar between two rows reads the input's `missing` policy (`carry` holds the last row). A stock
|
|
11
|
+
* chart's 09:30 New York bars and an OPRA contract chart's UTC bars alike.
|
|
12
|
+
*
|
|
13
|
+
* Only a configured list of underlyings has ten-minute rows (U7). The chart never mirrors that list: the worker twin
|
|
14
|
+
* decides from the data plane's answer (an empty window, then one probe of the last week) and answers the refusal by
|
|
15
|
+
* name, `not-in-10m-universe`, which degrades the lane once as the `feed-missing` / `not-sampled` record below.
|
|
16
|
+
*
|
|
17
|
+
* Refused by name before any fetch: `opra-official-only:option_stats_10m`, a chart naming no underlying, and
|
|
18
|
+
* `protocol-pending:OPTION_UNDERLYING_STATS` until the protocol release.
|
|
19
|
+
*/
|
|
20
|
+
import type { WrunPollLane } from '../wrun-poll-lane.types.js';
|
|
21
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionStats10m`). */
|
|
22
|
+
export declare const WRUN_OPTION_STATS_10M_LANE_KEY = "option_stats_10m";
|
|
23
|
+
export declare const lane: WrunPollLane;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { planWrunOptionStatsInput } from './option_daily.js';
|
|
2
|
+
import { WRUN_NOT_IN_10M_UNIVERSE_CODE, WRUN_OPTION_STATS_FIELDS, WRUN_OPTION_STATS_INTERVALS, WRUN_OPTION_STATS_KTYPES, } from '../../wrun-opra-stats.leaf.js';
|
|
3
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionStats10m`). */
|
|
4
|
+
export const WRUN_OPTION_STATS_10M_LANE_KEY = 'option_stats_10m';
|
|
5
|
+
export const lane = {
|
|
6
|
+
sourceClass: 'option_stats_10m',
|
|
7
|
+
laneKey: WRUN_OPTION_STATS_10M_LANE_KEY,
|
|
8
|
+
kType: WRUN_OPTION_STATS_KTYPES['10m'],
|
|
9
|
+
fields: Object.freeze(Object.fromEntries(WRUN_OPTION_STATS_FIELDS.map((field, at) => [field, at + 1]))),
|
|
10
|
+
plan: (_source, ctx) => planWrunOptionStatsInput(ctx, WRUN_OPTION_STATS_10M_LANE_KEY, '10-minute options statistics'),
|
|
11
|
+
join: 'bar',
|
|
12
|
+
interval: WRUN_OPTION_STATS_INTERVALS['10m'],
|
|
13
|
+
label: '10-minute options statistics',
|
|
14
|
+
nativeRows: true,
|
|
15
|
+
barGrid: { landing: 'snapshot' },
|
|
16
|
+
opra: true,
|
|
17
|
+
refusedAnswers: {
|
|
18
|
+
[WRUN_NOT_IN_10M_UNIVERSE_CODE]: { cls: 'feed-missing', variant: 'not-sampled' },
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `options_flow` lane (UW-PARITY source S2): one bar's US listed option flow (OPRA) of the chart's underlying, or
|
|
3
|
+
* of a market-wide scope, as 32 scalars per bar: premium in USD, contracts and prints as counts, share delta in
|
|
4
|
+
* shares, vega in USD per IV point (`input("calls", options_flow.net_call_prem, { scope: "market", dte: "0dte" })`).
|
|
5
|
+
*
|
|
6
|
+
* It reads OPTION_PRINT_AGG flow scope rows (wrun-opra-flow.leaf: which rows each knob names) through the
|
|
7
|
+
* `K_OPTION_PRINT_AGG_SCOPE` control and its worker twin, which sums a bucket's matching rows into the 32 fields
|
|
8
|
+
* (`foldWrunOptionsFlowRows`); this lane lands the buckets on the chart's bars under the tier rule (rule 9: 1m kept 7
|
|
9
|
+
* days, 5m kept 30, 1d kept, the finest that fits the bar and still holds it; a stock chart's 09:30 New York bars, an
|
|
10
|
+
* OPRA contract chart's UTC ones), summed per bar. A bar no tier holds any more reads the input's `missing` fill.
|
|
11
|
+
*
|
|
12
|
+
* Knobs (acquisition facets, each validated here before any fetch, refused by name otherwise):
|
|
13
|
+
* - `scope`: `ticker` (the default: COIN rows of the chart's underlying), `market` (MARKET rows of every issue type),
|
|
14
|
+
* `equity`, `etf`, `index` (MARKET rows of that issue type), `venue` (VENUE rows of the `venue` knob's exchange);
|
|
15
|
+
* - `dte`: `all` (the default), `0dte`, `week` (1 to 7 days), `month` (8 to 35), `later`;
|
|
16
|
+
* - `moneyness`: `all` (the default), `otm`, `itm`;
|
|
17
|
+
* - `venue`: scope `venue` only, required there: an exchange's ISO MIC (`XCBO`), read by its Databento publisher id
|
|
18
|
+
* (`WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS`). That scope serves `call_prem_total`, `put_prem_total`,
|
|
19
|
+
* `call_contracts_total`, `put_contracts_total` and `prints` alone, with no `dte` or `moneyness` split.
|
|
20
|
+
*
|
|
21
|
+
* OPRA: `opra`, so the run's wall refuses a package that may not read US options (`opra-official-only:options_flow`),
|
|
22
|
+
* the lane is served only where the chart's options ride the OPRA plane, its asks name the plane and their routed
|
|
23
|
+
* tier, and the overlay's OPRA provenance is stamped before the first ask. `nativeRows` + `barGrid`: served on the
|
|
24
|
+
* index-mode stock chart, asked on the native-rows path, landed on the host grid.
|
|
25
|
+
*
|
|
26
|
+
* Before the protocol package names OPTION_PRINT_AGG, every input refuses by name before any fetch
|
|
27
|
+
* (`protocol-pending:OPTION_PRINT_AGG`). The gateway's scope reads stay behind its `read.option_print_scopes`
|
|
28
|
+
* switch: while it is off, the worker twin answers the refusal by name (`option-scope-reads-off`) and the run
|
|
29
|
+
* degrades the lane once, its chip the record below (wrun-lane-refusal.leaf), never a blank or a retry loop.
|
|
30
|
+
*/
|
|
31
|
+
import { type WrunPollLane } from '../wrun-poll-lane.types.js';
|
|
32
|
+
import type { WrunBackendTier } from '../../wrun-tier-grid.util.js';
|
|
33
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionsFlow`). */
|
|
34
|
+
export declare const WRUN_OPTIONS_FLOW_LANE_KEY = "options_flow";
|
|
35
|
+
/** The tiers a bar is read from (rule 9, ADDENDUM-2 B3; the VENUE family keeps no 5m tier, so a 5m ask of it the
|
|
36
|
+
* gateway rolls up from its 1m rows, which a bar older than 7 days no longer has: that bar reads its fill). */
|
|
37
|
+
export declare const WRUN_OPTIONS_FLOW_TIERS: readonly WrunBackendTier[];
|
|
38
|
+
/**
|
|
39
|
+
* The Databento publisher id the data plane names each `venue` word by (the VENUE rows' `venue`, the request's
|
|
40
|
+
* `VENUE:<id>`). The words are ISO MIC codes, Databento's OPRA.PILLAR publisher suffixes (`OPRA.PILLAR.XCBO`): the
|
|
41
|
+
* fourteen exchanges om's market-share template reads by name. streamd writes a print's DBN header publisher id
|
|
42
|
+
* unmapped into `option_print.venue` (streamd `internal/tradficontroller/source/databento/option_print.go:135`, the
|
|
43
|
+
* header read at `internal/databento/dbn.go:244`), and no backend repo maps a MIC to its id, so the ids are
|
|
44
|
+
* Databento's own enum: dbn `rust/dbn/src/publishers.rs` @ fc7392bcbb (`OpraPillar<MIC>`, lines 818-852 and 900),
|
|
45
|
+
* equal in databento-cpp `include/databento/publishers.hpp` @ 5305827ee7. A word outside the table refuses by name
|
|
46
|
+
* (`options-flow-venue-unmapped:<VENUE>`), never a guessed id.
|
|
47
|
+
*/
|
|
48
|
+
export declare const WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS: Readonly<Record<string, number>>;
|
|
49
|
+
export declare function wrunOptionsFlowVenuePublisherId(venue: string): number | undefined;
|
|
50
|
+
export declare const lane: WrunPollLane;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `options_flow` lane (UW-PARITY source S2): one bar's US listed option flow (OPRA) of the chart's underlying, or
|
|
3
|
+
* of a market-wide scope, as 32 scalars per bar: premium in USD, contracts and prints as counts, share delta in
|
|
4
|
+
* shares, vega in USD per IV point (`input("calls", options_flow.net_call_prem, { scope: "market", dte: "0dte" })`).
|
|
5
|
+
*
|
|
6
|
+
* It reads OPTION_PRINT_AGG flow scope rows (wrun-opra-flow.leaf: which rows each knob names) through the
|
|
7
|
+
* `K_OPTION_PRINT_AGG_SCOPE` control and its worker twin, which sums a bucket's matching rows into the 32 fields
|
|
8
|
+
* (`foldWrunOptionsFlowRows`); this lane lands the buckets on the chart's bars under the tier rule (rule 9: 1m kept 7
|
|
9
|
+
* days, 5m kept 30, 1d kept, the finest that fits the bar and still holds it; a stock chart's 09:30 New York bars, an
|
|
10
|
+
* OPRA contract chart's UTC ones), summed per bar. A bar no tier holds any more reads the input's `missing` fill.
|
|
11
|
+
*
|
|
12
|
+
* Knobs (acquisition facets, each validated here before any fetch, refused by name otherwise):
|
|
13
|
+
* - `scope`: `ticker` (the default: COIN rows of the chart's underlying), `market` (MARKET rows of every issue type),
|
|
14
|
+
* `equity`, `etf`, `index` (MARKET rows of that issue type), `venue` (VENUE rows of the `venue` knob's exchange);
|
|
15
|
+
* - `dte`: `all` (the default), `0dte`, `week` (1 to 7 days), `month` (8 to 35), `later`;
|
|
16
|
+
* - `moneyness`: `all` (the default), `otm`, `itm`;
|
|
17
|
+
* - `venue`: scope `venue` only, required there: an exchange's ISO MIC (`XCBO`), read by its Databento publisher id
|
|
18
|
+
* (`WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS`). That scope serves `call_prem_total`, `put_prem_total`,
|
|
19
|
+
* `call_contracts_total`, `put_contracts_total` and `prints` alone, with no `dte` or `moneyness` split.
|
|
20
|
+
*
|
|
21
|
+
* OPRA: `opra`, so the run's wall refuses a package that may not read US options (`opra-official-only:options_flow`),
|
|
22
|
+
* the lane is served only where the chart's options ride the OPRA plane, its asks name the plane and their routed
|
|
23
|
+
* tier, and the overlay's OPRA provenance is stamped before the first ask. `nativeRows` + `barGrid`: served on the
|
|
24
|
+
* index-mode stock chart, asked on the native-rows path, landed on the host grid.
|
|
25
|
+
*
|
|
26
|
+
* Before the protocol package names OPTION_PRINT_AGG, every input refuses by name before any fetch
|
|
27
|
+
* (`protocol-pending:OPTION_PRINT_AGG`). The gateway's scope reads stay behind its `read.option_print_scopes`
|
|
28
|
+
* switch: while it is off, the worker twin answers the refusal by name (`option-scope-reads-off`) and the run
|
|
29
|
+
* degrades the lane once, its chip the record below (wrun-lane-refusal.leaf), never a blank or a retry loop.
|
|
30
|
+
*/
|
|
31
|
+
import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED, } from '../wrun-poll-lane.types.js';
|
|
32
|
+
import { WRUN_OPTION_PRINT_AGG_SCOPE_KTYPE, WRUN_OPTION_SCOPE_READS_OFF_CODE, WRUN_OPTIONS_FLOW_DTE, WRUN_OPTIONS_FLOW_FIELDS, WRUN_OPTIONS_FLOW_MONEYNESS, WRUN_OPTIONS_FLOW_SCOPES, WRUN_OPTIONS_FLOW_TYPE, WRUN_OPTIONS_FLOW_VENUE_FIELDS, WRUN_OPTIONS_FLOW_VENUE_RE, } from '../../wrun-opra-flow.leaf.js';
|
|
33
|
+
import { assertWrunProtocolType, wrunProtocolPendingSeed } from '../../wrun-protocol-pending.util.js';
|
|
34
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionsFlow`). */
|
|
35
|
+
export const WRUN_OPTIONS_FLOW_LANE_KEY = 'options_flow';
|
|
36
|
+
const MINUTE = 60_000;
|
|
37
|
+
const DAY = 86_400_000;
|
|
38
|
+
/** The tiers a bar is read from (rule 9, ADDENDUM-2 B3; the VENUE family keeps no 5m tier, so a 5m ask of it the
|
|
39
|
+
* gateway rolls up from its 1m rows, which a bar older than 7 days no longer has: that bar reads its fill). */
|
|
40
|
+
export const WRUN_OPTIONS_FLOW_TIERS = Object.freeze([
|
|
41
|
+
{ key: '1m', ms: MINUTE, retentionMs: 7 * DAY },
|
|
42
|
+
{ key: '5m', ms: 5 * MINUTE, retentionMs: 30 * DAY },
|
|
43
|
+
{ key: '1d', ms: DAY },
|
|
44
|
+
]);
|
|
45
|
+
/**
|
|
46
|
+
* The Databento publisher id the data plane names each `venue` word by (the VENUE rows' `venue`, the request's
|
|
47
|
+
* `VENUE:<id>`). The words are ISO MIC codes, Databento's OPRA.PILLAR publisher suffixes (`OPRA.PILLAR.XCBO`): the
|
|
48
|
+
* fourteen exchanges om's market-share template reads by name. streamd writes a print's DBN header publisher id
|
|
49
|
+
* unmapped into `option_print.venue` (streamd `internal/tradficontroller/source/databento/option_print.go:135`, the
|
|
50
|
+
* header read at `internal/databento/dbn.go:244`), and no backend repo maps a MIC to its id, so the ids are
|
|
51
|
+
* Databento's own enum: dbn `rust/dbn/src/publishers.rs` @ fc7392bcbb (`OpraPillar<MIC>`, lines 818-852 and 900),
|
|
52
|
+
* equal in databento-cpp `include/databento/publishers.hpp` @ 5305827ee7. A word outside the table refuses by name
|
|
53
|
+
* (`options-flow-venue-unmapped:<VENUE>`), never a guessed id.
|
|
54
|
+
*/
|
|
55
|
+
export const WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS = Object.freeze({
|
|
56
|
+
AMXO: 20, // NYSE American Options
|
|
57
|
+
XBOX: 21, // BOX Options
|
|
58
|
+
XCBO: 22, // Cboe Options
|
|
59
|
+
EMLD: 23, // MIAX Emerald
|
|
60
|
+
EDGO: 24, // Cboe EDGX Options
|
|
61
|
+
XISX: 26, // Nasdaq ISE
|
|
62
|
+
MCRY: 27, // Nasdaq MRX
|
|
63
|
+
XMIO: 28, // MIAX Options
|
|
64
|
+
ARCO: 29, // NYSE Arca Options
|
|
65
|
+
XNDQ: 32, // Nasdaq Options
|
|
66
|
+
XPHL: 35, // Nasdaq PHLX
|
|
67
|
+
BATO: 36, // Cboe BZX Options
|
|
68
|
+
MXOP: 37, // MEMX Options
|
|
69
|
+
SPHR: 61, // MIAX Sapphire: its publisher id (Databento's Venue enum numbers it 41; the header carries the publisher)
|
|
70
|
+
});
|
|
71
|
+
export function wrunOptionsFlowVenuePublisherId(venue) {
|
|
72
|
+
return Object.prototype.hasOwnProperty.call(WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS, venue)
|
|
73
|
+
? WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS[venue]
|
|
74
|
+
: undefined;
|
|
75
|
+
}
|
|
76
|
+
function knobWord(source, ctx, knob, words) {
|
|
77
|
+
const declared = source[knob];
|
|
78
|
+
const value = declared === undefined ? words[0] : declared;
|
|
79
|
+
if (typeof value === 'string' && words.includes(value))
|
|
80
|
+
return value;
|
|
81
|
+
return refuseWrunPollInput(ctx, `declares ${knob} '${String(declared)}': ${knob} is one of ${words.map((word) => `"${word}"`).join(', ')} ` +
|
|
82
|
+
`("${words[0]}" when absent)`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
83
|
+
}
|
|
84
|
+
/** One input against the chart: its knobs, then the protocol gate; the answer is the acquisition's knobs. */
|
|
85
|
+
async function planWrunOptionsFlow(source, ctx) {
|
|
86
|
+
const scope = knobWord(source, ctx, 'scope', WRUN_OPTIONS_FLOW_SCOPES);
|
|
87
|
+
const dte = knobWord(source, ctx, 'dte', WRUN_OPTIONS_FLOW_DTE);
|
|
88
|
+
const moneyness = knobWord(source, ctx, 'moneyness', WRUN_OPTIONS_FLOW_MONEYNESS);
|
|
89
|
+
let extras;
|
|
90
|
+
if (scope === 'venue') {
|
|
91
|
+
const venue = source.venue;
|
|
92
|
+
if (venue === undefined) {
|
|
93
|
+
return refuseWrunPollInput(ctx, 'declares scope "venue" with no venue: name the exchange whose prints it reads (options-flow-venue-required)', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
94
|
+
}
|
|
95
|
+
if (typeof venue !== 'string' || !WRUN_OPTIONS_FLOW_VENUE_RE.test(venue)) {
|
|
96
|
+
return refuseWrunPollInput(ctx, `declares venue '${String(venue)}': a venue is an exchange id, 2 to 16 upper-case letters, digits or underscores`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
97
|
+
}
|
|
98
|
+
const field = String(source.field ?? '');
|
|
99
|
+
const served = WRUN_OPTIONS_FLOW_VENUE_FIELDS;
|
|
100
|
+
const split = !served.includes(field)
|
|
101
|
+
? `field '${field}'`
|
|
102
|
+
: dte !== 'all'
|
|
103
|
+
? `dte "${dte}"`
|
|
104
|
+
: moneyness !== 'all'
|
|
105
|
+
? `moneyness "${moneyness}"`
|
|
106
|
+
: undefined;
|
|
107
|
+
if (split !== undefined) {
|
|
108
|
+
return refuseWrunPollInput(ctx, `reads ${split} under scope "venue": the venue rows serve ${served.join(', ')}, with no side, DTE or ` +
|
|
109
|
+
'moneyness split (options-flow-venue-field)', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
110
|
+
}
|
|
111
|
+
const venueId = wrunOptionsFlowVenuePublisherId(venue);
|
|
112
|
+
if (venueId === undefined) {
|
|
113
|
+
return refuseWrunPollInput(ctx, `declares venue '${venue}': the data plane names a venue by its publisher id, and this version of the app ` +
|
|
114
|
+
`holds none for ${venue} (options-flow-venue-unmapped:${venue})`, wrunProtocolPendingSeed(WRUN_OPTIONS_FLOW_LANE_KEY));
|
|
115
|
+
}
|
|
116
|
+
extras = { scope, venueId, dte, moneyness };
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
if (source.venue !== undefined) {
|
|
120
|
+
return refuseWrunPollInput(ctx, `declares venue '${String(source.venue)}' beside scope "${scope}": a venue names the exchange of scope ` +
|
|
121
|
+
'"venue" only (options-flow-venue-scope)', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
122
|
+
}
|
|
123
|
+
if (scope === 'ticker') {
|
|
124
|
+
const coin = ctx.coin.trim().toUpperCase();
|
|
125
|
+
if (coin === '') {
|
|
126
|
+
return refuseWrunPollInput(ctx, "reads the options flow of the chart's underlying, and this chart names none", {
|
|
127
|
+
cls: 'feed-missing',
|
|
128
|
+
variant: 'market-paused',
|
|
129
|
+
params: { feed: WRUN_OPTIONS_FLOW_LANE_KEY },
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
extras = { scope, coin, dte, moneyness };
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
extras = { scope, dte, moneyness };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
await assertWrunProtocolType(ctx, WRUN_OPTIONS_FLOW_TYPE, WRUN_OPTIONS_FLOW_LANE_KEY);
|
|
139
|
+
return extras;
|
|
140
|
+
}
|
|
141
|
+
export const lane = {
|
|
142
|
+
sourceClass: 'options_flow',
|
|
143
|
+
laneKey: WRUN_OPTIONS_FLOW_LANE_KEY,
|
|
144
|
+
kType: WRUN_OPTION_PRINT_AGG_SCOPE_KTYPE,
|
|
145
|
+
fields: Object.freeze(Object.fromEntries(WRUN_OPTIONS_FLOW_FIELDS.map((field, at) => [field, at + 1]))),
|
|
146
|
+
plan: planWrunOptionsFlow,
|
|
147
|
+
join: 'bar',
|
|
148
|
+
label: 'Options flow',
|
|
149
|
+
nativeRows: true,
|
|
150
|
+
barGrid: { landing: 'flow', tiers: WRUN_OPTIONS_FLOW_TIERS },
|
|
151
|
+
opra: true,
|
|
152
|
+
refusedAnswers: {
|
|
153
|
+
[WRUN_OPTION_SCOPE_READS_OFF_CODE]: { cls: 'service-no-answer', variant: 'switched-off' },
|
|
154
|
+
},
|
|
155
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `options_oi` lane of the browser lane: options open interest of the chart's coin on one
|
|
3
|
+
* venue, puts and calls apart (`input("put_oi", options_oi.puts, { venue: "binance" })`), off
|
|
4
|
+
* the `K_OPTIONS_OPEN_INTEREST` control.
|
|
5
|
+
*
|
|
6
|
+
* What the control serves (`k-options-open-interest.control.ts` and its worker twin): the main
|
|
7
|
+
* thread builds `{ tf, exchanges: [settings.exchange], coin: settings.coin, period, from, ovId }`
|
|
8
|
+
* (the chart's own interval in chart mode), so the lane's extras are `coin` and `exchange`; the
|
|
9
|
+
* worker asks Deribit's OPTION_OPEN_INTEREST_AGG grouped by option type (exchange `DERIBIT`) or
|
|
10
|
+
* Binance's BINANCE_OI_AND_VOLUME_SUM_AGG (exchange `BINANCE_OPTIONS`) and emits
|
|
11
|
+
* `[ts, puts, calls]`, one row per bar both sides reported (a one-sided bar is dropped, so it
|
|
12
|
+
* reads the input's `missing` fill). For any other exchange, and for a coin other than BTC or
|
|
13
|
+
* ETH, the worker ends its stream with no rows and no error: both refusals belong in `plan`, by
|
|
14
|
+
* name, before any fetch, where they read on the legend instead of a bare "data is unavailable".
|
|
15
|
+
*
|
|
16
|
+
* Units are the venue's (Deribit contracts, Binance base coin), documented, never converted.
|
|
17
|
+
*/
|
|
18
|
+
import { type WrunPollLane } from '../wrun-poll-lane.types.js';
|
|
19
|
+
/** The `venue` knob's words (the kit's WRUN_OPTIONS_FLOW_VENUES, in its order). The main thread
|
|
20
|
+
* never loads the kit bundle, so the lane hand-copies them; its spec pins the copy. */
|
|
21
|
+
export declare const WRUN_OPTIONS_OI_VENUES: readonly ["deribit", "binance"];
|
|
22
|
+
export type WrunOptionsOiVenue = (typeof WRUN_OPTIONS_OI_VENUES)[number];
|
|
23
|
+
/** An absent knob reads this venue (the kit's rule); the sheet keeps the knob absent. */
|
|
24
|
+
export declare const WRUN_OPTIONS_OI_DEFAULT_VENUE: WrunOptionsOiVenue;
|
|
25
|
+
/** The exchange the control's payload names (`settings.exchange`) for each venue word. */
|
|
26
|
+
export declare const WRUN_OPTIONS_OI_EXCHANGE_OF_VENUE: Readonly<Record<WrunOptionsOiVenue, string>>;
|
|
27
|
+
/** The coins the series exists for: the worker's own gate, spelled as the chart holds the coin. */
|
|
28
|
+
export declare const WRUN_OPTIONS_OI_COINS: readonly string[];
|
|
29
|
+
export declare const lane: WrunPollLane;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `options_oi` lane of the browser lane: options open interest of the chart's coin on one
|
|
3
|
+
* venue, puts and calls apart (`input("put_oi", options_oi.puts, { venue: "binance" })`), off
|
|
4
|
+
* the `K_OPTIONS_OPEN_INTEREST` control.
|
|
5
|
+
*
|
|
6
|
+
* What the control serves (`k-options-open-interest.control.ts` and its worker twin): the main
|
|
7
|
+
* thread builds `{ tf, exchanges: [settings.exchange], coin: settings.coin, period, from, ovId }`
|
|
8
|
+
* (the chart's own interval in chart mode), so the lane's extras are `coin` and `exchange`; the
|
|
9
|
+
* worker asks Deribit's OPTION_OPEN_INTEREST_AGG grouped by option type (exchange `DERIBIT`) or
|
|
10
|
+
* Binance's BINANCE_OI_AND_VOLUME_SUM_AGG (exchange `BINANCE_OPTIONS`) and emits
|
|
11
|
+
* `[ts, puts, calls]`, one row per bar both sides reported (a one-sided bar is dropped, so it
|
|
12
|
+
* reads the input's `missing` fill). For any other exchange, and for a coin other than BTC or
|
|
13
|
+
* ETH, the worker ends its stream with no rows and no error: both refusals belong in `plan`, by
|
|
14
|
+
* name, before any fetch, where they read on the legend instead of a bare "data is unavailable".
|
|
15
|
+
*
|
|
16
|
+
* Units are the venue's (Deribit contracts, Binance base coin), documented, never converted.
|
|
17
|
+
*/
|
|
18
|
+
import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED, wrunPollCoinGateSeed, } from '../wrun-poll-lane.types.js';
|
|
19
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionsOi`). */
|
|
20
|
+
const WRUN_OPTIONS_OI_LANE_KEY = 'options_oi';
|
|
21
|
+
/** The `venue` knob's words (the kit's WRUN_OPTIONS_FLOW_VENUES, in its order). The main thread
|
|
22
|
+
* never loads the kit bundle, so the lane hand-copies them; its spec pins the copy. */
|
|
23
|
+
export const WRUN_OPTIONS_OI_VENUES = Object.freeze(['deribit', 'binance']);
|
|
24
|
+
/** An absent knob reads this venue (the kit's rule); the sheet keeps the knob absent. */
|
|
25
|
+
export const WRUN_OPTIONS_OI_DEFAULT_VENUE = 'deribit';
|
|
26
|
+
/** The exchange the control's payload names (`settings.exchange`) for each venue word. */
|
|
27
|
+
export const WRUN_OPTIONS_OI_EXCHANGE_OF_VENUE = Object.freeze({
|
|
28
|
+
deribit: 'DERIBIT',
|
|
29
|
+
binance: 'BINANCE_OPTIONS',
|
|
30
|
+
});
|
|
31
|
+
/** The coins the series exists for: the worker's own gate, spelled as the chart holds the coin. */
|
|
32
|
+
export const WRUN_OPTIONS_OI_COINS = Object.freeze(['BTC', 'ETH']);
|
|
33
|
+
function isWrunOptionsOiVenue(word) {
|
|
34
|
+
return typeof word === 'string' && WRUN_OPTIONS_OI_VENUES.includes(word);
|
|
35
|
+
}
|
|
36
|
+
/** One input against the chart: a BTC or ETH chart (else the coin gate's record: the lane, its
|
|
37
|
+
* coins, the chart's coin), a known venue word (absent reads deribit; else a failed run, the
|
|
38
|
+
* author's to fix); the answer is the control's ask, so two inputs on different venues fetch
|
|
39
|
+
* separately. */
|
|
40
|
+
function planWrunOptionsOi(source, ctx) {
|
|
41
|
+
if (!WRUN_OPTIONS_OI_COINS.includes(ctx.coin)) {
|
|
42
|
+
const chartCoin = ctx.coin === '' ? 'this chart names no coin' : `this chart's coin is ${ctx.coin}`;
|
|
43
|
+
return refuseWrunPollInput(ctx, `needs a BTC or ETH chart: ${chartCoin} (options open interest exists for ${WRUN_OPTIONS_OI_COINS.join(' and ')})`, wrunPollCoinGateSeed(WRUN_OPTIONS_OI_LANE_KEY, WRUN_OPTIONS_OI_COINS, ctx.coin));
|
|
44
|
+
}
|
|
45
|
+
const venue = source.venue ?? WRUN_OPTIONS_OI_DEFAULT_VENUE;
|
|
46
|
+
if (!isWrunOptionsOiVenue(venue)) {
|
|
47
|
+
return refuseWrunPollInput(ctx, `declares venue '${String(venue)}': the options venues are ${WRUN_OPTIONS_OI_DEFAULT_VENUE} (the default when absent) and ${WRUN_OPTIONS_OI_VENUES.filter((word) => word !== WRUN_OPTIONS_OI_DEFAULT_VENUE).join(', ')}`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
48
|
+
}
|
|
49
|
+
return { coin: 'currentCoin', exchange: WRUN_OPTIONS_OI_EXCHANGE_OF_VENUE[venue] };
|
|
50
|
+
}
|
|
51
|
+
export const lane = {
|
|
52
|
+
sourceClass: 'options_oi',
|
|
53
|
+
laneKey: WRUN_OPTIONS_OI_LANE_KEY,
|
|
54
|
+
kType: 'options_open_interest',
|
|
55
|
+
fields: { puts: 1, calls: 2 },
|
|
56
|
+
plan: planWrunOptionsOi,
|
|
57
|
+
join: 'bar',
|
|
58
|
+
label: 'Options open interest',
|
|
59
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `options_volume` lane: the options volume of the chart's coin on one venue, puts and
|
|
3
|
+
* calls apart, in contracts (the kit's `options_volume.puts` / `.calls`), ridden on the legacy
|
|
4
|
+
* `K_OPTIONS_VOLUME` ask. On the main thread the options OI control instance serves the type
|
|
5
|
+
* (`k-options-open-interest.control.ts` registers it under both keys) and formats
|
|
6
|
+
* `{ tf, exchanges: [settings.exchange], coin: settings.coin, from, period }`; the worker twin
|
|
7
|
+
* (`k-options-volume.worker.ts`) sums Deribit's `TRADE_SIDE_AGNOSTIC_AGG` over every `-P` /
|
|
8
|
+
* `-C` instrument of the coin per bar, or reads Binance's `BINANCE_OI_AND_VOLUME_SUM_AGG` per
|
|
9
|
+
* side, and emits `[ts, puts, calls]` on the chart's own grid: a `bar` join.
|
|
10
|
+
*
|
|
11
|
+
* The worker ends its stream with NO rows unless the one exchange is `DERIBIT` or
|
|
12
|
+
* `BINANCE_OPTIONS` and the coin is `BTC` or `ETH`, so `plan` refuses both by name before any
|
|
13
|
+
* fetch: the `venue` knob (the kit's WRUN_OPTIONS_FLOW_VENUES: "deribit", read when the knob
|
|
14
|
+
* is absent, or "binance") maps to the exchange the control reads, and the chart's coin must
|
|
15
|
+
* be one the worker serves. Two venues are two asks (two lane instances); the chart's own
|
|
16
|
+
* market is not pinned (`coin: 'currentCoin'`, resolved by the chart's fetch).
|
|
17
|
+
*/
|
|
18
|
+
import { type WrunPollLane, type WrunPollLaneContext, type WrunPollLaneExtras, type WrunPollLaneSource } from '../wrun-poll-lane.types.js';
|
|
19
|
+
/** The `venue` knob's words, in the kit's order (WRUN_OPTIONS_FLOW_VENUES; the main thread
|
|
20
|
+
* never loads the kit bundle, the lane spec pins the copy). */
|
|
21
|
+
export declare const WRUN_OPTIONS_VOLUME_VENUES: readonly ["deribit", "binance"];
|
|
22
|
+
export type WrunOptionsVolumeVenue = (typeof WRUN_OPTIONS_VOLUME_VENUES)[number];
|
|
23
|
+
/** The venue an absent knob reads. */
|
|
24
|
+
export declare const WRUN_OPTIONS_VOLUME_DEFAULT_VENUE: WrunOptionsVolumeVenue;
|
|
25
|
+
/** Each venue word to the exchange the K control reads (`settings.exchange`, the one entry of
|
|
26
|
+
* the worker's `exchanges`). */
|
|
27
|
+
export declare const WRUN_OPTIONS_VOLUME_EXCHANGES: Readonly<Record<WrunOptionsVolumeVenue, string>>;
|
|
28
|
+
/** The chart coins the worker serves, spelled as the chart holds them (any other coin ends the
|
|
29
|
+
* worker's stream with no rows). */
|
|
30
|
+
export declare const WRUN_OPTIONS_VOLUME_COINS: readonly string[];
|
|
31
|
+
/**
|
|
32
|
+
* Validate one `options_volume` input against the chart before any fetch and answer the ask's
|
|
33
|
+
* payload fields: the coin placeholder and the venue's exchange. Refused by name: a `venue`
|
|
34
|
+
* word outside the kit's two (a failed run, the author's to fix), then a chart whose coin is not
|
|
35
|
+
* BTC or ETH (the coin gate's record: the lane, its coins, the chart's coin).
|
|
36
|
+
*/
|
|
37
|
+
export declare function planWrunOptionsVolume(source: WrunPollLaneSource, ctx: WrunPollLaneContext): WrunPollLaneExtras;
|
|
38
|
+
export declare const lane: WrunPollLane;
|