@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,63 @@
|
|
|
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 { 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.optionsVolume`). */
|
|
20
|
+
const WRUN_OPTIONS_VOLUME_LANE_KEY = 'options_volume';
|
|
21
|
+
/** The `venue` knob's words, in the kit's order (WRUN_OPTIONS_FLOW_VENUES; the main thread
|
|
22
|
+
* never loads the kit bundle, the lane spec pins the copy). */
|
|
23
|
+
export const WRUN_OPTIONS_VOLUME_VENUES = ['deribit', 'binance'];
|
|
24
|
+
/** The venue an absent knob reads. */
|
|
25
|
+
export const WRUN_OPTIONS_VOLUME_DEFAULT_VENUE = 'deribit';
|
|
26
|
+
/** Each venue word to the exchange the K control reads (`settings.exchange`, the one entry of
|
|
27
|
+
* the worker's `exchanges`). */
|
|
28
|
+
export const WRUN_OPTIONS_VOLUME_EXCHANGES = Object.freeze({
|
|
29
|
+
deribit: 'DERIBIT',
|
|
30
|
+
binance: 'BINANCE_OPTIONS',
|
|
31
|
+
});
|
|
32
|
+
/** The chart coins the worker serves, spelled as the chart holds them (any other coin ends the
|
|
33
|
+
* worker's stream with no rows). */
|
|
34
|
+
export const WRUN_OPTIONS_VOLUME_COINS = Object.freeze(['BTC', 'ETH']);
|
|
35
|
+
function isOptionsVolumeVenue(word) {
|
|
36
|
+
return typeof word === 'string' && WRUN_OPTIONS_VOLUME_VENUES.includes(word);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Validate one `options_volume` input against the chart before any fetch and answer the ask's
|
|
40
|
+
* payload fields: the coin placeholder and the venue's exchange. Refused by name: a `venue`
|
|
41
|
+
* word outside the kit's two (a failed run, the author's to fix), then a chart whose coin is not
|
|
42
|
+
* BTC or ETH (the coin gate's record: the lane, its coins, the chart's coin).
|
|
43
|
+
*/
|
|
44
|
+
export function planWrunOptionsVolume(source, ctx) {
|
|
45
|
+
const venue = source.venue;
|
|
46
|
+
const word = venue === undefined ? WRUN_OPTIONS_VOLUME_DEFAULT_VENUE : venue;
|
|
47
|
+
if (!isOptionsVolumeVenue(word)) {
|
|
48
|
+
return refuseWrunPollInput(ctx, `declares venue '${String(venue)}': declare "deribit" or "binance" (absent reads ${WRUN_OPTIONS_VOLUME_DEFAULT_VENUE})`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
49
|
+
}
|
|
50
|
+
if (!WRUN_OPTIONS_VOLUME_COINS.includes(ctx.coin)) {
|
|
51
|
+
return refuseWrunPollInput(ctx, `needs a BTC or ETH chart: this chart's coin is ${ctx.coin || 'unknown'}`, wrunPollCoinGateSeed(WRUN_OPTIONS_VOLUME_LANE_KEY, WRUN_OPTIONS_VOLUME_COINS, ctx.coin));
|
|
52
|
+
}
|
|
53
|
+
return { coin: 'currentCoin', exchange: WRUN_OPTIONS_VOLUME_EXCHANGES[word] };
|
|
54
|
+
}
|
|
55
|
+
export const lane = {
|
|
56
|
+
sourceClass: 'options_volume',
|
|
57
|
+
laneKey: WRUN_OPTIONS_VOLUME_LANE_KEY,
|
|
58
|
+
kType: 'options_volume',
|
|
59
|
+
fields: { puts: 1, calls: 2 },
|
|
60
|
+
plan: planWrunOptionsVolume,
|
|
61
|
+
join: 'bar',
|
|
62
|
+
label: 'Options volume',
|
|
63
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { FeedCombineRule } from '../../../../interfaces/feed.interface.js';
|
|
2
|
+
import type { WrunIndicatorMetadata } from '../../../../interfaces/wrun-runtime.interface.js';
|
|
3
|
+
import { type WrunPollLane, type WrunPollLaneContext, type WrunPollLaneFetchAsk, type WrunPollLaneLiveAsk, type WrunPollLaneLiveSink, type WrunPollLaneLiveSubscription, type WrunPollLaneSource } from '../wrun-poll-lane.types.js';
|
|
4
|
+
export declare const WRUN_SERIES_SOURCE = "series";
|
|
5
|
+
/** The lane key: the stem of its fetch key and buffer, and the refusal record's feed word. */
|
|
6
|
+
export declare const WRUN_SERIES_LANE_KEY = "series";
|
|
7
|
+
/** The short form's member (`series.value`). */
|
|
8
|
+
export declare const WRUN_SERIES_FIELD = "value";
|
|
9
|
+
/** P4's poll period: never more often than every 10 s, half a cadence otherwise, an irregular
|
|
10
|
+
* feed (cadence 0) every 60 s. */
|
|
11
|
+
export declare const WRUN_SERIES_POLL_FLOOR_MS = 10000;
|
|
12
|
+
export declare const WRUN_SERIES_IRREGULAR_POLL_MS = 60000;
|
|
13
|
+
/** The ask a `series` input plans into: the feed, its cadence (the poll period's input) and, when
|
|
14
|
+
* the head names it, its first value key's combine rule (whether a stream reading stands for its
|
|
15
|
+
* bucket). */
|
|
16
|
+
export type WrunSeriesExtras = {
|
|
17
|
+
ref: string;
|
|
18
|
+
cadence_s: number;
|
|
19
|
+
combine?: FeedCombineRule;
|
|
20
|
+
};
|
|
21
|
+
/** The declaration a `plan` last judged a feed under, per feed and chart grid: its head's version
|
|
22
|
+
* and the facts the plan's answer carries. */
|
|
23
|
+
export type WrunSeriesPlannedHead = {
|
|
24
|
+
version: number;
|
|
25
|
+
cadence_s: number;
|
|
26
|
+
combine?: FeedCombineRule;
|
|
27
|
+
};
|
|
28
|
+
/** The declaration the newest `plan` of this feed on this grid judged (the live channel's baseline:
|
|
29
|
+
* a stream head of a newer version re-plans the session), or undefined when none planned it. */
|
|
30
|
+
export declare function wrunSeriesPlannedHead(ref: string, intervalMs: number): WrunSeriesPlannedHead | undefined;
|
|
31
|
+
/** Forget every planned declaration (specs only). */
|
|
32
|
+
export declare function __resetWrunSeriesPlannedHeadsForTests(): void;
|
|
33
|
+
/** A ref as a feed address, or undefined for anything else (trimmed; the grammar is lower case). */
|
|
34
|
+
export declare function wrunSeriesFeedAddress(ref: unknown): string | undefined;
|
|
35
|
+
/** The poll period of a feed of this cadence (seconds), ms: `max(10 s, cadence / 2)`, 60 s for an
|
|
36
|
+
* irregular feed (P4). */
|
|
37
|
+
export declare function wrunSeriesPollMs(cadenceS: unknown): number;
|
|
38
|
+
/**
|
|
39
|
+
* The feeds a sheet reads, once each, in declaration order: the address of every `series` input
|
|
40
|
+
* (the install card's "Reads feed @scope/name" lines, P4). Read off the sheet's declarations, never
|
|
41
|
+
* the manifest; a ref that is no feed address (the daemon form) is no feed the chart reads.
|
|
42
|
+
*/
|
|
43
|
+
export declare function wrunSeriesFeedReads(sheet: Partial<Pick<WrunIndicatorMetadata, 'inputs' | 'inputSources'>> | null | undefined): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Validate one `series` input against the chart BEFORE any fetch and answer the feed and its
|
|
46
|
+
* cadence, or refuse by name (the module doc's order: the flag, the ref, the interval, the head).
|
|
47
|
+
*/
|
|
48
|
+
export declare function planWrunSeriesInput(source: WrunPollLaneSource, ctx: WrunPollLaneContext): Promise<WrunSeriesExtras>;
|
|
49
|
+
/**
|
|
50
|
+
* The lane's own fetch: the relay's bars of the feed on the ask's grid, from one interval before
|
|
51
|
+
* the window (the carry seed) through its last bar, as `[bucket_ts * 1000, value]` rows, ascending:
|
|
52
|
+
* the bucket's `combined` value (position 6, P3 C7: the key's rule over the bucket's slots) when the
|
|
53
|
+
* relay sends it, else its close (position 4, the last reading). A bar without a numeric value (a
|
|
54
|
+
* state feed's `[bucket, state, count]`, a bucket of nulls) is no reading. A long window spans
|
|
55
|
+
* several pages (the relay answers at most 5,000 intervals a page): each next one is asked from the
|
|
56
|
+
* page's `next_from`. The ask hears whether the answer is the whole window (`onComplete`): a last
|
|
57
|
+
* page that still says `has_more` (no later start, or one that does not move forward) ended early.
|
|
58
|
+
*/
|
|
59
|
+
export declare function fetchWrunSeriesRows(ask: WrunPollLaneFetchAsk): Promise<number[][]>;
|
|
60
|
+
/**
|
|
61
|
+
* The lane's live channel (P3 C10): the feed's stream (wrun-series-stream.util
|
|
62
|
+
* `openWrunSeriesStream`), loaded with the first session that reads a feed, so the registry's
|
|
63
|
+
* import graph never carries the stream client. The handle answers at once: not up until the
|
|
64
|
+
* stream module loaded and the stream carries the feed; one closed meanwhile closes what opens.
|
|
65
|
+
*/
|
|
66
|
+
export declare function subscribeWrunSeriesLive(ask: WrunPollLaneLiveAsk, sink: WrunPollLaneLiveSink): WrunPollLaneLiveSubscription;
|
|
67
|
+
export declare const lane: WrunPollLane;
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `series` poll lane: a published feed (LIVE-SERIES, the relay's feed ledger at `@scope/name`)
|
|
3
|
+
* as one scalar per chart bar, in the feed's own unit. The chart's half of contracts P1, P2 and P4
|
|
4
|
+
* (`~/WebstormProjects/LIVE-SERIES-P2-CONTRACTS.md`).
|
|
5
|
+
*
|
|
6
|
+
* No K control serves it: the lane fetches its own rows (`fetch`, the poll-lane contract's hook),
|
|
7
|
+
* the relay's bars regrouped on the run's grid (`GET /api/v2/feeds/{scope}/{name}/bars?interval_s=`
|
|
8
|
+
* through `src/services/feeds.service.ts`): one bar per UTC bucket of the chart interval that holds
|
|
9
|
+
* readings, its close the bucket's LAST reading, empty buckets absent. The relay's regroup IS the
|
|
10
|
+
* bucket rule (P2), so the lane never buckets: a bar lands as `[bucket_ts * 1000, close]` on the
|
|
11
|
+
* chart bar opening at its bucket (an exact join; the relay opens a week on Monday 00:00 UTC, as
|
|
12
|
+
* the chart's weekly candles do), and the input's `missing` policy fills the bars with no reading
|
|
13
|
+
* of their own (`carry` repeats the last one, `nan` reads NaN). The ask opens one interval before
|
|
14
|
+
* the window, so the bar before it is the carry seed (P2): the row builder plans the read as the
|
|
15
|
+
* kit's own `series` wire (wrun-source-rows.util `wrunPlannedSheet`), and the shared host's align
|
|
16
|
+
* rule e lands that bar on the leading chart bars a `carry` input holds no reading of its own for.
|
|
17
|
+
*
|
|
18
|
+
* Knobs (the kit's, P1): `ref`, the feed address `@scope/name` (the chart profiles read published
|
|
19
|
+
* feeds only; the daemon form `watch/<slug>/<key>` reads on the person's OpenMarket runner and
|
|
20
|
+
* refuses here by name), and `missing` (`carry` | `nan`). The sheet's series input names no field
|
|
21
|
+
* (the kit allows `ref` and `missing` alone on it) or `value` (the short form's member): both read
|
|
22
|
+
* column 1. Phase 2 reads the feed's FIRST value key, the relay's default for a bars read.
|
|
23
|
+
*
|
|
24
|
+
* `plan`, before any fetch, refuses by name: the Feeds flag off (wrun-source-rows.util
|
|
25
|
+
* `wrunBrowserReadsFeeds`: the run then advertises no `wrun-feed-v1`, the kit's feed capability,
|
|
26
|
+
* and the shared host's chart profile would refuse the class `wrun_source_unsupported`), a missing
|
|
27
|
+
* ref or one that is no feed address (the daemon form named), a chart interval the relay does not
|
|
28
|
+
* regroup on (P2), then, off the feed's head: a relay error (the relay's own words and code), a
|
|
29
|
+
* state feed (P1: not numeric, the head's declared states or no value key), an exact-interval feed
|
|
30
|
+
* on a chart at another interval than its cadence (P3 C10: published at its cadence only, the
|
|
31
|
+
* relay regroups it on no other; "Try the <cadence> chart") and a feed with no readings yet. It
|
|
32
|
+
* answers `{ ref, cadence_s }` and, when the head names it, the first value key's combine rule
|
|
33
|
+
* (`combine`, P3 C7), so two inputs reading one feed share one fetch.
|
|
34
|
+
*
|
|
35
|
+
* A bucket's value is the relay's: since P3 a bars row carries `combined` (position 6), the key's
|
|
36
|
+
* rule applied over the bucket's slots (`sum` adds, `mean` averages, `last` is the close), read in
|
|
37
|
+
* place of the close (position 4) when present.
|
|
38
|
+
*
|
|
39
|
+
* Not `global`: the registry admits a global lane on a daily join only, and an exact join against
|
|
40
|
+
* a session grid (a stock's 13:30 bars against the relay's UTC buckets) would never land, so an
|
|
41
|
+
* index-mode chart refuses it before `plan`, by the planner's own words. Live, the feed's stream
|
|
42
|
+
* (P3 C10, `live`: wrun-series-stream.util) folds every reading into the buffer, newest per bucket,
|
|
43
|
+
* and computes without a fetch; the poll reconcile re-asks the lane through `fetch` on a reopen of
|
|
44
|
+
* the stream (a wake), for a span the stream may have skipped or a join that may have missed
|
|
45
|
+
* readings (owed, asked by the next routine poll), and a routine poll, no sooner than its poll
|
|
46
|
+
* period (`pollIntervalMs`, `wrunSeriesPollMs`: P4), while the stream is down. A newer declaration
|
|
47
|
+
* on the stream (a head of a newer version than the one `plan` judged, `wrunSeriesPlannedHead`)
|
|
48
|
+
* ends the channel and re-plans the session. `wrunSeriesFeedReads` lists the feeds a sheet reads,
|
|
49
|
+
* the install card's "Reads feed @scope/name" lines (P4: from the sheet's declarations, never the
|
|
50
|
+
* manifest).
|
|
51
|
+
*
|
|
52
|
+
* LIGHT at module load (the registry's rule): the relay client, the flag and the interval words
|
|
53
|
+
* are imported inside `plan` and `fetch`, the stream and its session side inside `live`.
|
|
54
|
+
*/
|
|
55
|
+
import { wrunChartHostEnv } from '../../../../host-env.js';
|
|
56
|
+
import { FEED_BAR_INTERVALS_S } from '../../../chart/feed-interval.util.js';
|
|
57
|
+
import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED, } from '../wrun-poll-lane.types.js';
|
|
58
|
+
export const WRUN_SERIES_SOURCE = 'series';
|
|
59
|
+
/** The lane key: the stem of its fetch key and buffer, and the refusal record's feed word. */
|
|
60
|
+
export const WRUN_SERIES_LANE_KEY = 'series';
|
|
61
|
+
/** The short form's member (`series.value`). */
|
|
62
|
+
export const WRUN_SERIES_FIELD = 'value';
|
|
63
|
+
/** The sheet's own form names no field: the poll planner reads an absent field as ''. */
|
|
64
|
+
const WRUN_SERIES_FIELDLESS = '';
|
|
65
|
+
/** A feed address on the chart profiles (P1, the kit's scope and name grammar). */
|
|
66
|
+
const WRUN_FEED_ADDRESS_RE = /^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/;
|
|
67
|
+
/** The daemon form (`watch/<slug>/<key>`, P1): a watch series, read on the person's runner. */
|
|
68
|
+
const WRUN_WATCH_SERIES_RE = /^watch\//;
|
|
69
|
+
/** The chart intervals the relay regroups bars on (C2, P2), in its words for the refusal. */
|
|
70
|
+
const WRUN_SERIES_INTERVAL_WORDS = '1m, 5m, 15m, 30m, 1h, 4h, 1D and 1W';
|
|
71
|
+
const WRUN_SERIES_FINEST_INTERVAL = '1m';
|
|
72
|
+
const WRUN_SERIES_FINEST_INTERVAL_MS = FEED_BAR_INTERVALS_S[0] * 1000;
|
|
73
|
+
const WRUN_SERIES_COARSEST_INTERVAL_MS = FEED_BAR_INTERVALS_S[FEED_BAR_INTERVALS_S.length - 1] * 1000;
|
|
74
|
+
/** P4's poll period: never more often than every 10 s, half a cadence otherwise, an irregular
|
|
75
|
+
* feed (cadence 0) every 60 s. */
|
|
76
|
+
export const WRUN_SERIES_POLL_FLOOR_MS = 10_000;
|
|
77
|
+
export const WRUN_SERIES_IRREGULAR_POLL_MS = 60_000;
|
|
78
|
+
const plannedHeads = new Map();
|
|
79
|
+
/** The declaration the newest `plan` of this feed on this grid judged (the live channel's baseline:
|
|
80
|
+
* a stream head of a newer version re-plans the session), or undefined when none planned it. */
|
|
81
|
+
export function wrunSeriesPlannedHead(ref, intervalMs) {
|
|
82
|
+
return plannedHeads.get(`${ref}|${intervalMs}`);
|
|
83
|
+
}
|
|
84
|
+
/** Forget every planned declaration (specs only). */
|
|
85
|
+
export function __resetWrunSeriesPlannedHeadsForTests() {
|
|
86
|
+
plannedHeads.clear();
|
|
87
|
+
}
|
|
88
|
+
/** A ref as a feed address, or undefined for anything else (trimmed; the grammar is lower case). */
|
|
89
|
+
export function wrunSeriesFeedAddress(ref) {
|
|
90
|
+
const text = typeof ref === 'string' ? ref.trim() : '';
|
|
91
|
+
return WRUN_FEED_ADDRESS_RE.test(text) ? text : undefined;
|
|
92
|
+
}
|
|
93
|
+
/** The poll period of a feed of this cadence (seconds), ms: `max(10 s, cadence / 2)`, 60 s for an
|
|
94
|
+
* irregular feed (P4). */
|
|
95
|
+
export function wrunSeriesPollMs(cadenceS) {
|
|
96
|
+
const cadence = typeof cadenceS === 'number' && Number.isFinite(cadenceS) && cadenceS > 0 ? cadenceS : 0;
|
|
97
|
+
if (cadence === 0)
|
|
98
|
+
return WRUN_SERIES_IRREGULAR_POLL_MS;
|
|
99
|
+
return Math.max(WRUN_SERIES_POLL_FLOOR_MS, (cadence * 1000) / 2);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The feeds a sheet reads, once each, in declaration order: the address of every `series` input
|
|
103
|
+
* (the install card's "Reads feed @scope/name" lines, P4). Read off the sheet's declarations, never
|
|
104
|
+
* the manifest; a ref that is no feed address (the daemon form) is no feed the chart reads.
|
|
105
|
+
*/
|
|
106
|
+
export function wrunSeriesFeedReads(sheet) {
|
|
107
|
+
const sources = (sheet?.inputSources ?? {});
|
|
108
|
+
const names = Array.isArray(sheet?.inputs)
|
|
109
|
+
? [...sheet.inputs].sort((a, b) => a.index - b.index).map((input) => input.name)
|
|
110
|
+
: Object.keys(sources);
|
|
111
|
+
const reads = [];
|
|
112
|
+
for (const name of names) {
|
|
113
|
+
const source = sources[name];
|
|
114
|
+
if (source?.source !== WRUN_SERIES_SOURCE)
|
|
115
|
+
continue;
|
|
116
|
+
const address = wrunSeriesFeedAddress(source.ref);
|
|
117
|
+
if (address !== undefined && !reads.includes(address))
|
|
118
|
+
reads.push(address);
|
|
119
|
+
}
|
|
120
|
+
return reads;
|
|
121
|
+
}
|
|
122
|
+
/** A chart interval in the refusal's words: the picker's, else whole days or seconds. */
|
|
123
|
+
function chartIntervalWord(intervalMs, label) {
|
|
124
|
+
if (label !== undefined)
|
|
125
|
+
return label;
|
|
126
|
+
const day = 86_400_000;
|
|
127
|
+
if (intervalMs >= day)
|
|
128
|
+
return `${Math.round(intervalMs / day)} days`;
|
|
129
|
+
return `${Math.max(1, Math.round(intervalMs / 1000))}s`;
|
|
130
|
+
}
|
|
131
|
+
/** The refusal seed of a chart interval the relay does not regroup on: a sub-minute chart's way
|
|
132
|
+
* out is 1m, a chart coarser than a week's the coarsest finer one; between the served ones (2h, 3m)
|
|
133
|
+
* there is no one interval to name. */
|
|
134
|
+
function intervalGateSeed(intervalMs, label) {
|
|
135
|
+
const chartInterval = label !== undefined ? { chartInterval: label } : {};
|
|
136
|
+
if (intervalMs < WRUN_SERIES_FINEST_INTERVAL_MS) {
|
|
137
|
+
return {
|
|
138
|
+
cls: 'interval-unserved',
|
|
139
|
+
variant: 'fine',
|
|
140
|
+
params: { feed: WRUN_SERIES_LANE_KEY, interval: WRUN_SERIES_FINEST_INTERVAL, ...chartInterval },
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (intervalMs > WRUN_SERIES_COARSEST_INTERVAL_MS && label !== undefined) {
|
|
144
|
+
return {
|
|
145
|
+
cls: 'interval-unserved',
|
|
146
|
+
variant: 'coarse',
|
|
147
|
+
params: { feed: WRUN_SERIES_LANE_KEY, interval: label, ...chartInterval },
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
/** A feed whose head declares states (the relay's own test: its rows carry a state, never a
|
|
153
|
+
* number, whatever value key it also lists) or no numeric value key: not numeric (P1). */
|
|
154
|
+
function isStateFeedHead(head) {
|
|
155
|
+
return head.states.length > 0 || head.values.length === 0;
|
|
156
|
+
}
|
|
157
|
+
/** The refusal seed of an exact-interval feed on a chart at another interval: the one way out is
|
|
158
|
+
* the chart at the feed's cadence ("Try the <cadence> chart"), worded from the side the chart sits
|
|
159
|
+
* on (a finer chart needs the cadence or coarser, a coarser one the cadence or finer). A cadence the
|
|
160
|
+
* relay does not regroup on has no chart that reads it: a failed run with the words. */
|
|
161
|
+
function exactIntervalSeed(cadenceS, chartS, cadenceLabel, chartLabel) {
|
|
162
|
+
if (cadenceLabel === undefined || !FEED_BAR_INTERVALS_S.includes(cadenceS))
|
|
163
|
+
return undefined;
|
|
164
|
+
const chartInterval = chartLabel !== undefined ? { chartInterval: chartLabel } : {};
|
|
165
|
+
void chartS;
|
|
166
|
+
// An exact feed is served on its own cadence only: the one sentence names that interval.
|
|
167
|
+
return {
|
|
168
|
+
cls: 'interval-unserved',
|
|
169
|
+
variant: 'exact',
|
|
170
|
+
params: { feed: WRUN_SERIES_LANE_KEY, interval: cadenceLabel, ...chartInterval },
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Validate one `series` input against the chart BEFORE any fetch and answer the feed and its
|
|
175
|
+
* cadence, or refuse by name (the module doc's order: the flag, the ref, the interval, the head).
|
|
176
|
+
*/
|
|
177
|
+
export async function planWrunSeriesInput(source, ctx) {
|
|
178
|
+
const { wrunBrowserReadsFeeds } = await import('../../wrun-source-rows.util.js');
|
|
179
|
+
if (!wrunBrowserReadsFeeds()) {
|
|
180
|
+
return refuseWrunPollInput(ctx, 'reads a feed, and feeds are switched off on this chart');
|
|
181
|
+
}
|
|
182
|
+
const declared = typeof source.ref === 'string' ? source.ref.trim() : '';
|
|
183
|
+
if (declared === '') {
|
|
184
|
+
return refuseWrunPollInput(ctx, 'declares no ref: declare the feed address, @scope/name', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
185
|
+
}
|
|
186
|
+
const ref = wrunSeriesFeedAddress(declared);
|
|
187
|
+
if (ref === undefined) {
|
|
188
|
+
return refuseWrunPollInput(ctx, WRUN_WATCH_SERIES_RE.test(declared)
|
|
189
|
+
? `declares ref '${declared}', a watch series: a watch series reads on your OpenMarket runner, and a chart reads a published feed (@scope/name)`
|
|
190
|
+
: `declares ref '${declared}': not a feed address (@scope/name)`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
191
|
+
}
|
|
192
|
+
const intervalS = ctx.intervalMs / 1000;
|
|
193
|
+
if (!FEED_BAR_INTERVALS_S.includes(intervalS)) {
|
|
194
|
+
const { intervalLabelForMs } = await import('../../../chart/interval-registry.util.js');
|
|
195
|
+
const label = intervalLabelForMs(ctx.intervalMs);
|
|
196
|
+
return refuseWrunPollInput(ctx, `reads feed ${ref} on a ${chartIntervalWord(ctx.intervalMs, label)} chart: feeds read on ${WRUN_SERIES_INTERVAL_WORDS} charts`, intervalGateSeed(ctx.intervalMs, label));
|
|
197
|
+
}
|
|
198
|
+
const { FeedsApiError, getFeedHead } = await wrunChartHostEnv().transport.loadFeedsService();
|
|
199
|
+
let head;
|
|
200
|
+
try {
|
|
201
|
+
head = await getFeedHead(ref);
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
const relay = error instanceof FeedsApiError ? error : undefined;
|
|
205
|
+
const words = error instanceof Error ? error.message : String(error);
|
|
206
|
+
const code = relay?.code ?? (relay ? `status ${relay.status}` : 'no answer');
|
|
207
|
+
// A relay that did not answer, or asked the reader to wait, may answer a second ask; a refused
|
|
208
|
+
// read (a private feed, no such feed) answers the same way again.
|
|
209
|
+
const transient = relay === undefined || relay.status === 0 || relay.status === 429 || relay.status >= 500;
|
|
210
|
+
return refuseWrunPollInput(ctx, `reads feed ${ref}, which the relay did not serve: ${words} (${code})`, transient ? { cls: 'service-no-answer', variant: 'global', params: { feed: WRUN_SERIES_LANE_KEY } } : undefined);
|
|
211
|
+
}
|
|
212
|
+
if (isStateFeedHead(head)) {
|
|
213
|
+
return refuseWrunPollInput(ctx, `reads feed ${ref}: state feeds are not numeric`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
214
|
+
}
|
|
215
|
+
// P3 C10: an exact-interval feed is published at its cadence only (the relay answers its bars at no
|
|
216
|
+
// other interval), refused before the bars on any other chart.
|
|
217
|
+
if (head.exact_interval === true && head.cadence_s > 0 && head.cadence_s !== intervalS) {
|
|
218
|
+
const { intervalLabelForMs } = await import('../../../chart/interval-registry.util.js');
|
|
219
|
+
const chartLabel = intervalLabelForMs(ctx.intervalMs);
|
|
220
|
+
const cadenceLabel = intervalLabelForMs(head.cadence_s * 1000);
|
|
221
|
+
return refuseWrunPollInput(ctx, `reads feed ${ref} on a ${chartIntervalWord(ctx.intervalMs, chartLabel)} chart: the feed is published at ${chartIntervalWord(head.cadence_s * 1000, cadenceLabel)} only`, exactIntervalSeed(head.cadence_s, intervalS, cadenceLabel, chartLabel));
|
|
222
|
+
}
|
|
223
|
+
if (!(head.rows > 0) || head.last_ts === null) {
|
|
224
|
+
return refuseWrunPollInput(ctx, `reads feed ${ref}, which has no readings yet`);
|
|
225
|
+
}
|
|
226
|
+
// The lane reads the first value key (the relay's default for a bars read): its rule, when named.
|
|
227
|
+
const combine = head.values[0]?.combine;
|
|
228
|
+
const extras = {
|
|
229
|
+
ref,
|
|
230
|
+
cadence_s: head.cadence_s > 0 ? head.cadence_s : 0,
|
|
231
|
+
...(combine !== undefined ? { combine } : {}),
|
|
232
|
+
};
|
|
233
|
+
plannedHeads.set(`${ref}|${ctx.intervalMs}`, {
|
|
234
|
+
version: head.version,
|
|
235
|
+
cadence_s: extras.cadence_s,
|
|
236
|
+
...(combine !== undefined ? { combine } : {}),
|
|
237
|
+
});
|
|
238
|
+
return extras;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The lane's own fetch: the relay's bars of the feed on the ask's grid, from one interval before
|
|
242
|
+
* the window (the carry seed) through its last bar, as `[bucket_ts * 1000, value]` rows, ascending:
|
|
243
|
+
* the bucket's `combined` value (position 6, P3 C7: the key's rule over the bucket's slots) when the
|
|
244
|
+
* relay sends it, else its close (position 4, the last reading). A bar without a numeric value (a
|
|
245
|
+
* state feed's `[bucket, state, count]`, a bucket of nulls) is no reading. A long window spans
|
|
246
|
+
* several pages (the relay answers at most 5,000 intervals a page): each next one is asked from the
|
|
247
|
+
* page's `next_from`. The ask hears whether the answer is the whole window (`onComplete`): a last
|
|
248
|
+
* page that still says `has_more` (no later start, or one that does not move forward) ended early.
|
|
249
|
+
*/
|
|
250
|
+
export async function fetchWrunSeriesRows(ask) {
|
|
251
|
+
const ref = wrunSeriesFeedAddress(ask.extras.ref);
|
|
252
|
+
const intervalS = ask.intervalMs / 1000;
|
|
253
|
+
// The plan refused both; a reconcile handed a stale record asks nothing.
|
|
254
|
+
if (ref === undefined || !FEED_BAR_INTERVALS_S.includes(intervalS))
|
|
255
|
+
return [];
|
|
256
|
+
const { getFeedBars } = await wrunChartHostEnv().transport.loadFeedsService();
|
|
257
|
+
const toSec = Math.floor(ask.toTs / 1000);
|
|
258
|
+
let fromSec = Math.floor(ask.fromTs / 1000) - intervalS;
|
|
259
|
+
const rows = [];
|
|
260
|
+
let lastTs = Number.NEGATIVE_INFINITY;
|
|
261
|
+
for (;;) {
|
|
262
|
+
const page = await getFeedBars(ref, { interval_s: intervalS, from: fromSec, to: toSec });
|
|
263
|
+
for (const bar of page.bars) {
|
|
264
|
+
const ts = bar[0];
|
|
265
|
+
const value = bar.length > 6 ? bar[6] : bar[4];
|
|
266
|
+
if (!(ts > lastTs) || typeof value !== 'number' || !Number.isFinite(value))
|
|
267
|
+
continue;
|
|
268
|
+
lastTs = ts;
|
|
269
|
+
rows.push([ts * 1000, value]);
|
|
270
|
+
}
|
|
271
|
+
// A page that names no later start, or one that does not move forward, is the last.
|
|
272
|
+
if (!page.has_more || page.next_from === null || page.next_from <= fromSec) {
|
|
273
|
+
ask.onComplete?.(!page.has_more);
|
|
274
|
+
return rows;
|
|
275
|
+
}
|
|
276
|
+
fromSec = page.next_from;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The lane's live channel (P3 C10): the feed's stream (wrun-series-stream.util
|
|
281
|
+
* `openWrunSeriesStream`), loaded with the first session that reads a feed, so the registry's
|
|
282
|
+
* import graph never carries the stream client. The handle answers at once: not up until the
|
|
283
|
+
* stream module loaded and the stream carries the feed; one closed meanwhile closes what opens.
|
|
284
|
+
*/
|
|
285
|
+
export function subscribeWrunSeriesLive(ask, sink) {
|
|
286
|
+
let closed = false;
|
|
287
|
+
let channel;
|
|
288
|
+
void wrunChartHostEnv()
|
|
289
|
+
.run.loadSeriesStream()
|
|
290
|
+
.then(({ openWrunSeriesStream }) => openWrunSeriesStream(ask, sink))
|
|
291
|
+
.then((opened) => {
|
|
292
|
+
if (closed)
|
|
293
|
+
opened.unsubscribe();
|
|
294
|
+
else
|
|
295
|
+
channel = opened;
|
|
296
|
+
})
|
|
297
|
+
.catch((error) => {
|
|
298
|
+
console.warn('[wrun] the feed stream did not open for a series input (the poll stays its path):', error);
|
|
299
|
+
});
|
|
300
|
+
return {
|
|
301
|
+
unsubscribe() {
|
|
302
|
+
closed = true;
|
|
303
|
+
channel?.unsubscribe();
|
|
304
|
+
channel = undefined;
|
|
305
|
+
},
|
|
306
|
+
isUp: () => channel?.isUp() ?? false,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
export const lane = {
|
|
310
|
+
sourceClass: WRUN_SERIES_SOURCE,
|
|
311
|
+
laneKey: WRUN_SERIES_LANE_KEY,
|
|
312
|
+
// No K control: the name its degrade chips and the "data is unavailable" sentence print.
|
|
313
|
+
kType: WRUN_SERIES_SOURCE,
|
|
314
|
+
fields: { [WRUN_SERIES_FIELD]: 1, [WRUN_SERIES_FIELDLESS]: 1 },
|
|
315
|
+
plan: planWrunSeriesInput,
|
|
316
|
+
join: 'bar',
|
|
317
|
+
label: 'Feed',
|
|
318
|
+
fetch: fetchWrunSeriesRows,
|
|
319
|
+
pollIntervalMs: (extras) => wrunSeriesPollMs(extras.cadence_s),
|
|
320
|
+
live: { subscribe: subscribeWrunSeriesLive },
|
|
321
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type WrunPollLane, type WrunPollLaneContext } from '../wrun-poll-lane.types.js';
|
|
2
|
+
export declare const WRUN_TOKEN_SUPPLY_SOURCE_CLASS = "token_supply";
|
|
3
|
+
/** The fields in the kit's declaration order, each at its lane row column (column 0 is the
|
|
4
|
+
* ts): the row shape the control emits. */
|
|
5
|
+
export declare const WRUN_TOKEN_SUPPLY_FIELDS: Readonly<Record<string, number>>;
|
|
6
|
+
/** The full run and every live reconcile open their ask this many days before the first day of
|
|
7
|
+
* the window they serve: past the gateway's 80-day blackout (an ask opening inside it answers
|
|
8
|
+
* no rows) and the 81-day edge that failed, with a margin. The worker twin's wire floor is the
|
|
9
|
+
* same number (`TOKEN_SUPPLY_FROM_FLOOR_DAYS`). */
|
|
10
|
+
export declare const WRUN_TOKEN_SUPPLY_LOOKBACK_DAYS = 90;
|
|
11
|
+
/** The kit's address book: coin ticker to the gateway's display name (`WRUN_TOKEN_NAMES`). */
|
|
12
|
+
export type WrunTokenNamesTable = Readonly<Record<string, string>>;
|
|
13
|
+
/** The part of an input's declaration the lane reads: its `token` knob, as the sheet carries it. */
|
|
14
|
+
export type WrunTokenSupplySource = {
|
|
15
|
+
readonly token?: unknown;
|
|
16
|
+
};
|
|
17
|
+
/** A few display names of the table, for a refusal: the well-known ones it lists first. */
|
|
18
|
+
export declare function wrunTokenSupplyExampleNames(table: WrunTokenNamesTable): string[];
|
|
19
|
+
/**
|
|
20
|
+
* The coin an input's `token` knob names, by reverse lookup in the table (the display name,
|
|
21
|
+
* matched exactly), and the name as the table spells it: the control's ask. Refused by name:
|
|
22
|
+
* no token, a token spelled in another case (the refusal names the table's spelling), a token
|
|
23
|
+
* the table does not list (the refusal says the chart serves the tokens the table lists and
|
|
24
|
+
* names a few).
|
|
25
|
+
*/
|
|
26
|
+
export declare function wrunTokenSupplyCoinOf(source: WrunTokenSupplySource, ctx: Pick<WrunPollLaneContext, 'inputName' | 'sourceClass'>, table: WrunTokenNamesTable): {
|
|
27
|
+
coin: string;
|
|
28
|
+
tokenName: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const lane: WrunPollLane;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `token_supply` on the browser lane: one token's daily supply and valuation facts (market cap,
|
|
3
|
+
* circulating / total / max supply, TVL, FDV, CoinGecko rank, volume, USD price), as the gateway's
|
|
4
|
+
* `TOKEN_SUPPLY_AGG` series serves them, off the `K_TOKEN_SUPPLY` control
|
|
5
|
+
* (`k-token-supply.control.ts` and its worker twin, new with this lane: no legacy control).
|
|
6
|
+
*
|
|
7
|
+
* Eleven fields, in the kit's member order, each on its own lane row column. One knob, `token`,
|
|
8
|
+
* REQUIRED by the kit: the gateway's case-sensitive display name ("Bitcoin", "Ethereum"). The
|
|
9
|
+
* chart resolves the coin by REVERSE lookup in the kit's `WRUN_TOKEN_NAMES` (ticker to display
|
|
10
|
+
* name, about 62 coins) and refuses a name the table does not list by name, before any fetch; a
|
|
11
|
+
* name spelled in another case is refused with the table's spelling. The answer is the control's
|
|
12
|
+
* ask, `{ coin, tokenName }`, so two inputs on one token share ONE fetch and two tokens fetch
|
|
13
|
+
* separately. The chart's own coin plays no part: the knob names the token.
|
|
14
|
+
*
|
|
15
|
+
* Gateway facts (measured by om, `runner/metrics-supply.ts`, pinned in the contract):
|
|
16
|
+
* - the series is served on the DAY and HOUR grids only: the lane rides the daily join with
|
|
17
|
+
* landing `last` and asks `1d` on every chart (the control honors `settings.interval`), and a
|
|
18
|
+
* bar reads the newest day at or before its own under `carry`;
|
|
19
|
+
* - the gateway answers NO rows to an ask whose `from` lies inside the last 80 days (and failed
|
|
20
|
+
* every ask opening at exactly 81 days back): the full run and every live reconcile open
|
|
21
|
+
* their window 90 days before the first day of the window they serve (`lookbackDays`), and
|
|
22
|
+
* the WORKER twin opens any later window at the same 90-day floor on the wire and cuts the
|
|
23
|
+
* answer back to the window asked (`k-token-supply.worker.ts`), so a row-cache composition
|
|
24
|
+
* suffix is covered too and the lane reads the tail of a window that always opens far enough
|
|
25
|
+
* back;
|
|
26
|
+
* - a row carries only the fields the gateway has for the token (a Bitcoin row carries ten of
|
|
27
|
+
* the eleven, `total_value_locked` alone unset, measured 2026-10-02): the control lays `null`
|
|
28
|
+
* on an absent field, which the row builder reads as no observation. Under `nan` or `zero`
|
|
29
|
+
* the input reads that fill; under the default `carry` a field no row of the answer carries
|
|
30
|
+
* refuses the run by name (the seam's valueless-field rule), instead of reading NaN forever.
|
|
31
|
+
*
|
|
32
|
+
* Units are the gateway's: USD for the valuations, volume and price, coins for the supplies,
|
|
33
|
+
* percent for the dominance, a plain rank; documented, never converted.
|
|
34
|
+
*
|
|
35
|
+
* The kit table is read through the kit seam (`wrun-kit.ts`), imported lazily inside `plan`:
|
|
36
|
+
* the bundle is heavy and this file sits on the row builder's import graph, and by the time a
|
|
37
|
+
* run plans its lanes the host's compile step has loaded the kit already, so the import
|
|
38
|
+
* resolves at once (the `assertWrunBrowserSources` pattern).
|
|
39
|
+
*/
|
|
40
|
+
import { wrunChartHostEnv } from '../../../../host-env.js';
|
|
41
|
+
import { refuseWrunPollInput, } from '../wrun-poll-lane.types.js';
|
|
42
|
+
export const WRUN_TOKEN_SUPPLY_SOURCE_CLASS = 'token_supply';
|
|
43
|
+
/** The fields in the kit's declaration order, each at its lane row column (column 0 is the
|
|
44
|
+
* ts): the row shape the control emits. */
|
|
45
|
+
export const WRUN_TOKEN_SUPPLY_FIELDS = Object.freeze({
|
|
46
|
+
marketcap: 1,
|
|
47
|
+
first_marketcap: 2,
|
|
48
|
+
marketcap_dominance_percent: 3,
|
|
49
|
+
circulating_supply: 4,
|
|
50
|
+
total_supply: 5,
|
|
51
|
+
max_supply: 6,
|
|
52
|
+
total_value_locked: 7,
|
|
53
|
+
fully_diluted_valuation: 8,
|
|
54
|
+
cg_marketcap_rank: 9,
|
|
55
|
+
total_volume: 10,
|
|
56
|
+
usd_price: 11,
|
|
57
|
+
});
|
|
58
|
+
/** The full run and every live reconcile open their ask this many days before the first day of
|
|
59
|
+
* the window they serve: past the gateway's 80-day blackout (an ask opening inside it answers
|
|
60
|
+
* no rows) and the 81-day edge that failed, with a margin. The worker twin's wire floor is the
|
|
61
|
+
* same number (`TOKEN_SUPPLY_FROM_FLOOR_DAYS`). */
|
|
62
|
+
export const WRUN_TOKEN_SUPPLY_LOOKBACK_DAYS = 90;
|
|
63
|
+
/** The names a refusal quotes as examples, when the table lists them; the table's first names
|
|
64
|
+
* fill in for any it does not. */
|
|
65
|
+
const EXAMPLE_TOKEN_NAMES = ['Bitcoin', 'Ethereum', 'Solana'];
|
|
66
|
+
const EXAMPLE_COUNT = 3;
|
|
67
|
+
function isWrunTokenNamesTable(value) {
|
|
68
|
+
if (value === null || typeof value !== 'object')
|
|
69
|
+
return false;
|
|
70
|
+
const entries = Object.entries(value);
|
|
71
|
+
return entries.length > 0 && entries.every(([coin, name]) => coin !== '' && typeof name === 'string' && name !== '');
|
|
72
|
+
}
|
|
73
|
+
/** A few display names of the table, for a refusal: the well-known ones it lists first. */
|
|
74
|
+
export function wrunTokenSupplyExampleNames(table) {
|
|
75
|
+
const names = Object.values(table);
|
|
76
|
+
const examples = EXAMPLE_TOKEN_NAMES.filter((name) => names.includes(name));
|
|
77
|
+
for (const name of names) {
|
|
78
|
+
if (examples.length >= EXAMPLE_COUNT)
|
|
79
|
+
break;
|
|
80
|
+
if (!examples.includes(name))
|
|
81
|
+
examples.push(name);
|
|
82
|
+
}
|
|
83
|
+
return examples.slice(0, EXAMPLE_COUNT);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The coin an input's `token` knob names, by reverse lookup in the table (the display name,
|
|
87
|
+
* matched exactly), and the name as the table spells it: the control's ask. Refused by name:
|
|
88
|
+
* no token, a token spelled in another case (the refusal names the table's spelling), a token
|
|
89
|
+
* the table does not list (the refusal says the chart serves the tokens the table lists and
|
|
90
|
+
* names a few).
|
|
91
|
+
*/
|
|
92
|
+
export function wrunTokenSupplyCoinOf(source, ctx, table) {
|
|
93
|
+
const examples = `${wrunTokenSupplyExampleNames(table).join(', ')}, ...`;
|
|
94
|
+
const token = source.token;
|
|
95
|
+
if (typeof token !== 'string' || token === '') {
|
|
96
|
+
return refuseWrunPollInput(ctx, `names no token: declare token, the token's display name as the chart's table spells it (${examples})`);
|
|
97
|
+
}
|
|
98
|
+
for (const [coin, name] of Object.entries(table)) {
|
|
99
|
+
if (name === token)
|
|
100
|
+
return { coin, tokenName: name };
|
|
101
|
+
}
|
|
102
|
+
const folded = token.trim().toLowerCase();
|
|
103
|
+
const spelled = Object.values(table).find((name) => name.toLowerCase() === folded);
|
|
104
|
+
if (spelled !== undefined) {
|
|
105
|
+
return refuseWrunPollInput(ctx, `declares token '${token}': the table spells it '${spelled}' (display names match exactly, case included)`);
|
|
106
|
+
}
|
|
107
|
+
const count = Object.keys(table).length;
|
|
108
|
+
return refuseWrunPollInput(ctx, `declares token '${token}': the chart serves the ${count} tokens its table lists, by display name (${examples})`);
|
|
109
|
+
}
|
|
110
|
+
let tokenNamesLoad;
|
|
111
|
+
/** The kit's table, loaded once through the kit seam; undefined when the vendored kit exports
|
|
112
|
+
* none (a re-vendor that dropped it). A failed load is retried on the next plan. */
|
|
113
|
+
function loadWrunTokenNames() {
|
|
114
|
+
tokenNamesLoad ??= wrunChartHostEnv()
|
|
115
|
+
.transport.loadWrunKit()
|
|
116
|
+
.then(({ wrunIndicatorKit }) => {
|
|
117
|
+
const table = wrunIndicatorKit.WRUN_TOKEN_NAMES;
|
|
118
|
+
return isWrunTokenNamesTable(table) ? table : undefined;
|
|
119
|
+
}, (error) => {
|
|
120
|
+
tokenNamesLoad = undefined;
|
|
121
|
+
throw error;
|
|
122
|
+
});
|
|
123
|
+
return tokenNamesLoad;
|
|
124
|
+
}
|
|
125
|
+
/** One input against the kit's table, before any fetch: the control's ask `{ coin, tokenName }`
|
|
126
|
+
* or a refusal by name. */
|
|
127
|
+
async function planWrunTokenSupply(source, ctx) {
|
|
128
|
+
const table = await loadWrunTokenNames();
|
|
129
|
+
if (table === undefined) {
|
|
130
|
+
return refuseWrunPollInput(ctx, 'cannot be planned: the vendored indicator kit exports no WRUN_TOKEN_NAMES table');
|
|
131
|
+
}
|
|
132
|
+
return wrunTokenSupplyCoinOf({ token: source.token }, ctx, table);
|
|
133
|
+
}
|
|
134
|
+
export const lane = {
|
|
135
|
+
sourceClass: WRUN_TOKEN_SUPPLY_SOURCE_CLASS,
|
|
136
|
+
laneKey: 'token_supply',
|
|
137
|
+
kType: 'token_supply',
|
|
138
|
+
fields: WRUN_TOKEN_SUPPLY_FIELDS,
|
|
139
|
+
plan: planWrunTokenSupply,
|
|
140
|
+
join: { kind: 'daily', landing: 'last', lookbackDays: WRUN_TOKEN_SUPPLY_LOOKBACK_DAYS },
|
|
141
|
+
interval: '1d',
|
|
142
|
+
label: 'Token supply',
|
|
143
|
+
// The token is named by the knob, never by the chart's market: served on every chart.
|
|
144
|
+
global: true,
|
|
145
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `treasury_balance` on the browser lane: Binance's own balance of one asset, in coins of that
|
|
3
|
+
* asset (its liability minus its customer liability, the number the legacy
|
|
4
|
+
* `K_BINANCE_TREASURY_BALANCE` control emits off `BINANCE_PROOF_OF_RESERVES_AGG`). Binance today.
|
|
5
|
+
*
|
|
6
|
+
* One field, `balance`. One knob, `asset`: an upper-case ticker (the kit validates its spelling);
|
|
7
|
+
* absent, the input reads the chart's coin. Two inputs naming different assets fetch separately;
|
|
8
|
+
* an input naming the chart's own coin and one naming none share the fetch.
|
|
9
|
+
*
|
|
10
|
+
* The series is published MONTHLY, so it rides the daily join with landing `last`: the lane asks
|
|
11
|
+
* `1d` on every chart (the restriction table refuses the type at intraday intervals, so the ask
|
|
12
|
+
* names the day and the control honors `settings.interval`), and a bar reads the newest
|
|
13
|
+
* observation at or before its day under `carry`. The lookback reaches 400 days before the
|
|
14
|
+
* window so a monthly observation stands at the window's head even on a short intraday chart.
|
|
15
|
+
*/
|
|
16
|
+
import { type WrunPollLane, type WrunPollLaneContext } from '../wrun-poll-lane.types.js';
|
|
17
|
+
export declare const WRUN_TREASURY_BALANCE_SOURCE_CLASS = "treasury_balance";
|
|
18
|
+
/** The series is published monthly: the window head needs the observation standing before it,
|
|
19
|
+
* and a window opening a day after a publication waits a month for the next one. */
|
|
20
|
+
export declare const WRUN_TREASURY_BALANCE_LOOKBACK_DAYS = 400;
|
|
21
|
+
/** The asset the input reads: its `asset` knob (off the declaration's knobs, as the lane sees
|
|
22
|
+
* them), else the chart's coin; refused by name when neither is available (a chart with no
|
|
23
|
+
* coin, such as an unresolved market). */
|
|
24
|
+
export declare function wrunTreasuryBalanceAsset(source: Readonly<Record<string, unknown>>, ctx: Pick<WrunPollLaneContext, 'inputName' | 'sourceClass' | 'coin' | 'indexMode'>): string;
|
|
25
|
+
export declare const lane: WrunPollLane;
|