@orangecharts/wrun-chart-host 0.11.1 → 0.15.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 +1 -0
- package/dist/constants/feature-flags.constants.d.ts +4 -4
- package/dist/constants/feature-flags.constants.js +38 -52
- package/dist/constants/feature-limits.constants.d.ts +1 -1
- package/dist/constants/feature-limits.constants.js +5 -4
- package/dist/constants/interval.constants.d.ts +7 -0
- package/dist/constants/interval.constants.js +7 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +20 -149
- package/dist/constants/scriptEditor/cme-official-scripts.constants.js +20 -309
- package/dist/constants/stocks-compliance.constants.d.ts +15 -0
- package/dist/constants/stocks-compliance.constants.js +15 -0
- package/dist/host-env.d.ts +69 -3
- package/dist/host-env.js +21 -0
- package/dist/host-ports.types.d.ts +36 -3
- package/dist/index.d.ts +18 -0
- package/dist/index.js +19 -0
- package/dist/indicators/controls/tpo-session.util.d.ts +52 -12
- package/dist/indicators/controls/tpo-session.util.js +113 -16
- package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +6 -0
- package/dist/instances/script-engine-worker-ohlcv-transfer.js +16 -0
- package/dist/interfaces/cme-realtime.interface.d.ts +8 -0
- package/dist/interfaces/cme-realtime.interface.js +2 -1
- package/dist/interfaces/feed.interface.d.ts +15 -1
- package/dist/interfaces/replay.interface.d.ts +5 -0
- package/dist/interfaces/stocks-realtime.interface.d.ts +4 -3
- package/dist/interfaces/stocks-realtime.interface.js +5 -4
- package/dist/interfaces/wrun-runtime.interface.d.ts +141 -20
- package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +17 -0
- package/dist/kscript-data/controls/live-ohlcv-merge.util.js +22 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +46 -40
- package/dist/kscript-data/controls/live-trades-merge.util.js +80 -107
- package/dist/market-data/billing.interface.d.ts +9 -1
- package/dist/market-data/venue.d.ts +1 -1
- package/dist/market-data/venues/index.d.ts +5 -5
- package/dist/market-data/venues/opra.js +3 -3
- package/dist/market-data/venues/stocks.contract.copy.json +6 -5
- package/dist/market-data/venues/stocks.d.ts +5 -5
- package/dist/market-data/venues/stocks.js +21 -18
- package/dist/settings-templates/frvp-fields.d.ts +12 -1
- package/dist/settings-templates/frvp-fields.js +15 -4
- package/dist/settings-templates/index.js +12 -5
- package/dist/settings-templates/indicator-fields.js +43 -2
- package/dist/settings-templates/tool-rules.d.ts +17 -8
- package/dist/settings-templates/tool-rules.js +15 -8
- package/dist/settings-templates/tool-tables.generated.js +4 -2
- package/dist/utility/auth/server-clock.util.d.ts +3 -1
- package/dist/utility/auth/server-clock.util.js +3 -1
- package/dist/utility/chart/book-live-bucket.util.js +2 -2
- package/dist/utility/chart/cache-alignment.util.d.ts +38 -7
- package/dist/utility/chart/cache-alignment.util.js +50 -13
- package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +2 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.js +16 -0
- package/dist/utility/chart/cme-session-bucket.util.d.ts +18 -75
- package/dist/utility/chart/cme-session-bucket.util.js +25 -332
- package/dist/utility/chart/continuous-contracts.util.js +6 -5
- package/dist/utility/chart/display-offset.leaf.d.ts +24 -0
- package/dist/utility/chart/display-offset.leaf.js +41 -0
- package/dist/utility/chart/effective-chart-session.util.d.ts +2 -1
- package/dist/utility/chart/effective-chart-session.util.js +13 -5
- package/dist/utility/chart/feed-interval.util.d.ts +6 -20
- package/dist/utility/chart/feed-interval.util.js +13 -22
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +27 -7
- package/dist/utility/chart/fetch-dedupe-policy.util.js +86 -11
- package/dist/utility/chart/footprint-band.util.d.ts +21 -5
- package/dist/utility/chart/footprint-band.util.js +53 -14
- package/dist/utility/chart/host-bar-placement.util.d.ts +7 -4
- package/dist/utility/chart/host-bar-placement.util.js +8 -2
- package/dist/utility/chart/indicator-inflight-registry.util.d.ts +32 -0
- package/dist/utility/chart/indicator-inflight-registry.util.js +52 -0
- package/dist/utility/chart/indicator-run-interval.util.d.ts +10 -4
- package/dist/utility/chart/indicator-run-interval.util.js +21 -12
- package/dist/utility/chart/interval-registry.util.d.ts +1 -1
- package/dist/utility/chart/interval-registry.util.js +1 -1
- package/dist/utility/chart/kscript-legend-entries.util.d.ts +12 -0
- package/dist/utility/chart/kscript-legend-entries.util.js +16 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +1 -1
- package/dist/utility/chart/kscript-run-interval-projection.util.js +4 -2
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -62
- package/dist/utility/chart/kscript-venue-policy.util.js +85 -94
- package/dist/utility/chart/live-bucket.util.d.ts +39 -17
- package/dist/utility/chart/live-bucket.util.js +103 -57
- package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +58 -20
- package/dist/utility/chart/local-kscript-source-revalidation.util.js +98 -23
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +35 -11
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +24 -3
- package/dist/utility/chart/market-session-schedule.util.d.ts +8 -0
- package/dist/utility/chart/market-session-schedule.util.js +39 -1
- package/dist/utility/chart/market-session.util.d.ts +136 -0
- package/dist/utility/chart/market-session.util.js +341 -0
- package/dist/utility/chart/om-panel.util.d.ts +5 -3
- package/dist/utility/chart/om-panel.util.js +42 -7
- package/dist/utility/chart/om-target.util.d.ts +14 -1
- package/dist/utility/chart/om-target.util.js +22 -5
- package/dist/utility/chart/opra-read-access.leaf.d.ts +16 -1
- package/dist/utility/chart/opra-read-access.leaf.js +22 -0
- package/dist/utility/chart/profile-row-height.util.d.ts +49 -16
- package/dist/utility/chart/profile-row-height.util.js +74 -37
- package/dist/utility/chart/rth-session.util.d.ts +55 -20
- package/dist/utility/chart/rth-session.util.js +94 -46
- package/dist/utility/chart/session-lattice.util.d.ts +150 -0
- package/dist/utility/chart/session-lattice.util.js +488 -0
- package/dist/utility/chart/trading-day.util.d.ts +40 -2
- package/dist/utility/chart/trading-day.util.js +84 -7
- package/dist/utility/chart/us-equities-session.util.d.ts +32 -11
- package/dist/utility/chart/us-equities-session.util.js +44 -15
- package/dist/utility/chart/window-geometry.leaf.d.ts +28 -7
- package/dist/utility/chart/window-geometry.leaf.js +57 -8
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +21 -14
- package/dist/utility/chart/wrun-bar-session-facts.util.js +32 -38
- package/dist/utility/chart/wrun-run-result.util.d.ts +38 -13
- package/dist/utility/chart/wrun-run-result.util.js +97 -27
- package/dist/utility/common/time.util.js +5 -4
- package/dist/utility/market-events/earnings-scope.util.d.ts +10 -5
- package/dist/utility/market-events/earnings-scope.util.js +17 -9
- package/dist/utility/market-events/market-events.util.d.ts +14 -7
- package/dist/utility/market-events/market-events.util.js +30 -17
- package/dist/utility/number-format.util.d.ts +14 -21
- package/dist/utility/number-format.util.js +38 -24
- package/dist/utility/options/option-venue-disclosure.util.d.ts +40 -6
- package/dist/utility/options/option-venue-disclosure.util.js +71 -11
- package/dist/utility/options/option-venue.util.d.ts +1 -1
- package/dist/utility/options/option-venue.util.js +1 -1
- package/dist/utility/pool-symbol.leaf.d.ts +7 -0
- package/dist/utility/pool-symbol.leaf.js +50 -5
- package/dist/utility/stocks/stock-display.util.d.ts +15 -0
- package/dist/utility/stocks/stock-display.util.js +37 -0
- package/dist/utility/symbol-selection/contract-expiry.util.js +5 -4
- package/dist/utility/v2/gate-plane.util.d.ts +6 -0
- package/dist/utility/v2/gate-plane.util.js +11 -1
- package/dist/utility/v2/gate-session-latch.util.d.ts +1 -1
- package/dist/utility/v2/gate-session-latch.util.js +3 -3
- package/dist/utility/v2/governed-tier.leaf.d.ts +17 -16
- package/dist/utility/v2/governed-tier.leaf.js +17 -16
- package/dist/utility/v2/stocks-governed.util.d.ts +5 -0
- package/dist/utility/v2/stocks-governed.util.js +14 -0
- package/dist/utility/v2/v2-enums.leaf.d.ts +13 -0
- package/dist/utility/v2/v2-enums.leaf.js +458 -0
- package/dist/utility/wrun/derived-roots.leaf.d.ts +21 -1
- package/dist/utility/wrun/derived-roots.leaf.js +27 -1
- package/dist/utility/wrun/derived-roots.util.d.ts +44 -32
- package/dist/utility/wrun/derived-roots.util.js +97 -56
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -3
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -3
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +2 -1
- package/dist/utility/wrun/sources/lanes/option_daily.js +2 -1
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +3 -0
- package/dist/utility/wrun/sources/lanes/options_flow.js +23 -5
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -4
- package/dist/utility/wrun/sources/row-lane-registry.js +9 -4
- package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +19 -0
- package/dist/utility/wrun/sources/row-lanes/dark_pool.js +104 -0
- package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
- package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.d.ts +20 -0
- package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.js +103 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -2
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +15 -13
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +49 -23
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +14 -9
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +75 -27
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +139 -82
- package/dist/utility/wrun/wrun-app-layer.leaf.d.ts +78 -0
- package/dist/utility/wrun/wrun-app-layer.leaf.js +89 -0
- package/dist/utility/wrun/wrun-bar-count.util.d.ts +11 -7
- package/dist/utility/wrun/wrun-bar-count.util.js +12 -8
- package/dist/utility/wrun/wrun-batched-kinds.leaf.d.ts +13 -0
- package/dist/utility/wrun/wrun-batched-kinds.leaf.js +18 -0
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +46 -23
- package/dist/utility/wrun/wrun-batched-marks.util.js +260 -62
- package/dist/utility/wrun/wrun-batched-readout.util.d.ts +26 -19
- package/dist/utility/wrun/wrun-batched-readout.util.js +81 -27
- package/dist/utility/wrun/wrun-book-bands.leaf.d.ts +8 -0
- package/dist/utility/wrun/wrun-book-bands.leaf.js +7 -0
- package/dist/utility/wrun/wrun-candle-equal.leaf.d.ts +19 -0
- package/dist/utility/wrun/wrun-candle-equal.leaf.js +40 -0
- package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-canvases.util.d.ts +24 -7
- package/dist/utility/wrun/wrun-canvases.util.js +99 -30
- package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +6 -3
- package/dist/utility/wrun/wrun-chart-context-names.util.js +8 -4
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +47 -29
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +201 -201
- package/dist/utility/wrun/wrun-child-overlay-id.util.js +2 -1
- package/dist/utility/wrun/wrun-cme-legs-note.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-cme-legs-note.util.js +49 -0
- package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +38 -0
- package/dist/utility/wrun/wrun-cme-root-specs.util.js +81 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +3 -0
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-color-settings.util.js +32 -7
- package/dist/utility/wrun/wrun-dark-pool.util.d.ts +50 -0
- package/dist/utility/wrun/wrun-dark-pool.util.js +127 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +67 -12
- package/dist/utility/wrun/wrun-declared-warmup.util.js +165 -13
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +18 -8
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +57 -11
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +14 -10
- package/dist/utility/wrun/wrun-draft-overlay.util.js +26 -14
- package/dist/utility/wrun/wrun-earnings-facts.util.js +3 -2
- package/dist/utility/wrun/wrun-etf-funds.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-etf-funds.util.js +4 -0
- package/dist/utility/wrun/wrun-held-lanes.util.js +8 -2
- package/dist/utility/wrun/wrun-history-as-of.util.d.ts +77 -0
- package/dist/utility/wrun/wrun-history-as-of.util.js +108 -0
- package/dist/utility/wrun/wrun-host.service.d.ts +64 -14
- package/dist/utility/wrun/wrun-host.service.js +137 -27
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +3 -3
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +12 -2
- package/dist/utility/wrun/wrun-hover.util.d.ts +8 -2
- package/dist/utility/wrun/wrun-hover.util.js +24 -13
- package/dist/utility/wrun/wrun-inert-legend.util.d.ts +13 -0
- package/dist/utility/wrun/wrun-inert-legend.util.js +31 -3
- package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +7 -5
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +16 -6
- package/dist/utility/wrun/wrun-install-pacer.util.d.ts +26 -0
- package/dist/utility/wrun/wrun-install-pacer.util.js +145 -0
- package/dist/utility/wrun/wrun-kit-refusal-stages.types.d.ts +22 -0
- package/dist/utility/wrun/wrun-kit-refusal-stages.types.js +1 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +12 -5
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +23 -5
- package/dist/utility/wrun/wrun-lane-warmup.util.js +22 -4
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +6 -5
- package/dist/utility/wrun/wrun-leg-close.util.js +11 -9
- package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +3 -1
- package/dist/utility/wrun/wrun-leg-fetch.util.js +9 -2
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-levels-child.util.js +6 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +15 -6
- package/dist/utility/wrun/wrun-live-intake.util.js +167 -47
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +52 -8
- package/dist/utility/wrun/wrun-live-tick.util.js +655 -97
- package/dist/utility/wrun/wrun-market-facts.util.d.ts +16 -2
- package/dist/utility/wrun/wrun-market-facts.util.js +32 -3
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +27 -27
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +28 -16
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +34 -5
- package/dist/utility/wrun/wrun-oi-lane.util.d.ts +10 -7
- package/dist/utility/wrun/wrun-oi-lane.util.js +16 -10
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +1 -1
- package/dist/utility/wrun/wrun-option-views.util.d.ts +2 -2
- package/dist/utility/wrun/wrun-option-views.util.js +5 -2
- package/dist/utility/wrun/wrun-options-flow-underlying.leaf.d.ts +5 -0
- package/dist/utility/wrun/wrun-options-flow-underlying.leaf.js +16 -0
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-options-stop.util.js +6 -4
- package/dist/utility/wrun/wrun-output-words.util.d.ts +14 -0
- package/dist/utility/wrun/wrun-output-words.util.js +51 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +116 -11
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +208 -43
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +20 -10
- package/dist/utility/wrun/wrun-overlay-park.util.d.ts +84 -0
- package/dist/utility/wrun/wrun-overlay-park.util.js +135 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +37 -4
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +26 -14
- package/dist/utility/wrun/wrun-overlay-result.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +247 -26
- package/dist/utility/wrun/wrun-overlay-run.util.js +2234 -408
- package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +11 -2
- package/dist/utility/wrun/wrun-panel-mount.util.js +122 -19
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-panel-style.util.js +3 -2
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +18 -4
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +26 -17
- package/dist/utility/wrun/wrun-pin-venues.util.js +43 -36
- package/dist/utility/wrun/wrun-pinned-lanes.util.d.ts +58 -0
- package/dist/utility/wrun/wrun-pinned-lanes.util.js +72 -0
- package/dist/utility/wrun/wrun-prefix-cohort.util.js +2 -1
- package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +22 -9
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +145 -26
- package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +29 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.js +23 -5
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +9 -1
- package/dist/utility/wrun/wrun-refusal-surface.util.js +15 -1
- package/dist/utility/wrun/wrun-refusal.util.d.ts +19 -1
- package/dist/utility/wrun/wrun-refusal.util.js +103 -16
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +20 -6
- package/dist/utility/wrun/wrun-registry-errors.util.js +20 -6
- package/dist/utility/wrun/wrun-replay-rows.util.js +6 -10
- package/dist/utility/wrun/wrun-run-health.util.d.ts +95 -5
- package/dist/utility/wrun/wrun-run-health.util.js +209 -3
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +2 -2
- package/dist/utility/wrun/wrun-run-interval-session.util.js +2 -2
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +9 -8
- package/dist/utility/wrun/wrun-run-interval.util.js +13 -11
- package/dist/utility/wrun/wrun-sandbox-row-source.js +5 -2
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +38 -11
- package/dist/utility/wrun/wrun-script-inputs.util.js +194 -56
- package/dist/utility/wrun/wrun-session-composition.util.d.ts +81 -0
- package/dist/utility/wrun/wrun-session-composition.util.js +169 -0
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +10 -7
- package/dist/utility/wrun/wrun-setting-words.util.js +25 -7
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +94 -28
- package/dist/utility/wrun/wrun-source-rows.util.js +738 -93
- package/dist/utility/wrun/wrun-stream-clock.util.d.ts +45 -0
- package/dist/utility/wrun/wrun-stream-clock.util.js +108 -0
- package/dist/utility/wrun/wrun-style-names.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-style-names.util.js +74 -0
- package/dist/utility/wrun/wrun-tape-coins.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-tape-coins.util.js +110 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +62 -32
- package/dist/utility/wrun/wrun-tape-source.util.js +72 -34
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +13 -5
- package/dist/utility/wrun/wrun-tier-grid.util.js +23 -13
- package/dist/utility/wrun/wrun-tpo-rows.util.js +2 -1
- package/dist/utility/wrun/wrun-trades-lane.util.d.ts +73 -0
- package/dist/utility/wrun/wrun-trades-lane.util.js +82 -0
- package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +5 -0
- package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +9 -2
- package/dist/utility/wrun/wrun-visibility-table.d.ts +13 -0
- package/dist/utility/wrun/wrun-visibility-table.js +9 -0
- package/dist/utility/wrun/wrun-volume-profile.util.js +7 -3
- package/dist/utils/replay/replay-buffer-math.d.ts +16 -6
- package/dist/utils/replay/replay-buffer-math.js +60 -30
- package/dist/workers/constants/socket-slots.d.ts +11 -7
- package/dist/workers/constants/socket-slots.js +6 -5
- package/package.json +5 -5
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { liveBucketVenueOf } from '../chart/live-bucket.util.js';
|
|
2
|
+
/** A chart as the host reads it: its metadata (the candle source reader reads its other fields), or a market. */
|
|
3
|
+
export type WrunStreamChart = Parameters<typeof liveBucketVenueOf>[0] & {
|
|
4
|
+
stockFeed?: unknown;
|
|
5
|
+
};
|
|
6
|
+
/** The venue a chart's candles ride: the tape a US stock Trades chart rides, else the chart's own exchange. */
|
|
7
|
+
export declare function wrunChartStreamExchange(chart: WrunStreamChart | null | undefined): string | undefined;
|
|
8
|
+
/** Whether a venue's data rides a delayed governed tier now (a gate governs it and has not confirmed real time). */
|
|
9
|
+
export declare function wrunStreamRidesDelayedTier(exchange: string | null | undefined): boolean;
|
|
10
|
+
/** The delay, in seconds, a venue's stream is served behind the server's now: 0 off a delayed tier. */
|
|
11
|
+
export declare function wrunStreamDelaySeconds(exchange: string | null | undefined): number;
|
|
12
|
+
/** Where a venue's newest frame sits in event time: `nowMs` less the served delay on a delayed tier. */
|
|
13
|
+
export declare function wrunStreamNowMs(exchange: string | null | undefined, nowMs?: number): number;
|
|
14
|
+
/** The chart's stream clock: the venue its candles ride (`wrunChartStreamExchange`), on `wrunStreamNowMs`. */
|
|
15
|
+
export declare function wrunChartStreamNowMs(chart: WrunStreamChart | null | undefined, nowMs?: number): number;
|
|
16
|
+
/** The reader's cut (ms) a read of the venue asked at server time `nowMs` ends at (now less the delay, floored to the
|
|
17
|
+
* cut grain); null off a delayed tier, whose reads end at now. */
|
|
18
|
+
export declare function wrunStreamCutMs(exchange: string | null | undefined, nowMs: number): number | null;
|
|
19
|
+
/** The served delay of a venue in bars of `intervalMs`, with the cut grain: what a poll window must add to reach the
|
|
20
|
+
* first bar the reader had not served (the kScript poll window's rule). 0 off a delayed tier. */
|
|
21
|
+
export declare function wrunStreamDelayBars(exchange: string | null | undefined, intervalMs: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* The chart a host decision reads the stream of: the chart store's metadata for `chartIndex` (it carries the fields
|
|
24
|
+
* the candle source reader needs, a stock chart's feed among them) when it names the same market as `market`, else
|
|
25
|
+
* `market` itself (a session's stored market, which a switch may have left behind the store).
|
|
26
|
+
*/
|
|
27
|
+
export declare function wrunChartStreamRefOf(chartIndex: number, market: WrunStreamChart | null | undefined): WrunStreamChart | null | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The chart's forming bar (`WrunChartSourceRows.formingBarTs`): the bar holding the chart's STREAM clock on its bar
|
|
30
|
+
* grid at `intervalMs`. The stream clock, never the wall clock: a delayed chart's newest bar holds `now - delay`. The
|
|
31
|
+
* bar grid is the chart's own (`liveBucketVenueOf(chart)`), the clock the venue its candles ride.
|
|
32
|
+
*/
|
|
33
|
+
export declare function wrunChartFormingBarTs(intervalMs: number, chart: WrunStreamChart | null | undefined, nowMs?: number): number | null;
|
|
34
|
+
/**
|
|
35
|
+
* Whether a reconcile answer's row for the bucket opening at `bucketTs` yields to the row the session holds: only on
|
|
36
|
+
* a delayed stream (`cutMs` not null), only for a bar still open at the reader's cut (its end past `cutMs`: the
|
|
37
|
+
* answer is a partial copy there), and only when the held row was built live (`heldLiveBuilt`: a fed bucket). A bar
|
|
38
|
+
* closed at the cut, a real-time stream, or a held row an earlier answer wrote: the answer wins, as before.
|
|
39
|
+
*/
|
|
40
|
+
export declare function wrunReconcileHeldRowWins(input: {
|
|
41
|
+
bucketTs: number;
|
|
42
|
+
intervalMs: number;
|
|
43
|
+
cutMs: number | null;
|
|
44
|
+
heldLiveBuilt: boolean;
|
|
45
|
+
}): boolean;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wrun host's ONE reading of a chart's stream: the venue its candles ride, the tier that venue is served on, and
|
|
3
|
+
* the clock the stream's newest frame sits on (DELAYED-TIER-SWEEP U2c).
|
|
4
|
+
*
|
|
5
|
+
* Why: a delayed chart's candles are served `delay` behind the server's now (CME 600 s, US stocks 905 s, OPRA 900 s),
|
|
6
|
+
* on the venue the candles ride, which is not always the chart's exchange (a US stock chart on Trades stores POLYGON
|
|
7
|
+
* and rides its tape). Three host decisions read the wall clock or the chart's exchange instead, and so judged a
|
|
8
|
+
* delayed chart as real time:
|
|
9
|
+
* - the forming bar a leg row still forming may land on (`wrunChartFormingBarTs`): on the wall clock it is never the
|
|
10
|
+
* chart's newest bar below the delay and not yet it for the first delay-minutes of a longer bar, so the leg's
|
|
11
|
+
* forming row was dropped and the script line had no value at the live edge;
|
|
12
|
+
* - the reconcile floor in bars (`wrunStreamDelayBars`): keyed on POLYGON it read a delayed stock chart as ungoverned;
|
|
13
|
+
* - which reconcile row wins a bucket (`wrunReconcileHeldRowWins`): a delayed reply ends at the reader's cut, so its
|
|
14
|
+
* row for a bar still open at the cut is a partial copy and must not replace the row the live feed built.
|
|
15
|
+
*
|
|
16
|
+
* The mistake, named once: a host decision judged a delayed stream by the wall clock or the chart's listing exchange
|
|
17
|
+
* instead of the stream's own venue and clock. Every such decision in utility/wrun reads this module; the census spec
|
|
18
|
+
* (tests/utility/wrun/wrun-stream-clock.census.spec.ts) fails a new wall-clock bucket read or a new served-delay read
|
|
19
|
+
* outside it.
|
|
20
|
+
*
|
|
21
|
+
* Pure but for the host's mirrors (served access, the candle source reader); `serverNowMs()` is the server's clock.
|
|
22
|
+
*/
|
|
23
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
24
|
+
import { serverNowMs } from '../auth/server-clock.util.js';
|
|
25
|
+
import { cmeServedAccessForExchange } from '../chart/cme-cache-context.util.js';
|
|
26
|
+
import { barEndMs } from '../chart/calendar-interval.util.js';
|
|
27
|
+
import { hostBucketResolverFor } from '../chart/host-bar-placement.util.js';
|
|
28
|
+
import { liveBucketVenueOf } from '../chart/live-bucket.util.js';
|
|
29
|
+
import { DELAYED_CUT_GRAIN_SECONDS, governedMarketDataTier, isGovernedExchange, servedDelaySecondsForAccess, } from '../v2/governed-tier.leaf.js';
|
|
30
|
+
import { wrunChartCandleVenue } from './run-schedule/wrun-own-candles.util.js';
|
|
31
|
+
/** The venue a chart's candles ride: the tape a US stock Trades chart rides, else the chart's own exchange. */
|
|
32
|
+
export function wrunChartStreamExchange(chart) {
|
|
33
|
+
const venue = wrunChartCandleVenue(chart);
|
|
34
|
+
return typeof venue === 'string' && venue.length > 0 ? venue : undefined;
|
|
35
|
+
}
|
|
36
|
+
/** Whether a venue's data rides a delayed governed tier now (a gate governs it and has not confirmed real time). */
|
|
37
|
+
export function wrunStreamRidesDelayedTier(exchange) {
|
|
38
|
+
return !!exchange && isGovernedExchange(exchange) && governedMarketDataTier(exchange) === 'delayed';
|
|
39
|
+
}
|
|
40
|
+
/** The delay, in seconds, a venue's stream is served behind the server's now: 0 off a delayed tier. */
|
|
41
|
+
export function wrunStreamDelaySeconds(exchange) {
|
|
42
|
+
if (!wrunStreamRidesDelayedTier(exchange))
|
|
43
|
+
return 0;
|
|
44
|
+
return servedDelaySecondsForAccess(cmeServedAccessForExchange(exchange), exchange);
|
|
45
|
+
}
|
|
46
|
+
/** Where a venue's newest frame sits in event time: `nowMs` less the served delay on a delayed tier. */
|
|
47
|
+
export function wrunStreamNowMs(exchange, nowMs = serverNowMs()) {
|
|
48
|
+
return nowMs - wrunStreamDelaySeconds(exchange) * 1000;
|
|
49
|
+
}
|
|
50
|
+
/** The chart's stream clock: the venue its candles ride (`wrunChartStreamExchange`), on `wrunStreamNowMs`. */
|
|
51
|
+
export function wrunChartStreamNowMs(chart, nowMs = serverNowMs()) {
|
|
52
|
+
return wrunStreamNowMs(wrunChartStreamExchange(chart), nowMs);
|
|
53
|
+
}
|
|
54
|
+
/** The reader's cut (ms) a read of the venue asked at server time `nowMs` ends at (now less the delay, floored to the
|
|
55
|
+
* cut grain); null off a delayed tier, whose reads end at now. */
|
|
56
|
+
export function wrunStreamCutMs(exchange, nowMs) {
|
|
57
|
+
if (!wrunStreamRidesDelayedTier(exchange))
|
|
58
|
+
return null;
|
|
59
|
+
const nowSec = Math.floor(nowMs / 1000);
|
|
60
|
+
const cutSec = Math.floor((nowSec - wrunStreamDelaySeconds(exchange)) / DELAYED_CUT_GRAIN_SECONDS) * DELAYED_CUT_GRAIN_SECONDS;
|
|
61
|
+
return cutSec * 1000;
|
|
62
|
+
}
|
|
63
|
+
/** The served delay of a venue in bars of `intervalMs`, with the cut grain: what a poll window must add to reach the
|
|
64
|
+
* first bar the reader had not served (the kScript poll window's rule). 0 off a delayed tier. */
|
|
65
|
+
export function wrunStreamDelayBars(exchange, intervalMs) {
|
|
66
|
+
const intervalSeconds = intervalMs / 1000;
|
|
67
|
+
if (!(intervalSeconds > 0) || !wrunStreamRidesDelayedTier(exchange))
|
|
68
|
+
return 0;
|
|
69
|
+
return Math.ceil((wrunStreamDelaySeconds(exchange) + DELAYED_CUT_GRAIN_SECONDS) / intervalSeconds);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The chart a host decision reads the stream of: the chart store's metadata for `chartIndex` (it carries the fields
|
|
73
|
+
* the candle source reader needs, a stock chart's feed among them) when it names the same market as `market`, else
|
|
74
|
+
* `market` itself (a session's stored market, which a switch may have left behind the store).
|
|
75
|
+
*/
|
|
76
|
+
export function wrunChartStreamRefOf(chartIndex, market) {
|
|
77
|
+
try {
|
|
78
|
+
const metadata = wrunChartHostEnv().chart.chartStore().mergedAllCharts[chartIndex]?.metadata;
|
|
79
|
+
if (!metadata)
|
|
80
|
+
return market;
|
|
81
|
+
if (!market)
|
|
82
|
+
return metadata;
|
|
83
|
+
return metadata.exchange === market.exchange && metadata.symbol === market.symbol ? metadata : market;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return market;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The chart's forming bar (`WrunChartSourceRows.formingBarTs`): the bar holding the chart's STREAM clock on its bar
|
|
91
|
+
* grid at `intervalMs`. The stream clock, never the wall clock: a delayed chart's newest bar holds `now - delay`. The
|
|
92
|
+
* bar grid is the chart's own (`liveBucketVenueOf(chart)`), the clock the venue its candles ride.
|
|
93
|
+
*/
|
|
94
|
+
export function wrunChartFormingBarTs(intervalMs, chart, nowMs = serverNowMs()) {
|
|
95
|
+
return hostBucketResolverFor(intervalMs, liveBucketVenueOf(chart))(wrunChartStreamNowMs(chart, nowMs));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Whether a reconcile answer's row for the bucket opening at `bucketTs` yields to the row the session holds: only on
|
|
99
|
+
* a delayed stream (`cutMs` not null), only for a bar still open at the reader's cut (its end past `cutMs`: the
|
|
100
|
+
* answer is a partial copy there), and only when the held row was built live (`heldLiveBuilt`: a fed bucket). A bar
|
|
101
|
+
* closed at the cut, a real-time stream, or a held row an earlier answer wrote: the answer wins, as before.
|
|
102
|
+
*/
|
|
103
|
+
export function wrunReconcileHeldRowWins(input) {
|
|
104
|
+
const { bucketTs, intervalMs, cutMs, heldLiveBuilt } = input;
|
|
105
|
+
if (cutMs === null || !heldLiveBuilt || !Number.isFinite(bucketTs) || !(intervalMs > 0))
|
|
106
|
+
return false;
|
|
107
|
+
return barEndMs(bucketTs, intervalMs) > cutMs;
|
|
108
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** What the table says about one Style target: the words its line is titled by and one name per colour slot, each
|
|
2
|
+
* trimmed. A part the entry leaves out, or writes as no words, is absent (a colour list with one slot that has no
|
|
3
|
+
* words names none of its slots), and an output's or a heatmap's entry never carries a title. */
|
|
4
|
+
export interface WrunStyleNameWords {
|
|
5
|
+
label?: string;
|
|
6
|
+
colors?: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
/** The table's words for one Style target (`marks:<name>`, `text:<name>`, an output's name, `heatmap:<name>`), from
|
|
9
|
+
* the first entry that names it (a later one is never read); undefined when the sheet has no table or no entry
|
|
10
|
+
* names the target. An output's or a heatmap's entry gives no label, whatever it writes there. */
|
|
11
|
+
export declare function wrunStyleNameOf(sheet: {
|
|
12
|
+
style_names?: unknown;
|
|
13
|
+
} | null | undefined, target: string): WrunStyleNameWords | undefined;
|
|
14
|
+
/** One name per slot of a colour list of `count` colours: the target's names when the table names exactly that many,
|
|
15
|
+
* else undefined, so a swatch never takes another slot's name (a list naming fewer or more slots names none). */
|
|
16
|
+
export declare function wrunStyleSlotNames(names: WrunStyleNameWords | undefined, count: number): string[] | undefined;
|
|
17
|
+
/** A named target's title, the one order every surface titles it in: the table's label, else the target's own label
|
|
18
|
+
* (`ownLabel`: a batched section's or a heatmap's readout title, as its declaration carries it), else its name read as
|
|
19
|
+
* words (the legend's rule, wrunLegendName: `served_in_part` reads "Served in part"). A heatmap's entry gives no
|
|
20
|
+
* label, so a heatmap reads its own. */
|
|
21
|
+
export declare function wrunStyleTitle(sheet: {
|
|
22
|
+
style_names?: unknown;
|
|
23
|
+
} | null | undefined, target: string, name: string, ownLabel?: unknown): string;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { wrunLegendName } from '../chart/wrun-legend-name.util.js';
|
|
2
|
+
/** Each kind the table names: its Style target prefix, the visibility table's own (a renderer is `text:<name>`, an
|
|
3
|
+
* output its bare name), and whether its entry titles the line (`titles`: a batched section's and a renderer's; an
|
|
4
|
+
* output's and a heatmap's name colours only). A prefix the visibility table changes, a kind the table gains, or a
|
|
5
|
+
* kind's title rule the sheet type disagrees with, fails typecheck here. */
|
|
6
|
+
const STYLE_NAME_KINDS = Object.freeze({
|
|
7
|
+
marks: { prefix: 'marks', titles: true },
|
|
8
|
+
spans: { prefix: 'spans', titles: true },
|
|
9
|
+
rays: { prefix: 'rays', titles: true },
|
|
10
|
+
flags: { prefix: 'flags', titles: true },
|
|
11
|
+
renderer: { prefix: 'text', titles: true },
|
|
12
|
+
output: { prefix: '', titles: false },
|
|
13
|
+
heatmap: { prefix: 'heatmap', titles: false },
|
|
14
|
+
});
|
|
15
|
+
function isRecord(value) {
|
|
16
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
17
|
+
}
|
|
18
|
+
/** Plain words, trimmed; undefined for anything else (a number, an empty or blank string). */
|
|
19
|
+
function wordsOf(value) {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return undefined;
|
|
22
|
+
const words = value.trim();
|
|
23
|
+
return words === '' ? undefined : words;
|
|
24
|
+
}
|
|
25
|
+
/** An entry's kind, when the table knows it. */
|
|
26
|
+
function kindOf(entry) {
|
|
27
|
+
const { kind } = entry;
|
|
28
|
+
return typeof kind === 'string' && Object.hasOwn(STYLE_NAME_KINDS, kind) ? kind : undefined;
|
|
29
|
+
}
|
|
30
|
+
/** An entry's Style target: undefined for a kind the table does not know, or an entry without a name. The name is
|
|
31
|
+
* the section's identity, compared as written (the visibility table's rule: a blank name is none). An output's
|
|
32
|
+
* target is its bare name, so an output entry whose name holds a colon names nothing: it would read as another
|
|
33
|
+
* kind's target (`marks:prints`), and no output target holds one. */
|
|
34
|
+
function targetOf(entry) {
|
|
35
|
+
if (!isRecord(entry))
|
|
36
|
+
return undefined;
|
|
37
|
+
const kind = kindOf(entry);
|
|
38
|
+
const { name } = entry;
|
|
39
|
+
if (kind === undefined || typeof name !== 'string' || name.trim() === '')
|
|
40
|
+
return undefined;
|
|
41
|
+
const { prefix } = STYLE_NAME_KINDS[kind];
|
|
42
|
+
if (prefix === '')
|
|
43
|
+
return name.includes(':') ? undefined : name;
|
|
44
|
+
return `${prefix}:${name}`;
|
|
45
|
+
}
|
|
46
|
+
/** The table's words for one Style target (`marks:<name>`, `text:<name>`, an output's name, `heatmap:<name>`), from
|
|
47
|
+
* the first entry that names it (a later one is never read); undefined when the sheet has no table or no entry
|
|
48
|
+
* names the target. An output's or a heatmap's entry gives no label, whatever it writes there. */
|
|
49
|
+
export function wrunStyleNameOf(sheet, target) {
|
|
50
|
+
const table = sheet?.style_names;
|
|
51
|
+
if (!Array.isArray(table))
|
|
52
|
+
return undefined;
|
|
53
|
+
const entry = table.find((candidate) => targetOf(candidate) === target);
|
|
54
|
+
if (!isRecord(entry))
|
|
55
|
+
return undefined;
|
|
56
|
+
const kind = kindOf(entry);
|
|
57
|
+
const label = kind !== undefined && STYLE_NAME_KINDS[kind].titles ? wordsOf(entry.label) : undefined;
|
|
58
|
+
const colors = Array.isArray(entry.colors) ? entry.colors.map(wordsOf) : [];
|
|
59
|
+
const named = colors.length > 0 && colors.every((name) => name !== undefined);
|
|
60
|
+
return { ...(label !== undefined ? { label } : {}), ...(named ? { colors: colors } : {}) };
|
|
61
|
+
}
|
|
62
|
+
/** One name per slot of a colour list of `count` colours: the target's names when the table names exactly that many,
|
|
63
|
+
* else undefined, so a swatch never takes another slot's name (a list naming fewer or more slots names none). */
|
|
64
|
+
export function wrunStyleSlotNames(names, count) {
|
|
65
|
+
return names?.colors !== undefined && names.colors.length === count ? [...names.colors] : undefined;
|
|
66
|
+
}
|
|
67
|
+
/** A named target's title, the one order every surface titles it in: the table's label, else the target's own label
|
|
68
|
+
* (`ownLabel`: a batched section's or a heatmap's readout title, as its declaration carries it), else its name read as
|
|
69
|
+
* words (the legend's rule, wrunLegendName: `served_in_part` reads "Served in part"). A heatmap's entry gives no
|
|
70
|
+
* label, so a heatmap reads its own. */
|
|
71
|
+
export function wrunStyleTitle(sheet, target, name, ownLabel) {
|
|
72
|
+
const named = wrunStyleNameOf(sheet, target)?.label;
|
|
73
|
+
return wrunLegendName(name, named ?? (typeof ownLabel === 'string' ? ownLabel : undefined));
|
|
74
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The coins floor of a tape (contract C-COINS item 2, `min_coins`): the dollar floor each request asks the
|
|
3
|
+
* large-print table at, priced from the lowest price the request's window traded at, and the live leg's test for its
|
|
4
|
+
* re-plan. Pure: the run pass (wrun-overlay-run.util) reads the candles and owns the asks, and the live tick asks the
|
|
5
|
+
* test (wrun-live-tick.util).
|
|
6
|
+
*
|
|
7
|
+
* - F = min_coins x L x the market's dollar unit x 0.9 (`wrunCoinTapeFloor`), L the lowest low of the candles covering
|
|
8
|
+
* the window. A print of c coins at price p is worth c x p x unit dollars, and every price the window traded at is
|
|
9
|
+
* at least L, so F stays below the value of every print of min_coins or more: none is dropped. The 0.9 is the live
|
|
10
|
+
* leg's room: it keeps the floor while the market trades at or above L x 0.9 and re-plans below it
|
|
11
|
+
* (`wrunCoinTapeFloorBroken`).
|
|
12
|
+
* - The window (`wrunCoinTapeWindow`): what the K_TRADES request reads, the declared history counted back from the
|
|
13
|
+
* ask's as-of, one bar earlier for the control's bar alignment, never before the run window's start, through its
|
|
14
|
+
* end. The control only trims it (retention, the bar limit, the minute grid), so a low over it is never above the
|
|
15
|
+
* low the request reads.
|
|
16
|
+
* - The candles: the chart's own where they are the tape market's prices and hold the window whole
|
|
17
|
+
* (`wrunCandlesLowAcross` with `whole`), else the market's day candles over it (the run's one lane door). A window no
|
|
18
|
+
* candle prices refuses the tape by name (`wrun_tape_coins_unpriced`), never a guess.
|
|
19
|
+
* - The live guard's prices (`wrunCoinTapeGuardLow`): the chart's own bars where they are the market's prices (the
|
|
20
|
+
* acquisition's `priceFromChart`), else every print the session takes off the tape's channel, before any floor
|
|
21
|
+
* (`noteWrunCoinTapePrice`): a formula chart's bars are another series, and prints the floor passes stop arriving
|
|
22
|
+
* exactly when the price falls.
|
|
23
|
+
*/
|
|
24
|
+
import type { WrunTapeAcquisition } from './wrun-tape-source.util.js';
|
|
25
|
+
/** The share of the window's lowest price a coins floor asks at: the live leg re-plans below it. */
|
|
26
|
+
export declare const WRUN_TAPE_COINS_PRICE_MARGIN = 0.9;
|
|
27
|
+
/** The day candles a window the chart's own candles do not hold is priced off: their interval key and length. */
|
|
28
|
+
export declare const WRUN_TAPE_COINS_DAY_INTERVAL = "1d";
|
|
29
|
+
export declare const WRUN_TAPE_COINS_DAY_MS = 86400000;
|
|
30
|
+
/** The day-candle ask over a window: from the open of the UTC day it starts in, through its end. */
|
|
31
|
+
export declare function wrunCoinTapeDayAsk(window: {
|
|
32
|
+
fromMs: number;
|
|
33
|
+
toMs: number;
|
|
34
|
+
}): {
|
|
35
|
+
fromMs: number;
|
|
36
|
+
toMs: number;
|
|
37
|
+
};
|
|
38
|
+
/** The dollar floor a coins tape asks at: `minCoins` x `priceLow` x `dollarUnit` (the market's dollars per price unit
|
|
39
|
+
* and coin, 1 on a market quoted in dollars) x 0.9. Undefined when a factor is not finite and above zero. */
|
|
40
|
+
export declare function wrunCoinTapeFloor(minCoins: number, priceLow: number, dollarUnit: number): number | undefined;
|
|
41
|
+
/** A coins acquisition priced at `priceLow` (its dollar floor beside its coins), undefined when no floor prices.
|
|
42
|
+
* `priceFromChart` records that the chart's own bars are the market's prices, the bars the live guard reads. */
|
|
43
|
+
export declare function wrunPricedCoinTape(tape: Extract<WrunTapeAcquisition, {
|
|
44
|
+
minCoins: number;
|
|
45
|
+
}>, priceLow: number, dollarUnit: number, priceFromChart: boolean): WrunTapeAcquisition | undefined;
|
|
46
|
+
/** The lowest price the live guard compares with the priced low: the chart's bars the session has not passed when the
|
|
47
|
+
* acquisition prices off the chart (`priceFromChart`), else the lowest print the session took off the tape's channel
|
|
48
|
+
* (`tapePriceLow`). Undefined when it has none. */
|
|
49
|
+
export declare function wrunCoinTapeGuardLow(acquisition: {
|
|
50
|
+
priceFromChart?: unknown;
|
|
51
|
+
} | undefined, rows: ReadonlyArray<ArrayLike<number>>, sinceTs: number, tapePriceLow: number | undefined): number | undefined;
|
|
52
|
+
/** Keep the lowest price of a print the session took off a coins tape's channel, before any floor judged it. */
|
|
53
|
+
export declare function noteWrunCoinTapePrice(session: {
|
|
54
|
+
acquisition: {
|
|
55
|
+
tape?: {
|
|
56
|
+
minCoins?: unknown;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
tapePriceLow?: number;
|
|
60
|
+
}, price: number): void;
|
|
61
|
+
/** The lowest print a held live session took off its coins tape (`tapePriceLow`), handed to the next run of the same
|
|
62
|
+
* tape market (the asks' exchange and symbol: the chart's own placeholders, else the run market), undefined for any
|
|
63
|
+
* other. */
|
|
64
|
+
export declare function wrunHeldCoinTapePriceLow(held: {
|
|
65
|
+
acquisition: {
|
|
66
|
+
tape?: {
|
|
67
|
+
minCoins?: unknown;
|
|
68
|
+
exchange?: unknown;
|
|
69
|
+
symbol?: unknown;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
tapePriceLow?: number;
|
|
73
|
+
}, market: {
|
|
74
|
+
exchange: string;
|
|
75
|
+
symbol: string;
|
|
76
|
+
}): number | undefined;
|
|
77
|
+
/** The late-read identity of the tape lane: the run's identity and the tape's own ask, its floor above all, so a read
|
|
78
|
+
* an earlier run left out at another floor (a coins floor priced off another low) is never joined or adopted. */
|
|
79
|
+
export declare function wrunTapeReadIdentity(base: string, ask: {
|
|
80
|
+
minSize?: unknown;
|
|
81
|
+
minValue?: unknown;
|
|
82
|
+
minCoins?: unknown;
|
|
83
|
+
priceLow?: unknown;
|
|
84
|
+
history?: unknown;
|
|
85
|
+
}): string;
|
|
86
|
+
/** Whether a coins acquisition's floor no longer holds at a price the market traded at (`tradedLow`): below
|
|
87
|
+
* `priceLow` x 0.9 the dollar floor could drop a print of `minCoins`. False for any other acquisition. */
|
|
88
|
+
export declare function wrunCoinTapeFloorBroken(acquisition: {
|
|
89
|
+
minCoins?: unknown;
|
|
90
|
+
priceLow?: unknown;
|
|
91
|
+
} | undefined, tradedLow: number | undefined): boolean;
|
|
92
|
+
/** The window a coins tape's request reads (the module note): `[max(fromMs, asOf - history - one bar), toMs]`. */
|
|
93
|
+
export declare function wrunCoinTapeWindow(args: {
|
|
94
|
+
fromMs: number;
|
|
95
|
+
toMs: number;
|
|
96
|
+
asOfMs: number;
|
|
97
|
+
historySeconds: number;
|
|
98
|
+
barMs: number;
|
|
99
|
+
}): {
|
|
100
|
+
fromMs: number;
|
|
101
|
+
toMs: number;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* The lowest low of ascending candle rows across `[fromMs, toMs]`: every row whose span (to the next row's open, the
|
|
105
|
+
* newest one `barMs` long) meets the window. With `whole` (the chart's own rows, whole over the span they hold), only
|
|
106
|
+
* rows that hold the window whole price it (the first opens at or before its start, its end inside the newest row's
|
|
107
|
+
* span), so a window they leave a part of is never priced off the part they hold; without it the caller vouches the
|
|
108
|
+
* rows are a whole answer for the window (a missing bar traded nothing). Undefined when no row in it has a finite low
|
|
109
|
+
* above zero.
|
|
110
|
+
*/
|
|
111
|
+
export declare function wrunCandlesLowAcross(rows: ReadonlyArray<ArrayLike<number>>, window: {
|
|
112
|
+
fromMs: number;
|
|
113
|
+
toMs: number;
|
|
114
|
+
}, barMs: number, whole: boolean): number | undefined;
|
|
115
|
+
/** The lowest low of the rows opening at or after `sinceTs` (the live leg's newest bars), undefined for none. */
|
|
116
|
+
export declare function wrunCandlesLowSince(rows: ReadonlyArray<ArrayLike<number>>, sinceTs: number): number | undefined;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/** The share of the window's lowest price a coins floor asks at: the live leg re-plans below it. */
|
|
2
|
+
export const WRUN_TAPE_COINS_PRICE_MARGIN = 0.9;
|
|
3
|
+
/** The candle row's low column (`[ts, open, high, low, close, volume]`). */
|
|
4
|
+
const LOW_COLUMN = 3;
|
|
5
|
+
/** The day candles a window the chart's own candles do not hold is priced off: their interval key and length. */
|
|
6
|
+
export const WRUN_TAPE_COINS_DAY_INTERVAL = '1d';
|
|
7
|
+
export const WRUN_TAPE_COINS_DAY_MS = 86_400_000;
|
|
8
|
+
/** The day-candle ask over a window: from the open of the UTC day it starts in, through its end. */
|
|
9
|
+
export function wrunCoinTapeDayAsk(window) {
|
|
10
|
+
return {
|
|
11
|
+
fromMs: Math.floor(window.fromMs / WRUN_TAPE_COINS_DAY_MS) * WRUN_TAPE_COINS_DAY_MS,
|
|
12
|
+
toMs: window.toMs,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** The dollar floor a coins tape asks at: `minCoins` x `priceLow` x `dollarUnit` (the market's dollars per price unit
|
|
16
|
+
* and coin, 1 on a market quoted in dollars) x 0.9. Undefined when a factor is not finite and above zero. */
|
|
17
|
+
export function wrunCoinTapeFloor(minCoins, priceLow, dollarUnit) {
|
|
18
|
+
if (![minCoins, priceLow, dollarUnit].every((factor) => Number.isFinite(factor) && factor > 0))
|
|
19
|
+
return undefined;
|
|
20
|
+
const floor = minCoins * priceLow * dollarUnit * WRUN_TAPE_COINS_PRICE_MARGIN;
|
|
21
|
+
return Number.isFinite(floor) && floor > 0 ? floor : undefined;
|
|
22
|
+
}
|
|
23
|
+
/** A coins acquisition priced at `priceLow` (its dollar floor beside its coins), undefined when no floor prices.
|
|
24
|
+
* `priceFromChart` records that the chart's own bars are the market's prices, the bars the live guard reads. */
|
|
25
|
+
export function wrunPricedCoinTape(tape, priceLow, dollarUnit, priceFromChart) {
|
|
26
|
+
const minValue = wrunCoinTapeFloor(tape.minCoins, priceLow, dollarUnit);
|
|
27
|
+
if (minValue === undefined)
|
|
28
|
+
return undefined;
|
|
29
|
+
return { ...tape, minValue, priceLow, ...(priceFromChart ? { priceFromChart: true } : {}) };
|
|
30
|
+
}
|
|
31
|
+
/** The lowest price the live guard compares with the priced low: the chart's bars the session has not passed when the
|
|
32
|
+
* acquisition prices off the chart (`priceFromChart`), else the lowest print the session took off the tape's channel
|
|
33
|
+
* (`tapePriceLow`). Undefined when it has none. */
|
|
34
|
+
export function wrunCoinTapeGuardLow(acquisition, rows, sinceTs, tapePriceLow) {
|
|
35
|
+
return acquisition?.priceFromChart === true ? wrunCandlesLowSince(rows, sinceTs) : tapePriceLow;
|
|
36
|
+
}
|
|
37
|
+
/** Keep the lowest price of a print the session took off a coins tape's channel, before any floor judged it. */
|
|
38
|
+
export function noteWrunCoinTapePrice(session, price) {
|
|
39
|
+
if (session.acquisition.tape?.minCoins === undefined || !(Number.isFinite(price) && price > 0))
|
|
40
|
+
return;
|
|
41
|
+
if (session.tapePriceLow === undefined || price < session.tapePriceLow)
|
|
42
|
+
session.tapePriceLow = price;
|
|
43
|
+
}
|
|
44
|
+
/** The lowest print a held live session took off its coins tape (`tapePriceLow`), handed to the next run of the same
|
|
45
|
+
* tape market (the asks' exchange and symbol: the chart's own placeholders, else the run market), undefined for any
|
|
46
|
+
* other. */
|
|
47
|
+
export function wrunHeldCoinTapePriceLow(held, market) {
|
|
48
|
+
const tape = held.acquisition.tape;
|
|
49
|
+
const sameTape = tape?.minCoins !== undefined && tape.exchange === market.exchange && tape.symbol === market.symbol;
|
|
50
|
+
return sameTape ? held.tapePriceLow : undefined;
|
|
51
|
+
}
|
|
52
|
+
/** The late-read identity of the tape lane: the run's identity and the tape's own ask, its floor above all, so a read
|
|
53
|
+
* an earlier run left out at another floor (a coins floor priced off another low) is never joined or adopted. */
|
|
54
|
+
export function wrunTapeReadIdentity(base, ask) {
|
|
55
|
+
const words = [ask.minSize, ask.minValue, ask.minCoins, ask.priceLow, ask.history];
|
|
56
|
+
return [base, 'tape', ...words.map((word) => (word === undefined ? '' : String(word)))].join('|');
|
|
57
|
+
}
|
|
58
|
+
/** Whether a coins acquisition's floor no longer holds at a price the market traded at (`tradedLow`): below
|
|
59
|
+
* `priceLow` x 0.9 the dollar floor could drop a print of `minCoins`. False for any other acquisition. */
|
|
60
|
+
export function wrunCoinTapeFloorBroken(acquisition, tradedLow) {
|
|
61
|
+
const priceLow = Number(acquisition?.priceLow);
|
|
62
|
+
if (acquisition?.minCoins === undefined || !Number.isFinite(priceLow) || tradedLow === undefined)
|
|
63
|
+
return false;
|
|
64
|
+
return Number.isFinite(tradedLow) && tradedLow < priceLow * WRUN_TAPE_COINS_PRICE_MARGIN;
|
|
65
|
+
}
|
|
66
|
+
/** The window a coins tape's request reads (the module note): `[max(fromMs, asOf - history - one bar), toMs]`. */
|
|
67
|
+
export function wrunCoinTapeWindow(args) {
|
|
68
|
+
const seedMs = Math.min(args.asOfMs, args.toMs) - args.historySeconds * 1000 - Math.max(0, args.barMs);
|
|
69
|
+
return { fromMs: Math.max(args.fromMs, seedMs), toMs: args.toMs };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The lowest low of ascending candle rows across `[fromMs, toMs]`: every row whose span (to the next row's open, the
|
|
73
|
+
* newest one `barMs` long) meets the window. With `whole` (the chart's own rows, whole over the span they hold), only
|
|
74
|
+
* rows that hold the window whole price it (the first opens at or before its start, its end inside the newest row's
|
|
75
|
+
* span), so a window they leave a part of is never priced off the part they hold; without it the caller vouches the
|
|
76
|
+
* rows are a whole answer for the window (a missing bar traded nothing). Undefined when no row in it has a finite low
|
|
77
|
+
* above zero.
|
|
78
|
+
*/
|
|
79
|
+
export function wrunCandlesLowAcross(rows, window, barMs, whole) {
|
|
80
|
+
if (rows.length === 0 || !(barMs > 0) || !(window.toMs >= window.fromMs))
|
|
81
|
+
return undefined;
|
|
82
|
+
const lastTs = Number(rows[rows.length - 1][0]);
|
|
83
|
+
if (whole && !(Number(rows[0][0]) <= window.fromMs && window.toMs < lastTs + barMs))
|
|
84
|
+
return undefined;
|
|
85
|
+
let low = Number.POSITIVE_INFINITY;
|
|
86
|
+
for (let at = 0; at < rows.length; at += 1) {
|
|
87
|
+
const ts = Number(rows[at][0]);
|
|
88
|
+
if (!Number.isFinite(ts) || ts > window.toMs)
|
|
89
|
+
break;
|
|
90
|
+
const end = at + 1 < rows.length ? Number(rows[at + 1][0]) : ts + barMs;
|
|
91
|
+
if (end <= window.fromMs)
|
|
92
|
+
continue;
|
|
93
|
+
const rowLow = Number(rows[at][LOW_COLUMN]);
|
|
94
|
+
if (Number.isFinite(rowLow) && rowLow > 0 && rowLow < low)
|
|
95
|
+
low = rowLow;
|
|
96
|
+
}
|
|
97
|
+
return Number.isFinite(low) ? low : undefined;
|
|
98
|
+
}
|
|
99
|
+
/** The lowest low of the rows opening at or after `sinceTs` (the live leg's newest bars), undefined for none. */
|
|
100
|
+
export function wrunCandlesLowSince(rows, sinceTs) {
|
|
101
|
+
let low = Number.POSITIVE_INFINITY;
|
|
102
|
+
for (let at = rows.length - 1; at >= 0; at -= 1) {
|
|
103
|
+
if (!(Number(rows[at][0]) >= sinceTs))
|
|
104
|
+
break;
|
|
105
|
+
const rowLow = Number(rows[at][LOW_COLUMN]);
|
|
106
|
+
if (Number.isFinite(rowLow) && rowLow > 0 && rowLow < low)
|
|
107
|
+
low = rowLow;
|
|
108
|
+
}
|
|
109
|
+
return Number.isFinite(low) ? low : undefined;
|
|
110
|
+
}
|