@orangecharts/wrun-chart-host 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -6
- package/dist/constants/common.constants.d.ts +15 -0
- package/dist/constants/common.constants.js +23 -0
- package/dist/constants/data-source.constants.d.ts +1 -0
- package/dist/constants/data-source.constants.js +1 -0
- package/dist/constants/economic.constants.d.ts +39 -0
- package/dist/constants/economic.constants.js +77 -0
- package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
- package/dist/constants/etf-covered-coins.constants.js +9 -0
- package/dist/constants/feature-flags.constants.d.ts +60 -0
- package/dist/constants/feature-flags.constants.js +308 -0
- package/dist/constants/feature-limits.constants.d.ts +134 -0
- package/dist/constants/feature-limits.constants.js +155 -0
- package/dist/constants/marketCapabilities.constants.d.ts +87 -0
- package/dist/constants/marketCapabilities.constants.js +213 -0
- package/dist/constants/option-venues.constants.d.ts +100 -0
- package/dist/constants/option-venues.constants.js +167 -0
- package/dist/constants/overlay-data.constants.d.ts +53 -0
- package/dist/constants/overlay-data.constants.js +80 -0
- package/dist/constants/pane-grid.constants.d.ts +15 -0
- package/dist/constants/pane-grid.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +10 -0
- package/dist/constants/venue-presets.constants.js +22 -0
- package/dist/enums/chart.enum.d.ts +68 -0
- package/dist/enums/chart.enum.js +70 -0
- package/dist/helpers/data.helpers.d.ts +2 -0
- package/dist/helpers/data.helpers.js +14 -0
- package/dist/host-env.d.ts +161 -5
- package/dist/host-ports.types.d.ts +446 -0
- package/dist/host-ports.types.js +1 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.js +128 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
- package/dist/interfaces/asset-venue.interface.d.ts +91 -0
- package/dist/interfaces/asset-venue.interface.js +1 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
- package/dist/interfaces/cancel-reason.interface.js +2 -0
- package/dist/interfaces/catalog-display.interface.d.ts +3 -0
- package/dist/interfaces/catalog-display.interface.js +1 -0
- package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
- package/dist/interfaces/cme-realtime.interface.js +46 -0
- package/dist/interfaces/feed.interface.d.ts +80 -0
- package/dist/interfaces/feed.interface.js +7 -0
- package/dist/interfaces/market-kind.interface.d.ts +8 -0
- package/dist/interfaces/market-kind.interface.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
- package/dist/interfaces/opra-realtime.interface.js +105 -0
- package/dist/interfaces/option-instrument.interface.d.ts +32 -0
- package/dist/interfaces/option-instrument.interface.js +1 -0
- package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
- package/dist/interfaces/options-chain-scope.interface.js +7 -0
- package/dist/interfaces/prediction-market.interface.d.ts +88 -0
- package/dist/interfaces/prediction-market.interface.js +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
- package/dist/settings-templates/frvp-fields.d.ts +27 -0
- package/dist/settings-templates/frvp-fields.js +108 -0
- package/dist/settings-templates/index.d.ts +119 -0
- package/dist/settings-templates/index.js +442 -0
- package/dist/settings-templates/indicator-fields.d.ts +56 -0
- package/dist/settings-templates/indicator-fields.js +793 -0
- package/dist/settings-templates/tool-rules.d.ts +59 -0
- package/dist/settings-templates/tool-rules.js +49 -0
- package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
- package/dist/settings-templates/tool-tables.generated.js +1668 -0
- package/dist/utility/blk-market.util.d.ts +5 -0
- package/dist/utility/blk-market.util.js +12 -0
- package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
- package/dist/utility/chart/chart-load-phase.util.js +78 -0
- package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
- package/dist/utility/chart/cme-cache-context.util.js +166 -0
- package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
- package/dist/utility/chart/cme-session-bucket.util.js +343 -0
- package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
- package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
- package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
- package/dist/utility/chart/continuous-contracts.util.js +374 -0
- package/dist/utility/chart/feed-interval.util.d.ts +119 -0
- package/dist/utility/chart/feed-interval.util.js +321 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
- package/dist/utility/chart/footprint-band.util.d.ts +76 -0
- package/dist/utility/chart/footprint-band.util.js +205 -0
- package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
- package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
- package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
- package/dist/utility/chart/formula-calendar.util.js +59 -0
- package/dist/utility/chart/history-wall.util.d.ts +67 -0
- package/dist/utility/chart/history-wall.util.js +87 -0
- package/dist/utility/chart/index-mode.util.d.ts +66 -0
- package/dist/utility/chart/index-mode.util.js +360 -0
- package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
- package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
- package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
- package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
- package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
- package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
- package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
- package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
- package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
- package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
- package/dist/utility/chart/interval-registry.util.d.ts +23 -0
- package/dist/utility/chart/interval-registry.util.js +83 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
- package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
- package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
- package/dist/utility/chart/live-bucket.util.d.ts +66 -0
- package/dist/utility/chart/live-bucket.util.js +165 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
- package/dist/utility/chart/market-session-schedule.util.js +337 -0
- package/dist/utility/chart/marketKind.util.d.ts +181 -0
- package/dist/utility/chart/marketKind.util.js +371 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
- package/dist/utility/chart/opra-read-access.leaf.js +25 -0
- package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
- package/dist/utility/chart/prediction-identity.util.js +236 -0
- package/dist/utility/chart/rth-session.util.d.ts +352 -0
- package/dist/utility/chart/rth-session.util.js +926 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
- package/dist/utility/chart/titan-constants.pin.js +50 -0
- package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
- package/dist/utility/chart/us-equities-session.util.js +251 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
- package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
- package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
- package/dist/utility/common/safe-math-eval.d.ts +18 -0
- package/dist/utility/common/safe-math-eval.js +160 -0
- package/dist/utility/common/time.util.d.ts +134 -0
- package/dist/utility/common/time.util.js +428 -0
- package/dist/utility/common/transformations.util.d.ts +126 -0
- package/dist/utility/common/transformations.util.js +711 -0
- package/dist/utility/common/visible-timeout.util.d.ts +17 -0
- package/dist/utility/common/visible-timeout.util.js +75 -0
- package/dist/utility/exchange-normalization.util.d.ts +8 -0
- package/dist/utility/exchange-normalization.util.js +32 -0
- package/dist/utility/intl-locale.util.d.ts +2 -0
- package/dist/utility/intl-locale.util.js +28 -0
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +50 -19
- package/dist/utility/options/option-symbol.util.d.ts +28 -0
- package/dist/utility/options/option-symbol.util.js +176 -0
- package/dist/utility/options/option-trade-units.util.d.ts +190 -0
- package/dist/utility/options/option-trade-units.util.js +283 -0
- package/dist/utility/options/option-venue.util.d.ts +75 -0
- package/dist/utility/options/option-venue.util.js +85 -0
- package/dist/utility/pool-symbol.leaf.d.ts +34 -0
- package/dist/utility/pool-symbol.leaf.js +95 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
- package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
- package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
- package/dist/utility/v2/gate-plane.util.d.ts +58 -0
- package/dist/utility/v2/gate-plane.util.js +99 -0
- package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
- package/dist/utility/v2/gate-session-latch.util.js +34 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
- package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
- package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/economic.js +79 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
- package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/lanes/index.js +32 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
- package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
- package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
- package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
- package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
- package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
- package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
- package/dist/utility/wrun/sources/lanes/series.js +321 -0
- package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
- package/dist/utility/wrun/sources/registry.d.ts +21 -0
- package/dist/utility/wrun/sources/registry.js +207 -0
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
- package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
- package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
- package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
- package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
- package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
- package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-deadline.util.js +82 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
- package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
- package/dist/utility/wrun/wrun-frames.d.ts +20 -1
- package/dist/utility/wrun/wrun-frames.js +103 -49
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +27 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
- package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
- package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
- package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
- package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +30 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
- package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
- package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
- package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
- package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
- package/dist/utility/wrun/wrun-param-map.util.js +581 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +41 -1
- package/dist/utility/wrun/wrun-refusal.util.js +69 -2
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
- package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
- package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
- package/dist/utility/wrun/wrun-row-source.js +75 -0
- package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
- package/dist/utility/wrun/wrun-run-health.util.js +273 -0
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
- package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
- package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
- package/dist/utility/wrun-display-name.util.d.ts +33 -0
- package/dist/utility/wrun-display-name.util.js +64 -0
- package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
- package/dist/workers/constants/kscript-transport-codes.js +15 -0
- package/dist/workers/constants/socket-slots.d.ts +574 -0
- package/dist/workers/constants/socket-slots.js +539 -0
- package/dist/workers/utils/number.worker.util.d.ts +5 -0
- package/dist/workers/utils/number.worker.util.js +10 -0
- package/dist/workers/utils/time.worker.util.d.ts +12 -0
- package/dist/workers/utils/time.worker.util.js +24 -0
- package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
- package/dist/workers/utils/volume-profile.worker.util.js +631 -0
- package/package.json +10 -4
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Refuse a malformed host-grid landing by name (a programming error, never a user's). */
|
|
2
|
+
export function assertWrunHostGridLanding(who, grid) {
|
|
3
|
+
if (grid.landing !== 'flow' && grid.landing !== 'snapshot') {
|
|
4
|
+
throw new Error(`${who}: barGrid landing is 'flow' or 'snapshot'`);
|
|
5
|
+
}
|
|
6
|
+
if (grid.tiers === undefined)
|
|
7
|
+
return;
|
|
8
|
+
if (!Array.isArray(grid.tiers) || grid.tiers.length === 0) {
|
|
9
|
+
throw new Error(`${who}: barGrid tiers is a list of tiers`);
|
|
10
|
+
}
|
|
11
|
+
const keys = new Set();
|
|
12
|
+
for (const tier of grid.tiers) {
|
|
13
|
+
if (typeof tier?.key !== 'string' || tier.key === '' || keys.has(tier.key)) {
|
|
14
|
+
throw new Error(`${who}: every tier has a key of its own`);
|
|
15
|
+
}
|
|
16
|
+
keys.add(tier.key);
|
|
17
|
+
if (!Number.isInteger(tier.ms) || tier.ms <= 0)
|
|
18
|
+
throw new Error(`${who}: tier '${tier.key}' needs a width in ms`);
|
|
19
|
+
if (tier.retentionMs !== undefined && !(Number.isFinite(tier.retentionMs) && tier.retentionMs > 0)) {
|
|
20
|
+
throw new Error(`${who}: tier '${tier.key}' keeps rows for a positive span, or for good (no retentionMs)`);
|
|
21
|
+
}
|
|
22
|
+
if (tier.servedLagMs !== undefined && !(Number.isFinite(tier.servedLagMs) && tier.servedLagMs > 0)) {
|
|
23
|
+
throw new Error(`${who}: tier '${tier.key}' serves a closed bucket after a positive lag, or as it forms`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `bitfinex_funding` class on the browser lane: Bitfinex margin funding for the chart's
|
|
3
|
+
* coin, four fields on four legacy K controls, so FOUR lanes (the host fetches only the lanes
|
|
4
|
+
* whose field an input declares, and inputs of one field share one fetch):
|
|
5
|
+
*
|
|
6
|
+
* | Field | K control | Series on the data plane |
|
|
7
|
+
* | -------------------- | ------------------------------- | ------------------------------------------------ |
|
|
8
|
+
* | `funding_size` | `K_BITFINEX_FUNDING_SIZE` | `BITFINEX_FUNDING_SIZE_AGG` on `f<coin>` |
|
|
9
|
+
* | `credit_size` | `K_BITFINEX_CREDIT_SIZE` | `BITFINEX_CREDIT_SIZE_AGG` on `f<coin>` |
|
|
10
|
+
* | `active_credit_size` | `K_BITFINEX_ACTIVE_CREDIT_SIZE` | `BITFINEX_ACTIVE_CREDIT_SIZE_AGG` on `<coin>USD` |
|
|
11
|
+
* | `margin_rate` | `K_BITFINEX_MARGIN_RATE` | `BITFINEX_MARGIN_RATES_AGG` on `f<coin>` |
|
|
12
|
+
*
|
|
13
|
+
* Each control answers `[ts, value]` rows on the chart's own interval (column 1 is the field),
|
|
14
|
+
* joined at the chart's bar opens under the input's `missing` policy. Units, documented and not
|
|
15
|
+
* converted: `funding_size` (total funding provided), `credit_size` (funding used in positions)
|
|
16
|
+
* and `active_credit_size` (active credits) are amounts in the funding currency; `margin_rate`
|
|
17
|
+
* is the Flash Return Rate as APR in percent (the worker's `rate x 100 x 365 x 365`, the factor
|
|
18
|
+
* Bitfinex's own API reference gives for the FRR field, confirmed 2026-10-01).
|
|
19
|
+
*
|
|
20
|
+
* No knobs: every lane reads the chart's own coin (a market pin, an interval pin and a view
|
|
21
|
+
* refuse upstream). The one pre-fetch refusal, by name: a chart with no coin, which no
|
|
22
|
+
* Bitfinex series can be keyed by. A coin Bitfinex does not lend answers empty and reads the
|
|
23
|
+
* labeled "data is unavailable" refusal, unless every input of the lane declares `missing:
|
|
24
|
+
* "nan"` or `"zero"`.
|
|
25
|
+
*/
|
|
26
|
+
import { type WrunPollLane } from '../wrun-poll-lane.types.js';
|
|
27
|
+
export declare const lanes: readonly WrunPollLane[];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `bitfinex_funding` class on the browser lane: Bitfinex margin funding for the chart's
|
|
3
|
+
* coin, four fields on four legacy K controls, so FOUR lanes (the host fetches only the lanes
|
|
4
|
+
* whose field an input declares, and inputs of one field share one fetch):
|
|
5
|
+
*
|
|
6
|
+
* | Field | K control | Series on the data plane |
|
|
7
|
+
* | -------------------- | ------------------------------- | ------------------------------------------------ |
|
|
8
|
+
* | `funding_size` | `K_BITFINEX_FUNDING_SIZE` | `BITFINEX_FUNDING_SIZE_AGG` on `f<coin>` |
|
|
9
|
+
* | `credit_size` | `K_BITFINEX_CREDIT_SIZE` | `BITFINEX_CREDIT_SIZE_AGG` on `f<coin>` |
|
|
10
|
+
* | `active_credit_size` | `K_BITFINEX_ACTIVE_CREDIT_SIZE` | `BITFINEX_ACTIVE_CREDIT_SIZE_AGG` on `<coin>USD` |
|
|
11
|
+
* | `margin_rate` | `K_BITFINEX_MARGIN_RATE` | `BITFINEX_MARGIN_RATES_AGG` on `f<coin>` |
|
|
12
|
+
*
|
|
13
|
+
* Each control answers `[ts, value]` rows on the chart's own interval (column 1 is the field),
|
|
14
|
+
* joined at the chart's bar opens under the input's `missing` policy. Units, documented and not
|
|
15
|
+
* converted: `funding_size` (total funding provided), `credit_size` (funding used in positions)
|
|
16
|
+
* and `active_credit_size` (active credits) are amounts in the funding currency; `margin_rate`
|
|
17
|
+
* is the Flash Return Rate as APR in percent (the worker's `rate x 100 x 365 x 365`, the factor
|
|
18
|
+
* Bitfinex's own API reference gives for the FRR field, confirmed 2026-10-01).
|
|
19
|
+
*
|
|
20
|
+
* No knobs: every lane reads the chart's own coin (a market pin, an interval pin and a view
|
|
21
|
+
* refuse upstream). The one pre-fetch refusal, by name: a chart with no coin, which no
|
|
22
|
+
* Bitfinex series can be keyed by. A coin Bitfinex does not lend answers empty and reads the
|
|
23
|
+
* labeled "data is unavailable" refusal, unless every input of the lane declares `missing:
|
|
24
|
+
* "nan"` or `"zero"`.
|
|
25
|
+
*/
|
|
26
|
+
import { refuseWrunPollInput, } from '../wrun-poll-lane.types.js';
|
|
27
|
+
const SOURCE_CLASS = 'bitfinex_funding';
|
|
28
|
+
/** The chart's coin, or the refusal by name: every Bitfinex funding series is keyed by one. */
|
|
29
|
+
function chartCoinOf(ctx) {
|
|
30
|
+
if (ctx.coin === '')
|
|
31
|
+
refuseWrunPollInput(ctx, 'needs a chart with a coin: this chart has none');
|
|
32
|
+
return ctx.coin;
|
|
33
|
+
}
|
|
34
|
+
/** The funding-currency lanes: their controls build `BITFINEX|f<coin>` from `settings.coin`,
|
|
35
|
+
* so the ask carries the coin placeholder the chart's fetch resolves. */
|
|
36
|
+
function planFundingCurrencyLane(_source, ctx) {
|
|
37
|
+
chartCoinOf(ctx);
|
|
38
|
+
return { coin: 'currentCoin' };
|
|
39
|
+
}
|
|
40
|
+
/** The active credit lane: `K_BITFINEX_ACTIVE_CREDIT_SIZE` reads `settings.symbol` before
|
|
41
|
+
* `settings.coin`, and the host's `symbol` placeholder resolves to the chart's OWN pair
|
|
42
|
+
* (`BTCUSDT` on a Binance chart), which is no Bitfinex market. The lane names the Bitfinex
|
|
43
|
+
* USD pair of the chart's coin itself, the pair the control's own coin branch and the
|
|
44
|
+
* Bitfinex active credit indicator build (`<coin>USD`). */
|
|
45
|
+
function planActiveCreditLane(_source, ctx) {
|
|
46
|
+
return { symbol: `${chartCoinOf(ctx)}USD` };
|
|
47
|
+
}
|
|
48
|
+
export const lanes = [
|
|
49
|
+
{
|
|
50
|
+
sourceClass: SOURCE_CLASS,
|
|
51
|
+
laneKey: 'bitfinex_funding_size',
|
|
52
|
+
kType: 'bitfinex_funding_size',
|
|
53
|
+
fields: { funding_size: 1 },
|
|
54
|
+
plan: planFundingCurrencyLane,
|
|
55
|
+
join: 'bar',
|
|
56
|
+
label: 'Bitfinex funding size',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
sourceClass: SOURCE_CLASS,
|
|
60
|
+
laneKey: 'bitfinex_credit_size',
|
|
61
|
+
kType: 'bitfinex_credit_size',
|
|
62
|
+
fields: { credit_size: 1 },
|
|
63
|
+
plan: planFundingCurrencyLane,
|
|
64
|
+
join: 'bar',
|
|
65
|
+
label: 'Bitfinex credit size',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
sourceClass: SOURCE_CLASS,
|
|
69
|
+
laneKey: 'bitfinex_active_credit_size',
|
|
70
|
+
kType: 'bitfinex_active_credit_size',
|
|
71
|
+
fields: { active_credit_size: 1 },
|
|
72
|
+
plan: planActiveCreditLane,
|
|
73
|
+
join: 'bar',
|
|
74
|
+
label: 'Bitfinex active credit size',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
sourceClass: SOURCE_CLASS,
|
|
78
|
+
laneKey: 'bitfinex_margin_rate',
|
|
79
|
+
kType: 'bitfinex_margin_rate',
|
|
80
|
+
fields: { margin_rate: 1 },
|
|
81
|
+
plan: planFundingCurrencyLane,
|
|
82
|
+
join: 'bar',
|
|
83
|
+
label: 'Bitfinex margin rate',
|
|
84
|
+
},
|
|
85
|
+
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type WrunPollLane, type WrunPollLaneContext, type WrunPollLaneSource } from '../wrun-poll-lane.types.js';
|
|
2
|
+
export declare const WRUN_ECONOMIC_SOURCE = "economic";
|
|
3
|
+
export declare const WRUN_ECONOMIC_FIELD = "value";
|
|
4
|
+
/** The publishers the lane serves, in the venue list's order: FRED, the catalog venue, the
|
|
5
|
+
* observation publishers. The kit carries no list; an unknown one refuses here by name. */
|
|
6
|
+
export declare const WRUN_ECONOMIC_PUBLISHERS: readonly string[];
|
|
7
|
+
/**
|
|
8
|
+
* How far before the chart window the full run's ask opens. A `last` landing needs the
|
|
9
|
+
* observation standing at the window's head, and publishers release monthly (a CPI, stamped
|
|
10
|
+
* on the 1st), quarterly (a GDP) or yearly: a short intraday window holds no observation of
|
|
11
|
+
* its own. 400 days keeps a quarterly series' observation inside the ask even when it is
|
|
12
|
+
* released a quarter late (two quarters, 184 days, with margin) and reaches an annual series
|
|
13
|
+
* stamped within the past 13 months; a daily series pays 400 extra daily rows, negligible.
|
|
14
|
+
*/
|
|
15
|
+
export declare const WRUN_ECONOMIC_LOOKBACK_DAYS = 400;
|
|
16
|
+
/** The payload fields the K_ECONOMIC control reads (`settings.exchange`, `settings.symbol`). */
|
|
17
|
+
export type WrunEconomicExtras = {
|
|
18
|
+
exchange: string;
|
|
19
|
+
symbol: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Validate one `economic` input before any fetch: a known publisher (refused by name, listing
|
|
23
|
+
* the served ones; the venue code is canonical upper case, as the control sends it) and a
|
|
24
|
+
* series id (trimmed, case kept, no whitespace inside). Answers the control's own field names.
|
|
25
|
+
*/
|
|
26
|
+
export declare function planWrunEconomicInput(source: WrunPollLaneSource, ctx: WrunPollLaneContext): WrunEconomicExtras;
|
|
27
|
+
export declare const lane: WrunPollLane;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `economic` poll lane: a published economic observation series (a FRED series or an
|
|
3
|
+
* economic publisher's series) as one scalar per chart bar, `economic.value`, in the
|
|
4
|
+
* publisher's own unit (percent, index points, millions of dollars: whatever the publisher
|
|
5
|
+
* reports; nothing is converted).
|
|
6
|
+
*
|
|
7
|
+
* Rides the `K_ECONOMIC` control (`src/kscript-data/controls/k-economic.control.ts` and its
|
|
8
|
+
* worker twin `k-economic.worker.ts`): `FRED` asks `FRED_OBSERVATION_AGG` by series id, every
|
|
9
|
+
* other publisher the raw `OBSERVATION` type by exchange plus symbol. The control honors
|
|
10
|
+
* `settings.interval` (the `1d` this lane asks), clamps itself to a day at least and emits
|
|
11
|
+
* `[ts, value]` ascending, daily or slower (a repeated stamp keeps its last value; an
|
|
12
|
+
* observation before 1970 carries a negative stamp). No live channel: the poll reconcile
|
|
13
|
+
* re-asks it.
|
|
14
|
+
*
|
|
15
|
+
* Knobs, both required (the kit checks their shape, this lane the publisher's name):
|
|
16
|
+
* - `publisher`: one of the chart's economic venues (`ECONOMIC_EXCHANGES`: FRED, the ECONOMICS
|
|
17
|
+
* catalog venue and the observation publishers). Answered as the payload's `exchange`.
|
|
18
|
+
* - `series`: the publisher's series id, case kept. Answered as the payload's `symbol`.
|
|
19
|
+
*
|
|
20
|
+
* The answer names the series itself, so it overrides the current-market placeholders the
|
|
21
|
+
* host puts under every poll-lane payload: the chart's market plays no part (an economic
|
|
22
|
+
* series reads the same on every chart), and two inputs declaring different series are two
|
|
23
|
+
* fetches, equal declarations one.
|
|
24
|
+
*
|
|
25
|
+
* Join: daily, landing `last` (a level: a chart bar reads the newest observation at or before
|
|
26
|
+
* its day; intraday bars repeat the day's value through the `missing` policy, a weekly bar
|
|
27
|
+
* reads its last reported day). Fetched at `1d` on every chart.
|
|
28
|
+
*/
|
|
29
|
+
import { ECONOMIC_EXCHANGES } from '../../../../constants/economic.constants.js';
|
|
30
|
+
import { refuseWrunPollInput, } from '../wrun-poll-lane.types.js';
|
|
31
|
+
export const WRUN_ECONOMIC_SOURCE = 'economic';
|
|
32
|
+
export const WRUN_ECONOMIC_FIELD = 'value';
|
|
33
|
+
/** The publishers the lane serves, in the venue list's order: FRED, the catalog venue, the
|
|
34
|
+
* observation publishers. The kit carries no list; an unknown one refuses here by name. */
|
|
35
|
+
export const WRUN_ECONOMIC_PUBLISHERS = ECONOMIC_EXCHANGES;
|
|
36
|
+
/**
|
|
37
|
+
* How far before the chart window the full run's ask opens. A `last` landing needs the
|
|
38
|
+
* observation standing at the window's head, and publishers release monthly (a CPI, stamped
|
|
39
|
+
* on the 1st), quarterly (a GDP) or yearly: a short intraday window holds no observation of
|
|
40
|
+
* its own. 400 days keeps a quarterly series' observation inside the ask even when it is
|
|
41
|
+
* released a quarter late (two quarters, 184 days, with margin) and reaches an annual series
|
|
42
|
+
* stamped within the past 13 months; a daily series pays 400 extra daily rows, negligible.
|
|
43
|
+
*/
|
|
44
|
+
export const WRUN_ECONOMIC_LOOKBACK_DAYS = 400;
|
|
45
|
+
const publishersText = () => WRUN_ECONOMIC_PUBLISHERS.join(', ');
|
|
46
|
+
/**
|
|
47
|
+
* Validate one `economic` input before any fetch: a known publisher (refused by name, listing
|
|
48
|
+
* the served ones; the venue code is canonical upper case, as the control sends it) and a
|
|
49
|
+
* series id (trimmed, case kept, no whitespace inside). Answers the control's own field names.
|
|
50
|
+
*/
|
|
51
|
+
export function planWrunEconomicInput(source, ctx) {
|
|
52
|
+
const declared = source.publisher;
|
|
53
|
+
if (declared === undefined || declared === null || (typeof declared === 'string' && declared.trim() === '')) {
|
|
54
|
+
return refuseWrunPollInput(ctx, `declares no publisher: declare one of ${publishersText()}`);
|
|
55
|
+
}
|
|
56
|
+
const publisher = typeof declared === 'string' ? declared.trim().toUpperCase() : '';
|
|
57
|
+
if (!WRUN_ECONOMIC_PUBLISHERS.includes(publisher)) {
|
|
58
|
+
return refuseWrunPollInput(ctx, `declares publisher '${String(source.publisher)}': not one the chart serves (${publishersText()})`);
|
|
59
|
+
}
|
|
60
|
+
const series = typeof source.series === 'string' ? source.series.trim() : '';
|
|
61
|
+
if (series === '') {
|
|
62
|
+
return refuseWrunPollInput(ctx, `declares no series: declare the ${publisher} series id`);
|
|
63
|
+
}
|
|
64
|
+
if (/\s/.test(series)) {
|
|
65
|
+
return refuseWrunPollInput(ctx, `declares series '${series}': a series id carries no whitespace`);
|
|
66
|
+
}
|
|
67
|
+
return { exchange: publisher, symbol: series };
|
|
68
|
+
}
|
|
69
|
+
export const lane = {
|
|
70
|
+
sourceClass: WRUN_ECONOMIC_SOURCE,
|
|
71
|
+
laneKey: 'economic',
|
|
72
|
+
kType: 'economic',
|
|
73
|
+
fields: { [WRUN_ECONOMIC_FIELD]: 1 },
|
|
74
|
+
plan: planWrunEconomicInput,
|
|
75
|
+
join: { kind: 'daily', landing: 'last', lookbackDays: WRUN_ECONOMIC_LOOKBACK_DAYS },
|
|
76
|
+
label: 'Economic series',
|
|
77
|
+
// A publisher's series reads nothing of the chart's market: served on every chart.
|
|
78
|
+
global: true,
|
|
79
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type WrunPollLane, type WrunPollLaneContext, type WrunPollLaneSource } from '../wrun-poll-lane.types.js';
|
|
2
|
+
export declare const WRUN_ETF_HOLDINGS_SOURCE = "etf_holdings";
|
|
3
|
+
export declare const WRUN_ETF_HOLDINGS_FIELD = "holdings";
|
|
4
|
+
/** The kScript source type the chart's fetch rides (`K_ETF_HOLDING`). */
|
|
5
|
+
export declare const WRUN_ETF_HOLDINGS_K_TYPE = "etf_holding";
|
|
6
|
+
/** The `fund` word for the sum over every fund listed for the chart's coin (the `etf_flow` word). */
|
|
7
|
+
export declare const WRUN_ETF_HOLDINGS_ALL_FUNDS = "all";
|
|
8
|
+
/** The coarsest chart the series is served on is finer than this (the gate refuses `1w`). */
|
|
9
|
+
export declare const WRUN_ETF_HOLDINGS_MAX_INTERVAL_MS: number;
|
|
10
|
+
/** The finest chart the series is served on (the gate refuses `1s`). */
|
|
11
|
+
export declare const WRUN_ETF_HOLDINGS_MIN_INTERVAL_MS: number;
|
|
12
|
+
/** The payload fields the control reads beyond the market placeholders. */
|
|
13
|
+
export type WrunEtfHoldingsExtras = {
|
|
14
|
+
/** The one ticker, or the first listed one for `all` (the control's single-symbol field). */
|
|
15
|
+
symbol: string;
|
|
16
|
+
/** Every ticker the control sums: one, or the coin's whole list for `all`. */
|
|
17
|
+
symbols: string[];
|
|
18
|
+
/** The chart's coin as a word (the worker's listing-day clamp reads it). */
|
|
19
|
+
coin: string;
|
|
20
|
+
};
|
|
21
|
+
/** The chart's coin as the ETF family spells it: trimmed, upper-cased, BitMEX's XBT read as BTC
|
|
22
|
+
* (the built-in coverage gate's own rule); '' when absent. */
|
|
23
|
+
export declare function wrunEtfHoldingsCoinWord(coin: unknown): string;
|
|
24
|
+
/** The tickers the metadata lists for a coin's spot-ETF holdings (StreamMarkets type ETF_METRICS
|
|
25
|
+
* by coin, the built-in holdings indicator's own lookup, session-cached by the metadata
|
|
26
|
+
* service), in the metadata's order, each once. Lazy: the service and the proto enums load on
|
|
27
|
+
* demand. */
|
|
28
|
+
export declare function resolveWrunEtfHoldingsTickers(coin: string): Promise<string[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Validate one `etf_holdings` input against the chart BEFORE any fetch (the fund word, the
|
|
31
|
+
* coin's ETF family, the chart interval, the coin's listed tickers) and answer the payload
|
|
32
|
+
* fields the control reads, or refuse by name.
|
|
33
|
+
*/
|
|
34
|
+
export declare function planWrunEtfHoldingsInput(source: WrunPollLaneSource, ctx: WrunPollLaneContext): Promise<WrunEtfHoldingsExtras>;
|
|
35
|
+
export declare const lane: WrunPollLane;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `etf_holdings` poll lane: the coins a spot ETF holds, for one fund or summed over every
|
|
3
|
+
* fund listed for the chart's coin (`input("ibit", etf_holdings.holdings, { fund: "IBIT" })`,
|
|
4
|
+
* `{ fund: "all" }` for the coin's sum). Units: coins of the fund's underlying (no USD mode).
|
|
5
|
+
*
|
|
6
|
+
* Rides the `K_ETF_HOLDING` control (`src/kscript-data/controls/k-etf-holding.control.ts` and its
|
|
7
|
+
* worker twin). The control reads `symbol`, `symbols` and `coin` off the resolved payload and
|
|
8
|
+
* asks `ETF_METRICS_AGG` for the tickers (no exchange, no coin on the wire); the worker fetches
|
|
9
|
+
* the DAY series on an intraday chart (the chart's own interval otherwise), sums `holdings`
|
|
10
|
+
* across the tickers per reported day and emits ONE DENSE ROW PER CHART BAR, `[ts, holdings]`,
|
|
11
|
+
* carrying each day's value across the bars of that day. Rows are stamped at the chart's bar
|
|
12
|
+
* opens, so an input exact-joins its bar (`join: 'bar'`) under the `missing` policy.
|
|
13
|
+
*
|
|
14
|
+
* The plan, before any fetch (the only place the lane refuses, by name; each refusal carries its
|
|
15
|
+
* record's seed):
|
|
16
|
+
* - the `fund` word is declared and spelled as the kit's rule (the kit refuses first; the lane
|
|
17
|
+
* stays total): a failed run, the author's to fix;
|
|
18
|
+
* - the chart's coin is one with listed spot ETFs (`ETF_COVERED_COINS`, the native ETF
|
|
19
|
+
* indicators' gate: the coin gate's record), and the metadata lists funds for it
|
|
20
|
+
* (`StreamMarkets` type `ETF_METRICS` by coin, the built-in holdings indicator's own lookup,
|
|
21
|
+
* session-cached by the service: the market has no such feed otherwise);
|
|
22
|
+
* - the fund is one of the coin's listed tickers (the refusal names them), or `all`: a failed run;
|
|
23
|
+
* - the chart is finer than a week (the chart's fetch gate refuses `ETF_HOLDING` on a weekly
|
|
24
|
+
* chart, and the worker has no week series to ask; coarser charts have none either: the record
|
|
25
|
+
* is `interval-unserved` `coarse`) and 1m or coarser (the gate refuses the type at 1s; the
|
|
26
|
+
* series is daily: `fine`).
|
|
27
|
+
* The answer is `{ symbol, symbols, coin }`: one ticker (`symbols: [ticker]`), or the first of
|
|
28
|
+
* the coin's list with every listed ticker under `symbols` for `all`, and the chart's coin as a
|
|
29
|
+
* word (the worker clamps the window to the coin's first listing day and would price a USD ask
|
|
30
|
+
* by it; the lane leaves `currency` unset, coins). Two inputs with one fund word share ONE
|
|
31
|
+
* fetch; different fund words fetch separately (`all` is its own instance beside a ticker).
|
|
32
|
+
*
|
|
33
|
+
* Light at module load: the metadata service, the proto enums, the covered-coin constants and
|
|
34
|
+
* the interval labels load inside `plan`.
|
|
35
|
+
*/
|
|
36
|
+
import { wrunChartHostEnv } from '../../../../host-env.js';
|
|
37
|
+
import { Intervals } from '../../../../constants/interval.constants.js';
|
|
38
|
+
import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED, wrunPollCoinGateSeed, } from '../wrun-poll-lane.types.js';
|
|
39
|
+
import { isWrunEtfFlowFund, WRUN_ETF_FLOW_ALL_FUNDS } from '../../wrun-etf-flow-lane.util.js';
|
|
40
|
+
export const WRUN_ETF_HOLDINGS_SOURCE = 'etf_holdings';
|
|
41
|
+
export const WRUN_ETF_HOLDINGS_FIELD = 'holdings';
|
|
42
|
+
/** The kScript source type the chart's fetch rides (`K_ETF_HOLDING`). */
|
|
43
|
+
export const WRUN_ETF_HOLDINGS_K_TYPE = 'etf_holding';
|
|
44
|
+
/** The `fund` word for the sum over every fund listed for the chart's coin (the `etf_flow` word). */
|
|
45
|
+
export const WRUN_ETF_HOLDINGS_ALL_FUNDS = WRUN_ETF_FLOW_ALL_FUNDS;
|
|
46
|
+
/** The coarsest chart the series is served on is finer than this (the gate refuses `1w`). */
|
|
47
|
+
export const WRUN_ETF_HOLDINGS_MAX_INTERVAL_MS = Intervals.WEEK;
|
|
48
|
+
/** The finest chart the series is served on (the gate refuses `1s`). */
|
|
49
|
+
export const WRUN_ETF_HOLDINGS_MIN_INTERVAL_MS = Intervals.MINUTE;
|
|
50
|
+
/** The two bounds as the picker spells them (the interval refusal's record names the bound). */
|
|
51
|
+
const WRUN_ETF_HOLDINGS_MAX_INTERVAL = '1w';
|
|
52
|
+
const WRUN_ETF_HOLDINGS_MIN_INTERVAL = '1m';
|
|
53
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.etfHoldings`). */
|
|
54
|
+
const WRUN_ETF_HOLDINGS_LANE_KEY = 'etf_holdings';
|
|
55
|
+
/** The chart's coin as the ETF family spells it: trimmed, upper-cased, BitMEX's XBT read as BTC
|
|
56
|
+
* (the built-in coverage gate's own rule); '' when absent. */
|
|
57
|
+
export function wrunEtfHoldingsCoinWord(coin) {
|
|
58
|
+
const word = typeof coin === 'string' ? coin.trim().toUpperCase() : '';
|
|
59
|
+
return word === 'XBT' ? 'BTC' : word;
|
|
60
|
+
}
|
|
61
|
+
/** The tickers the metadata lists for a coin's spot-ETF holdings (StreamMarkets type ETF_METRICS
|
|
62
|
+
* by coin, the built-in holdings indicator's own lookup, session-cached by the metadata
|
|
63
|
+
* service), in the metadata's order, each once. Lazy: the service and the proto enums load on
|
|
64
|
+
* demand. */
|
|
65
|
+
export async function resolveWrunEtfHoldingsTickers(coin) {
|
|
66
|
+
const [{ default: metadataService }, { Type }] = await Promise.all([
|
|
67
|
+
wrunChartHostEnv().market.loadMetadataService(),
|
|
68
|
+
import('@orangecharts/orange-v2-pb-common'),
|
|
69
|
+
]);
|
|
70
|
+
const markets = (await metadataService.getMarkets({
|
|
71
|
+
type: [Type.ETF_METRICS],
|
|
72
|
+
coin: [coin],
|
|
73
|
+
excludePrices: true,
|
|
74
|
+
}));
|
|
75
|
+
const tickers = [];
|
|
76
|
+
for (const market of markets ?? []) {
|
|
77
|
+
const ticker = typeof market.rawSymbol === 'string' && market.rawSymbol !== ''
|
|
78
|
+
? market.rawSymbol
|
|
79
|
+
: typeof market.symbol === 'string'
|
|
80
|
+
? market.symbol
|
|
81
|
+
: '';
|
|
82
|
+
if (ticker !== '' && !tickers.includes(ticker))
|
|
83
|
+
tickers.push(ticker);
|
|
84
|
+
}
|
|
85
|
+
return tickers;
|
|
86
|
+
}
|
|
87
|
+
/** The chart's interval as the picker spells it (`1w`, `1M`, `1s`), undefined for a length the
|
|
88
|
+
* picker has no word for. */
|
|
89
|
+
async function chartIntervalLabel(intervalMs) {
|
|
90
|
+
const { intervalLabelForMs } = await import('../../../chart/interval-registry.util.js');
|
|
91
|
+
return intervalLabelForMs(intervalMs);
|
|
92
|
+
}
|
|
93
|
+
/** The chart's interval for a refusal's words: the picker's word, else whole days or seconds. */
|
|
94
|
+
function chartIntervalWord(intervalMs, label) {
|
|
95
|
+
if (label !== undefined)
|
|
96
|
+
return label;
|
|
97
|
+
if (intervalMs >= Intervals.DAY)
|
|
98
|
+
return `${Math.round(intervalMs / Intervals.DAY)} days`;
|
|
99
|
+
return `${Math.max(1, Math.round(intervalMs / 1000))}s`;
|
|
100
|
+
}
|
|
101
|
+
/** The interval refusal's seed: `fine` names the finest interval served, `coarse` the bound the
|
|
102
|
+
* chart must be finer than; the chart's interval rides along when the picker has a word for it
|
|
103
|
+
* (else the surface reads the chart's own). */
|
|
104
|
+
function intervalGateSeed(variant, interval, label) {
|
|
105
|
+
return {
|
|
106
|
+
cls: 'interval-unserved',
|
|
107
|
+
variant,
|
|
108
|
+
params: {
|
|
109
|
+
feed: WRUN_ETF_HOLDINGS_LANE_KEY,
|
|
110
|
+
interval,
|
|
111
|
+
...(label !== undefined ? { chartInterval: label } : {}),
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Validate one `etf_holdings` input against the chart BEFORE any fetch (the fund word, the
|
|
117
|
+
* coin's ETF family, the chart interval, the coin's listed tickers) and answer the payload
|
|
118
|
+
* fields the control reads, or refuse by name.
|
|
119
|
+
*/
|
|
120
|
+
export async function planWrunEtfHoldingsInput(source, ctx) {
|
|
121
|
+
const fund = source.fund;
|
|
122
|
+
if (fund === undefined) {
|
|
123
|
+
return refuseWrunPollInput(ctx, `declares no fund: declare the ETF ticker (IBIT, FBTC, ETHA, ...) or '${WRUN_ETF_HOLDINGS_ALL_FUNDS}' for the sum over the chart coin's funds`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
124
|
+
}
|
|
125
|
+
if (!isWrunEtfFlowFund(fund)) {
|
|
126
|
+
return refuseWrunPollInput(ctx, `declares fund '${fund}': not an ETF ticker (1 to 10 upper-case letters, digits or dots, e.g. IBIT) or '${WRUN_ETF_HOLDINGS_ALL_FUNDS}'`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
127
|
+
}
|
|
128
|
+
const coin = wrunEtfHoldingsCoinWord(ctx.coin);
|
|
129
|
+
// The native ETF indicators' covered-coin gate (its leaf, loaded lazily as the constants module
|
|
130
|
+
// it was split from was: the load's boundary and timing hold).
|
|
131
|
+
const { ETF_COVERED_COINS } = await import('../../../../constants/etf-covered-coins.constants.js');
|
|
132
|
+
if (coin === '') {
|
|
133
|
+
return refuseWrunPollInput(ctx, `needs the chart's coin to pick the ETF family, and this chart has none`, wrunPollCoinGateSeed(WRUN_ETF_HOLDINGS_LANE_KEY, ETF_COVERED_COINS, ''));
|
|
134
|
+
}
|
|
135
|
+
if (!ETF_COVERED_COINS.includes(coin)) {
|
|
136
|
+
return refuseWrunPollInput(ctx, `needs a chart of a coin with listed spot ETFs (${ETF_COVERED_COINS.join(', ')}): this chart's coin is ${coin}`, wrunPollCoinGateSeed(WRUN_ETF_HOLDINGS_LANE_KEY, ETF_COVERED_COINS, coin));
|
|
137
|
+
}
|
|
138
|
+
if (!(ctx.intervalMs < WRUN_ETF_HOLDINGS_MAX_INTERVAL_MS)) {
|
|
139
|
+
const label = await chartIntervalLabel(ctx.intervalMs);
|
|
140
|
+
return refuseWrunPollInput(ctx, `needs a chart finer than a week (ETF holdings are reported per day, served on intraday and daily charts): this chart's interval is ${chartIntervalWord(ctx.intervalMs, label)}`, intervalGateSeed('coarse', WRUN_ETF_HOLDINGS_MAX_INTERVAL, label));
|
|
141
|
+
}
|
|
142
|
+
if (!(ctx.intervalMs >= WRUN_ETF_HOLDINGS_MIN_INTERVAL_MS)) {
|
|
143
|
+
const label = await chartIntervalLabel(ctx.intervalMs);
|
|
144
|
+
return refuseWrunPollInput(ctx, `needs a 1m or coarser chart (ETF holdings are reported per day, served on intraday and daily charts): this chart's interval is ${chartIntervalWord(ctx.intervalMs, label)}`, intervalGateSeed('fine', WRUN_ETF_HOLDINGS_MIN_INTERVAL, label));
|
|
145
|
+
}
|
|
146
|
+
const tickers = await resolveWrunEtfHoldingsTickers(coin);
|
|
147
|
+
if (tickers.length === 0) {
|
|
148
|
+
return refuseWrunPollInput(ctx, `needs a chart of a coin with listed spot ETFs: no spot ETF holdings are listed for ${coin}`, { cls: 'feed-missing', variant: 'market-paused', params: { feed: WRUN_ETF_HOLDINGS_LANE_KEY } });
|
|
149
|
+
}
|
|
150
|
+
if (fund === WRUN_ETF_HOLDINGS_ALL_FUNDS)
|
|
151
|
+
return { symbol: tickers[0], symbols: [...tickers], coin };
|
|
152
|
+
if (!tickers.includes(fund)) {
|
|
153
|
+
return refuseWrunPollInput(ctx, `pins fund '${fund}', not one of the ${coin} spot ETFs (${tickers.join(', ')}); declare one of them or '${WRUN_ETF_HOLDINGS_ALL_FUNDS}'`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
154
|
+
}
|
|
155
|
+
return { symbol: fund, symbols: [fund], coin };
|
|
156
|
+
}
|
|
157
|
+
export const lane = {
|
|
158
|
+
sourceClass: WRUN_ETF_HOLDINGS_SOURCE,
|
|
159
|
+
laneKey: WRUN_ETF_HOLDINGS_LANE_KEY,
|
|
160
|
+
kType: WRUN_ETF_HOLDINGS_K_TYPE,
|
|
161
|
+
fields: { [WRUN_ETF_HOLDINGS_FIELD]: 1 },
|
|
162
|
+
plan: planWrunEtfHoldingsInput,
|
|
163
|
+
join: 'bar',
|
|
164
|
+
label: 'ETF holdings',
|
|
165
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type WrunPollLane } from '../wrun-poll-lane.types.js';
|
|
2
|
+
/** The days before the chart window the full run's ask opens: a week always holds a US trading
|
|
3
|
+
* day (the longest regular closure is four calendar days), at the cost of at most seven day rows. */
|
|
4
|
+
export declare const WRUN_ETF_PREMIUM_LOOKBACK_DAYS = 7;
|
|
5
|
+
/** A listed spot ETF of a coin: its ticker and the issuer the premium-rate ask names. */
|
|
6
|
+
export interface WrunEtfPremiumFund {
|
|
7
|
+
ticker: string;
|
|
8
|
+
/** Undefined when the metadata lists the fund without an issuer. */
|
|
9
|
+
issuer: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
/** The chart's coin as the ETF family spells it: upper-cased, BitMEX's XBT read as BTC (the native
|
|
12
|
+
* ETF premium indicator's own rule); '' when the chart has none. */
|
|
13
|
+
export declare function wrunEtfPremiumFamilyCoin(coin: unknown): string;
|
|
14
|
+
/** The funds the metadata lists for a coin's spot-ETF metrics (StreamMarkets type ETF_METRICS by
|
|
15
|
+
* coin, the native ETF premium indicator's own lookup), in the metadata's order, one per ticker,
|
|
16
|
+
* each with its issuer (`issuer`, else the row's `exchange`, as the indicator reads it). Lazy:
|
|
17
|
+
* the service and the proto enums load on demand. */
|
|
18
|
+
export declare function resolveWrunEtfPremiumFunds(coin: string): Promise<WrunEtfPremiumFund[]>;
|
|
19
|
+
export declare const lane: WrunPollLane;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `etf_premium` poll lane: one spot ETF's premium to its net asset value, in percent, off
|
|
3
|
+
* the chart's `K_ETF_PREMIUM_RATE` control (the fetch rides `kType` `etf_premium_rate`). The
|
|
4
|
+
* control asks `ETF_PREMIUM_RATE_AGG` for ONE fund (`rawSymbol` the ticker, `coin` the fund's
|
|
5
|
+
* underlying, `issuer` the fund's issuer, which the gateway requires: an issuer-less ask answers
|
|
6
|
+
* empty) and answers `[dayTs, premiumRate]` rows, sparse: a row only where the gateway has a
|
|
7
|
+
* value (a US trading day; none on weekends and holidays).
|
|
8
|
+
*
|
|
9
|
+
* The contract (the om kit freezes the words): class `etf_premium`, field `premium_rate`, knob
|
|
10
|
+
* `fund` REQUIRED, one ETF ticker (`IBIT`, `ETHA`, `SSK`, ...; `all` is refused by the kit and
|
|
11
|
+
* here, a rate does not sum). The coin is the chart market's: a chart of a coin with no listed
|
|
12
|
+
* spot ETFs refuses by name before any fetch (`ETF_COVERED_COINS` first, then the metadata's own
|
|
13
|
+
* fund list), and so does a ticker the coin does not list (the message names the coin's funds).
|
|
14
|
+
* The issuer is resolved lazily in `plan` from the metadata's ETF_METRICS market list (the native
|
|
15
|
+
* ETF premium indicator's own lookup, session-cached by the metadata service), and the plan
|
|
16
|
+
* answers `{ symbol, coin, issuer }`, the fields the control reads, so inputs declaring one fund
|
|
17
|
+
* share ONE fetch and one buffer, and two funds fetch separately.
|
|
18
|
+
*
|
|
19
|
+
* A DAILY lane (wrun-daily-lane.util), landing `last`: fetched at `1d` on every chart (the
|
|
20
|
+
* control honors `settings.interval`), the day's value lands on the first bar of its day on an
|
|
21
|
+
* intraday chart, row for row on a daily chart, and a coarser bar reads its last day that
|
|
22
|
+
* reported; under the default `carry` policy a bar with no observation of its own reads the
|
|
23
|
+
* newest value at or before its day (`nan` and `zero` keep the one-bar landing). `lookbackDays`
|
|
24
|
+
* opens the full run's ask a week before the chart window, so a window whose head falls on a
|
|
25
|
+
* weekend or a holiday still reads the last trading day's value from its first bar (the longest
|
|
26
|
+
* regular US market closure is four calendar days, a holiday beside a weekend).
|
|
27
|
+
*
|
|
28
|
+
* Each refusal carries its record's seed: the fund and issuer gates are a failed run (the author's
|
|
29
|
+
* to fix), the coin gate names the lane, the covered coins and the chart's coin, and a coin the
|
|
30
|
+
* metadata lists no fund for has no such feed on its market.
|
|
31
|
+
*
|
|
32
|
+
* The om daemon has no ETF premium client and refuses the class by name
|
|
33
|
+
* (`wrun_etf_premium_unsupported`).
|
|
34
|
+
*/
|
|
35
|
+
import { wrunChartHostEnv } from '../../../../host-env.js';
|
|
36
|
+
import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED, wrunPollCoinGateSeed, } from '../wrun-poll-lane.types.js';
|
|
37
|
+
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.etfPremium`). */
|
|
38
|
+
const WRUN_ETF_PREMIUM_LANE_KEY = 'etf_premium';
|
|
39
|
+
/** The `fund` word the sum sources accept and a rate refuses. */
|
|
40
|
+
const ALL_FUNDS = 'all';
|
|
41
|
+
/** The days before the chart window the full run's ask opens: a week always holds a US trading
|
|
42
|
+
* day (the longest regular closure is four calendar days), at the cost of at most seven day rows. */
|
|
43
|
+
export const WRUN_ETF_PREMIUM_LOOKBACK_DAYS = 7;
|
|
44
|
+
const text = (value) => (typeof value === 'string' ? value : '');
|
|
45
|
+
/** The chart's coin as the ETF family spells it: upper-cased, BitMEX's XBT read as BTC (the native
|
|
46
|
+
* ETF premium indicator's own rule); '' when the chart has none. */
|
|
47
|
+
export function wrunEtfPremiumFamilyCoin(coin) {
|
|
48
|
+
const word = text(coin).trim().toUpperCase();
|
|
49
|
+
return word === 'XBT' ? 'BTC' : word;
|
|
50
|
+
}
|
|
51
|
+
/** The funds the metadata lists for a coin's spot-ETF metrics (StreamMarkets type ETF_METRICS by
|
|
52
|
+
* coin, the native ETF premium indicator's own lookup), in the metadata's order, one per ticker,
|
|
53
|
+
* each with its issuer (`issuer`, else the row's `exchange`, as the indicator reads it). Lazy:
|
|
54
|
+
* the service and the proto enums load on demand. */
|
|
55
|
+
export async function resolveWrunEtfPremiumFunds(coin) {
|
|
56
|
+
const [{ default: metadataService }, { Type }] = await Promise.all([
|
|
57
|
+
wrunChartHostEnv().market.loadMetadataService(),
|
|
58
|
+
import('@orangecharts/orange-v2-pb-common'),
|
|
59
|
+
]);
|
|
60
|
+
const markets = (await metadataService.getMarkets({
|
|
61
|
+
type: [Type.ETF_METRICS],
|
|
62
|
+
coin: [coin],
|
|
63
|
+
excludePrices: true,
|
|
64
|
+
}));
|
|
65
|
+
const funds = [];
|
|
66
|
+
for (const market of markets ?? []) {
|
|
67
|
+
const ticker = text(market.rawSymbol) || text(market.symbol);
|
|
68
|
+
if (ticker === '' || funds.some((fund) => fund.ticker === ticker))
|
|
69
|
+
continue;
|
|
70
|
+
const issuer = text(market.issuer) || text(market.exchange);
|
|
71
|
+
funds.push({ ticker, issuer: issuer === '' ? undefined : issuer });
|
|
72
|
+
}
|
|
73
|
+
return funds;
|
|
74
|
+
}
|
|
75
|
+
export const lane = {
|
|
76
|
+
sourceClass: 'etf_premium',
|
|
77
|
+
laneKey: WRUN_ETF_PREMIUM_LANE_KEY,
|
|
78
|
+
kType: 'etf_premium_rate',
|
|
79
|
+
fields: { premium_rate: 1 },
|
|
80
|
+
async plan(source, ctx) {
|
|
81
|
+
const fund = source.fund;
|
|
82
|
+
if (typeof fund !== 'string' || fund === '') {
|
|
83
|
+
return refuseWrunPollInput(ctx, 'declares no fund: declare the ETF ticker (IBIT, ETHA, ...) whose premium to its net asset value the input reads', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
84
|
+
}
|
|
85
|
+
if (fund === ALL_FUNDS) {
|
|
86
|
+
return refuseWrunPollInput(ctx, `declares fund '${ALL_FUNDS}': a premium rate does not sum across funds, declare one ETF ticker (IBIT, ETHA, ...)`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
87
|
+
}
|
|
88
|
+
const coin = wrunEtfPremiumFamilyCoin(ctx.coin);
|
|
89
|
+
// The native ETF indicators' covered-coin gate (its leaf, loaded lazily as the constants module
|
|
90
|
+
// it was split from was: the load's boundary and timing hold).
|
|
91
|
+
const { ETF_COVERED_COINS } = await import('../../../../constants/etf-covered-coins.constants.js');
|
|
92
|
+
if (coin === '') {
|
|
93
|
+
return refuseWrunPollInput(ctx, "needs the chart's coin to pick the ETF family, and this chart has none", wrunPollCoinGateSeed(WRUN_ETF_PREMIUM_LANE_KEY, ETF_COVERED_COINS, ''));
|
|
94
|
+
}
|
|
95
|
+
if (!ETF_COVERED_COINS.includes(coin)) {
|
|
96
|
+
return refuseWrunPollInput(ctx, `needs a chart of a coin with listed spot ETFs (${ETF_COVERED_COINS.join(', ')}): this chart's coin is ${coin}`, wrunPollCoinGateSeed(WRUN_ETF_PREMIUM_LANE_KEY, ETF_COVERED_COINS, coin));
|
|
97
|
+
}
|
|
98
|
+
const funds = await resolveWrunEtfPremiumFunds(coin);
|
|
99
|
+
if (funds.length === 0) {
|
|
100
|
+
return refuseWrunPollInput(ctx, `needs a chart of a coin with listed spot ETFs: no spot ETFs are listed for ${coin}`, { cls: 'feed-missing', variant: 'market-paused', params: { feed: WRUN_ETF_PREMIUM_LANE_KEY } });
|
|
101
|
+
}
|
|
102
|
+
const listed = funds.find((candidate) => candidate.ticker === fund);
|
|
103
|
+
if (listed === undefined) {
|
|
104
|
+
return refuseWrunPollInput(ctx, `pins fund '${fund}', not one of the ${coin} spot ETFs (${funds.map((candidate) => candidate.ticker).join(', ')}); declare one of them`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
105
|
+
}
|
|
106
|
+
if (listed.issuer === undefined) {
|
|
107
|
+
return refuseWrunPollInput(ctx, `pins fund '${fund}', whose issuer the metadata does not list, and the premium rate is served per issuer`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
108
|
+
}
|
|
109
|
+
return { symbol: listed.ticker, coin, issuer: listed.issuer };
|
|
110
|
+
},
|
|
111
|
+
join: { kind: 'daily', landing: 'last', lookbackDays: WRUN_ETF_PREMIUM_LOOKBACK_DAYS },
|
|
112
|
+
interval: '1d',
|
|
113
|
+
label: 'ETF premium rate',
|
|
114
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { type WrunPollLane, type WrunPollLaneContext } from '../wrun-poll-lane.types.js';
|
|
19
|
+
/** The coins the control maps venue legs for (`KEthenaPositionsControl.EXCHANGE_MAPPINGS`). */
|
|
20
|
+
export declare const WRUN_ETHENA_POSITIONS_COINS: readonly string[];
|
|
21
|
+
/**
|
|
22
|
+
* Refuse by name unless the chart's coin is one Ethena holds collateral in (the coin gate's record:
|
|
23
|
+
* the lane, its coins, the chart's coin; the market words when the chart names no coin); answer
|
|
24
|
+
* the one payload field the control reads, as the placeholder the chart's fetch resolves to the
|
|
25
|
+
* chart's coin.
|
|
26
|
+
*/
|
|
27
|
+
export declare function planWrunEthenaPositionsInput(ctx: WrunPollLaneContext): {
|
|
28
|
+
coin: 'currentCoin';
|
|
29
|
+
};
|
|
30
|
+
export declare const lane: WrunPollLane;
|