@orangecharts/wrun-chart-host 0.4.0 → 0.5.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 +15 -4
- package/dist/constants/exchange-names.leaf.d.ts +8 -0
- package/dist/constants/exchange-names.leaf.js +101 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
- package/dist/constants/opra-compliance.constants.d.ts +19 -0
- package/dist/constants/opra-compliance.constants.js +19 -0
- package/dist/constants/replay-ladder.leaf.d.ts +30 -0
- package/dist/constants/replay-ladder.leaf.js +99 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
- package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
- package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
- package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
- package/dist/constants/scriptEditor/execution.constants.js +14 -0
- package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
- package/dist/constants/wrun-prefix-safe.constants.js +26 -0
- package/dist/host-env.d.ts +313 -18
- package/dist/host-env.js +15 -0
- package/dist/host-ports.types.d.ts +853 -16
- package/dist/index.d.ts +139 -2
- package/dist/index.js +139 -2
- package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
- package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
- package/dist/interfaces/market-event.interface.d.ts +231 -0
- package/dist/interfaces/market-event.interface.js +15 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
- package/dist/interfaces/opra-realtime.interface.js +34 -59
- package/dist/interfaces/replay.interface.d.ts +285 -0
- package/dist/interfaces/replay.interface.js +1 -0
- package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
- package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
- package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
- package/dist/market-data/billing.interface.d.ts +219 -0
- package/dist/market-data/billing.interface.js +58 -0
- package/dist/market-data/venue-governed.util.d.ts +2 -0
- package/dist/market-data/venue-governed.util.js +10 -0
- package/dist/market-data/venue.d.ts +122 -0
- package/dist/market-data/venue.js +1 -0
- package/dist/market-data/venues/index.d.ts +97 -0
- package/dist/market-data/venues/index.js +33 -0
- package/dist/market-data/venues/opra.contract.copy.json +35 -0
- package/dist/market-data/venues/opra.d.ts +70 -0
- package/dist/market-data/venues/opra.js +74 -0
- package/dist/replay/replayIndicatorRows.d.ts +31 -0
- package/dist/replay/replayIndicatorRows.js +117 -0
- package/dist/replay/replayLadder.d.ts +85 -0
- package/dist/replay/replayLadder.js +388 -0
- package/dist/utility/auth/server-clock.util.d.ts +81 -0
- package/dist/utility/auth/server-clock.util.js +238 -0
- package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
- package/dist/utility/chart/builtin-identity.util.js +51 -0
- package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
- package/dist/utility/chart/cache-alignment.util.js +926 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
- package/dist/utility/chart/chart-mount-epoch.util.d.ts +5 -0
- package/dist/utility/chart/chart-mount-epoch.util.js +29 -0
- package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
- package/dist/utility/chart/chart-time-domain.util.js +23 -0
- package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
- package/dist/utility/chart/color-customization.leaf.js +16 -0
- package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
- package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
- package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
- package/dist/utility/chart/gesture-timing.leaf.js +29 -0
- package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
- package/dist/utility/chart/governed-contract-coin.util.js +39 -0
- package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
- package/dist/utility/chart/host-bar-placement.util.js +447 -0
- package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
- package/dist/utility/chart/index-host-tier.util.js +118 -0
- package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
- package/dist/utility/chart/index-mode-admission.util.js +67 -0
- package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
- package/dist/utility/chart/indicator-error-message.util.js +44 -0
- package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
- package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
- package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
- package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
- package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
- package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
- package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
- package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
- package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
- package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
- package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
- package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
- package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
- package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
- package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
- package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
- package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
- package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
- package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
- package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
- package/dist/utility/chart/kscript-source-retention.util.js +218 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
- package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
- package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
- package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
- package/dist/utility/chart/live-cadence.util.d.ts +38 -0
- package/dist/utility/chart/live-cadence.util.js +37 -0
- package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
- package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
- package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
- package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
- package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
- package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
- package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
- package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
- package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
- package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
- package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
- package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
- package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
- package/dist/utility/chart/mixed-mode.util.js +139 -0
- package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
- package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
- package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
- package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
- package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
- package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
- package/dist/utility/chart/price-precision.util.d.ts +40 -0
- package/dist/utility/chart/price-precision.util.js +70 -0
- package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
- package/dist/utility/chart/profile-block-size.util.js +141 -0
- package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
- package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
- package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
- package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
- package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
- package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
- package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
- package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
- package/dist/utility/chart/titan-constants.pin.js +18 -5
- package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
- package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
- package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
- package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
- package/dist/utility/chart/wrun-run-result.util.js +20 -14
- package/dist/utility/common/data-processing.util.d.ts +138 -0
- package/dist/utility/common/data-processing.util.js +346 -0
- package/dist/utility/common/visible-timeout.util.d.ts +13 -4
- package/dist/utility/common/visible-timeout.util.js +23 -8
- package/dist/utility/exchange-format.leaf.d.ts +1 -0
- package/dist/utility/exchange-format.leaf.js +47 -0
- package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
- package/dist/utility/market-events/earnings-scope.util.js +92 -0
- package/dist/utility/market-events/market-events.util.d.ts +147 -0
- package/dist/utility/market-events/market-events.util.js +392 -0
- package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
- package/dist/utility/market-events/zoned-clock.util.js +11 -0
- package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
- package/dist/utility/options/option-venue-disclosure.util.js +56 -0
- package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
- package/dist/utility/scriptEditor/package-semver.util.js +120 -0
- package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
- package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
- package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
- package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
- package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
- package/dist/utility/v2/governed-tier.leaf.js +113 -0
- package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
- package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
- package/dist/utility/wrun/sources/lanes/series.js +2 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +4 -4
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +5 -6
- package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
- package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
- package/dist/utility/wrun/wrun-bar-count.util.d.ts +83 -0
- package/dist/utility/wrun/wrun-bar-count.util.js +259 -0
- package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
- package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
- package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
- package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
- package/dist/utility/wrun/wrun-deadline.util.js +2 -1
- package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
- package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
- package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
- package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
- package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
- package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
- package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
- package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
- package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
- package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
- package/dist/utility/wrun/wrun-host.service.d.ts +266 -0
- package/dist/utility/wrun/wrun-host.service.js +655 -0
- package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
- package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
- package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
- package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
- package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
- package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
- package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
- package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
- package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
- package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
- package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
- package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
- package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
- package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
- package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
- package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
- package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
- package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +24 -9
- package/dist/utility/wrun/wrun-panel-mount.util.js +138 -43
- package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
- package/dist/utility/wrun/wrun-param-map.util.js +40 -47
- package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
- package/dist/utility/wrun/wrun-param-values.util.js +5 -5
- package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
- package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
- package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
- package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
- package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
- package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
- package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
- package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
- package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
- package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
- package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
- package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
- package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
- package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
- package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
- package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
- package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
- package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
- package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
- package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
- package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
- package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
- package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
- package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
- package/dist/utility/wrun/wrun-text-params.util.js +19 -30
- package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
- package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
- package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
- package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
- package/dist/utility/wrun-alert-params.leaf.js +24 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
- package/dist/utils/replay/replay-buffer-math.js +684 -0
- package/dist/workers/wrun/wrun-abi-host.d.ts +190 -0
- package/dist/workers/wrun/wrun-abi-host.js +1201 -0
- package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
- package/dist/workers/wrun/wrun-engine-handler.js +211 -0
- package/package.json +3 -3
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { EarningsSlot, MarketAssetClass, MarketEvent, MarketEventImpact, MarketEventSeriesLink } from '../../interfaces/market-event.interface.js';
|
|
2
|
+
import { type VenueMarketKind } from '../chart/marketKind.util.js';
|
|
3
|
+
/** Chart-side market kind → the server's relevance bucket. */
|
|
4
|
+
export declare function assetClassForMarketKind(kind: VenueMarketKind): MarketAssetClass;
|
|
5
|
+
export declare function assetClassForExchange(exchange: string | null | undefined): MarketAssetClass;
|
|
6
|
+
/**
|
|
7
|
+
* Whether a row may count down: earnings reports and dividends never do. They
|
|
8
|
+
* never become the NEXT EVENT cell, the footer chip, the countdown line or a
|
|
9
|
+
* fast poll, whatever list they are merged into.
|
|
10
|
+
*/
|
|
11
|
+
export declare function countsDown(event: Pick<MarketEvent, 'kind'>): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The actual printed (an exact row past its instant with a value, or any row
|
|
14
|
+
* past its instant). A dividend is released only once its ex-date passed: its
|
|
15
|
+
* amount rides the dividend block, never `actual`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isReleased(event: MarketEvent, now: number): boolean;
|
|
18
|
+
export declare function isRecentlyReleased(event: MarketEvent, now: number, holdMs?: number): boolean;
|
|
19
|
+
/** The next exact print at or above `minImpact` after `now`; never an earnings report or a dividend (`countsDown`). */
|
|
20
|
+
export declare function nextEvent(events: MarketEvent[], now: number, minImpact?: MarketEventImpact): MarketEvent | null;
|
|
21
|
+
/**
|
|
22
|
+
* The most recent print (exact, at or above `minImpact`) still inside the
|
|
23
|
+
* hold window, so the surfaces can show "CPI 3.1% ▲" for a while. Earnings
|
|
24
|
+
* reports and dividends never hold the surfaces (`countsDown`).
|
|
25
|
+
*/
|
|
26
|
+
export declare function recentlyReleasedEvent(events: MarketEvent[], now: number, minImpact?: MarketEventImpact, holdMs?: number): MarketEvent | null;
|
|
27
|
+
export interface ReleaseGroup {
|
|
28
|
+
id: string;
|
|
29
|
+
at: number;
|
|
30
|
+
/** Highest impact first, then title; the first is the group representative. */
|
|
31
|
+
events: MarketEvent[];
|
|
32
|
+
}
|
|
33
|
+
/** Rows that print at the same instant, sorted by release time. */
|
|
34
|
+
export declare function groupByRelease(events: MarketEvent[]): ReleaseGroup[];
|
|
35
|
+
/** Short name for tight surfaces: "US CPI (YoY)" → "CPI", "US FOMC rate decision" → "FOMC". */
|
|
36
|
+
export declare function shortTitle(event: MarketEvent): string;
|
|
37
|
+
/** Unit labels for a duration; the English defaults are what specs and dev tooling see. */
|
|
38
|
+
export interface CountdownUnits {
|
|
39
|
+
day: string;
|
|
40
|
+
hour: string;
|
|
41
|
+
minute: string;
|
|
42
|
+
lessThanMinute: string;
|
|
43
|
+
}
|
|
44
|
+
/** Wraps a duration into the "in …" phrase; the English default is replaced by a localized one in components. */
|
|
45
|
+
export type CountdownWrap = (duration: string) => string;
|
|
46
|
+
/** "in 18m", "in 4h 48m", "in 6d 5h"; null once the instant has passed. */
|
|
47
|
+
export declare function formatCountdown(msLeft: number, units?: CountdownUnits, wrap?: CountdownWrap): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* The Events tab's countdown: "17:04" under an hour, "2h 17m" under a day,
|
|
50
|
+
* "2d 3h" beyond. No "in": the column header already says so.
|
|
51
|
+
*/
|
|
52
|
+
export declare function formatCompactCountdown(msLeft: number, units?: CountdownUnits): string | null;
|
|
53
|
+
/** "42m ago", "3h ago", "2d ago" for a print behind us. */
|
|
54
|
+
export declare function formatCompactAgo(msAgo: number, units?: CountdownUnits): string | null;
|
|
55
|
+
/** "18:22" for the ticker cell inside the last hour, else the coarse countdown. */
|
|
56
|
+
export declare function formatTickerCountdown(msLeft: number, units?: CountdownUnits, wrap?: CountdownWrap): string | null;
|
|
57
|
+
/** "08:30" in a fixed UTC-offset zone (the chart's time zone). */
|
|
58
|
+
export declare function formatClock(at: number, offsetMs: number): string;
|
|
59
|
+
/**
|
|
60
|
+
* Rows that carry a number once released: macro and central-bank prints from
|
|
61
|
+
* a vendor, and earnings reports (the EPS). Expiries, auctions, holidays and
|
|
62
|
+
* dividends only ever pass, and an official agency calendar row never carries
|
|
63
|
+
* a value either (the chart reads its linked series), so no surface may show
|
|
64
|
+
* it as pending a number.
|
|
65
|
+
*/
|
|
66
|
+
export declare function printsValue(event: Pick<MarketEvent, 'kind' | 'source'>): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* When an earnings row reports against the US session: the served slot, else
|
|
69
|
+
* (a slot the row lacks) the one its Eastern clock gives; `unknown` for a
|
|
70
|
+
* date-only row, whose instant is an ordering placeholder. Null for every
|
|
71
|
+
* other kind.
|
|
72
|
+
*/
|
|
73
|
+
export declare function earningsSlot(event: Pick<MarketEvent, 'kind' | 'timing' | 'at' | 'earnings'>): EarningsSlot | null;
|
|
74
|
+
/**
|
|
75
|
+
* The equity ticker a pane shows, synchronously: a US stock pane (POLYGON,
|
|
76
|
+
* its US_STOCKS alias, or a legacy listing venue NYSE / NASDAQ / CBOE) names
|
|
77
|
+
* it before the slash (`JPM/USD` → `JPM`). Null for any other market, and for
|
|
78
|
+
* a symbol the calendar could not be asked about. HIP-3 panes resolve through
|
|
79
|
+
* `usePaneTicker`.
|
|
80
|
+
*/
|
|
81
|
+
export declare function paneTicker(metadata: {
|
|
82
|
+
exchange?: string | null;
|
|
83
|
+
symbol?: string | null;
|
|
84
|
+
} | null | undefined): string | null;
|
|
85
|
+
/** The first series an event links, the headline of the release; null when nothing is linked. */
|
|
86
|
+
export declare function headlineSeriesLink(event: Pick<MarketEvent, 'seriesLinks'>): MarketEventSeriesLink | null;
|
|
87
|
+
/** The agencies the release map names; each has a short form in the locale bundles (`marketEvents.publishers.*`). */
|
|
88
|
+
export type AgencyPublisherId = 'bls' | 'bea' | 'census' | 'dol' | 'fed' | 'ecb' | 'eurostat' | 'ons';
|
|
89
|
+
/** The agency behind a served publisher name, or null for one the map does not know. */
|
|
90
|
+
export declare function publisherId(publisher: string | null | undefined): AgencyPublisherId | null;
|
|
91
|
+
/** How long a value-bearing print past its instant reads as "printing now" before it is just pending. */
|
|
92
|
+
export declare const PRINTING_HOLD_MS: number;
|
|
93
|
+
export declare function surpriseGlyph(event: MarketEvent): string;
|
|
94
|
+
/** Escape vendor text before it rides an HTML-capable tooltip. */
|
|
95
|
+
export declare function escapeHtml(text: string): string;
|
|
96
|
+
export declare function isSourceFresh(lastSyncAt: number | null | undefined, now: number): boolean;
|
|
97
|
+
/** Day bucket in a fixed UTC-offset zone (the chart's time zone), for list headers. */
|
|
98
|
+
export declare function dayKey(at: number, offsetMs: number): string;
|
|
99
|
+
/**
|
|
100
|
+
* The calendar day a row belongs to in the zone. A date-only row (every
|
|
101
|
+
* dividend, a report with no announced time) carries a 09:30 Eastern
|
|
102
|
+
* placeholder instant that only orders the day: it keeps its US date in every
|
|
103
|
+
* zone, instead of sliding to the next day east of UTC+10.
|
|
104
|
+
*/
|
|
105
|
+
export declare function rowDayKey(event: Pick<MarketEvent, 'at'> & {
|
|
106
|
+
timing?: MarketEvent['timing'];
|
|
107
|
+
}, offsetMs: number): string;
|
|
108
|
+
/** Where a day sits relative to today; the panels localize it ("Today", "Tomorrow", else the date). */
|
|
109
|
+
export type DayGroupKey = 'today' | 'tomorrow' | 'date';
|
|
110
|
+
export interface DayGroup<T extends Pick<MarketEvent, 'at'> = MarketEvent> {
|
|
111
|
+
key: DayGroupKey;
|
|
112
|
+
/** `YYYY-MM-DD` in the zone. */
|
|
113
|
+
dateKey: string;
|
|
114
|
+
/** The instant the day starts in the zone, epoch ms. */
|
|
115
|
+
dayStartMs: number;
|
|
116
|
+
/** The day's rows, in the order given. */
|
|
117
|
+
events: T[];
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Rows by calendar day in a fixed UTC-offset zone (the chart's time zone), in
|
|
121
|
+
* order of first appearance (pass rows sorted by time). Raw keys only: the
|
|
122
|
+
* panels word them.
|
|
123
|
+
*/
|
|
124
|
+
export declare function dayGroups<T extends Pick<MarketEvent, 'at'> & {
|
|
125
|
+
timing?: MarketEvent['timing'];
|
|
126
|
+
} = MarketEvent>(events: readonly T[], nowMs: number, offsetMs: number): DayGroup<T>[];
|
|
127
|
+
/** Whether an exact print is close enough that surfaces should poll fast; earnings and dividends never count. */
|
|
128
|
+
export declare function isNearRelease(events: MarketEvent[], now: number, beforeMs: number, afterMs: number): boolean;
|
|
129
|
+
export interface ChartReach {
|
|
130
|
+
/** The instant sits within CHART_REACH_BARS of now on this interval (or behind us). */
|
|
131
|
+
ok: boolean;
|
|
132
|
+
/** The chart's interval label ("1h"), for the note. */
|
|
133
|
+
interval: string;
|
|
134
|
+
barsAhead: number;
|
|
135
|
+
/** The smallest interval that brings the instant within reach, when this one cannot. */
|
|
136
|
+
suggested: string | null;
|
|
137
|
+
}
|
|
138
|
+
export declare function chartReach(at: number, now: number, intervalMs: number, interval: string): ChartReach;
|
|
139
|
+
/**
|
|
140
|
+
* The visible range that frames an instant: a printed one is centred; a
|
|
141
|
+
* coming one keeps the latest candles on screen and the marker just inside
|
|
142
|
+
* the right edge, so the chart never opens on empty space with a lone line.
|
|
143
|
+
*/
|
|
144
|
+
export declare function frameWindow(at: number, now: number, intervalMs: number): {
|
|
145
|
+
start: number;
|
|
146
|
+
end: number;
|
|
147
|
+
};
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { checkIsPolygon, getMarketKind } from '../chart/marketKind.util.js';
|
|
2
|
+
import { EARNINGS_TICKER_PATTERN } from './earnings-scope.util.js';
|
|
3
|
+
import { easternTime } from './zoned-clock.util.js';
|
|
4
|
+
/** Chart-side market kind → the server's relevance bucket. */
|
|
5
|
+
export function assetClassForMarketKind(kind) {
|
|
6
|
+
switch (kind) {
|
|
7
|
+
case 'futures':
|
|
8
|
+
case 'commodity':
|
|
9
|
+
case 'forex':
|
|
10
|
+
return 'cme';
|
|
11
|
+
case 'tradfi':
|
|
12
|
+
return 'tradfi';
|
|
13
|
+
case 'hip3':
|
|
14
|
+
return 'hip3';
|
|
15
|
+
case 'polymarket':
|
|
16
|
+
return 'polymarket';
|
|
17
|
+
default:
|
|
18
|
+
return 'crypto';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function assetClassForExchange(exchange) {
|
|
22
|
+
return assetClassForMarketKind(getMarketKind(exchange));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Whether a row may count down: earnings reports and dividends never do. They
|
|
26
|
+
* never become the NEXT EVENT cell, the footer chip, the countdown line or a
|
|
27
|
+
* fast poll, whatever list they are merged into.
|
|
28
|
+
*/
|
|
29
|
+
export function countsDown(event) {
|
|
30
|
+
return event.kind !== 'earnings' && event.kind !== 'dividend';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The actual printed (an exact row past its instant with a value, or any row
|
|
34
|
+
* past its instant). A dividend is released only once its ex-date passed: its
|
|
35
|
+
* amount rides the dividend block, never `actual`.
|
|
36
|
+
*/
|
|
37
|
+
export function isReleased(event, now) {
|
|
38
|
+
if (event.kind === 'dividend')
|
|
39
|
+
return event.at <= now;
|
|
40
|
+
return event.actual !== null || event.at <= now;
|
|
41
|
+
}
|
|
42
|
+
/** After the print the chip and the axis label keep showing the number this long. */
|
|
43
|
+
const RELEASE_HOLD_MS = 30 * 60 * 1000;
|
|
44
|
+
export function isRecentlyReleased(event, now, holdMs = RELEASE_HOLD_MS) {
|
|
45
|
+
return event.actual !== null && event.at <= now && now - event.at <= holdMs;
|
|
46
|
+
}
|
|
47
|
+
/** The next exact print at or above `minImpact` after `now`; never an earnings report or a dividend (`countsDown`). */
|
|
48
|
+
export function nextEvent(events, now, minImpact = 2) {
|
|
49
|
+
let best = null;
|
|
50
|
+
for (const event of events) {
|
|
51
|
+
if (!countsDown(event))
|
|
52
|
+
continue;
|
|
53
|
+
if (event.timing !== 'exact' || event.impact < minImpact || event.at <= now)
|
|
54
|
+
continue;
|
|
55
|
+
if (!best || event.at < best.at || (event.at === best.at && byImpactThenTitle(event, best) < 0))
|
|
56
|
+
best = event;
|
|
57
|
+
}
|
|
58
|
+
return best;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The most recent print (exact, at or above `minImpact`) still inside the
|
|
62
|
+
* hold window, so the surfaces can show "CPI 3.1% ▲" for a while. Earnings
|
|
63
|
+
* reports and dividends never hold the surfaces (`countsDown`).
|
|
64
|
+
*/
|
|
65
|
+
export function recentlyReleasedEvent(events, now, minImpact = 2, holdMs = RELEASE_HOLD_MS) {
|
|
66
|
+
let best = null;
|
|
67
|
+
for (const event of events) {
|
|
68
|
+
if (!countsDown(event) || event.timing !== 'exact' || event.impact < minImpact)
|
|
69
|
+
continue;
|
|
70
|
+
if (!isRecentlyReleased(event, now, holdMs))
|
|
71
|
+
continue;
|
|
72
|
+
if (!best || event.at > best.at)
|
|
73
|
+
best = event;
|
|
74
|
+
}
|
|
75
|
+
return best;
|
|
76
|
+
}
|
|
77
|
+
// Headline prints lead their "core" siblings at equal impact (CPI before
|
|
78
|
+
// Core CPI), then alphabetical, so the representative is stable across fetches.
|
|
79
|
+
const corePenalty = (event) => (/\bcore\b/i.test(event.title) ? 1 : 0);
|
|
80
|
+
const byImpactThenTitle = (a, b) => b.impact - a.impact || corePenalty(a) - corePenalty(b) || a.title.localeCompare(b.title);
|
|
81
|
+
/** Rows that print at the same instant, sorted by release time. */
|
|
82
|
+
export function groupByRelease(events) {
|
|
83
|
+
const groups = new Map();
|
|
84
|
+
for (const event of events) {
|
|
85
|
+
const key = `${event.releaseGroupId}|${event.at}`;
|
|
86
|
+
let group = groups.get(key);
|
|
87
|
+
if (!group) {
|
|
88
|
+
group = { id: event.releaseGroupId, at: event.at, events: [] };
|
|
89
|
+
groups.set(key, group);
|
|
90
|
+
}
|
|
91
|
+
group.events.push(event);
|
|
92
|
+
}
|
|
93
|
+
const out = [...groups.values()];
|
|
94
|
+
for (const group of out)
|
|
95
|
+
group.events.sort(byImpactThenTitle);
|
|
96
|
+
out.sort((a, b) => a.at - b.at);
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
// Short names for the chip and the ticker cell: the first match wins, then
|
|
100
|
+
// the region prefix and the change basis are stripped and the title is
|
|
101
|
+
// clipped. Order matters (Core CPI before CPI).
|
|
102
|
+
const SHORT_TITLES = [
|
|
103
|
+
[/initial jobless claims/i, 'Claims'],
|
|
104
|
+
[/nonfarm payrolls|non-farm payrolls|employment situation/i, 'NFP'],
|
|
105
|
+
[/unemployment rate/i, 'Unemployment'],
|
|
106
|
+
[/average hourly earnings/i, 'Earnings'],
|
|
107
|
+
[/core cpi/i, 'Core CPI'],
|
|
108
|
+
[/\bcpi\b|consumer price inflation/i, 'CPI'],
|
|
109
|
+
[/\bhicp\b/i, 'HICP'],
|
|
110
|
+
[/core pce/i, 'Core PCE'],
|
|
111
|
+
[/\bpce\b/i, 'PCE'],
|
|
112
|
+
[/\bppi\b/i, 'PPI'],
|
|
113
|
+
[/\bgdp\b/i, 'GDP'],
|
|
114
|
+
[/fomc/i, 'FOMC'],
|
|
115
|
+
[/\becb\b/i, 'ECB'],
|
|
116
|
+
[/retail sales/i, 'Retail sales'],
|
|
117
|
+
[/durable goods/i, 'Durables'],
|
|
118
|
+
[/housing starts/i, 'Housing'],
|
|
119
|
+
[/trade balance/i, 'Trade balance'],
|
|
120
|
+
[/jolts|job openings/i, 'JOLTS'],
|
|
121
|
+
[/deribit .*expiry/i, 'Deribit expiry'],
|
|
122
|
+
[/cme .*expiry/i, 'CME expiry'],
|
|
123
|
+
[/^(\d+)-(year|month|week) (note|bond|bill)/i, '$1$2 $3'],
|
|
124
|
+
];
|
|
125
|
+
/** Short name for tight surfaces: "US CPI (YoY)" → "CPI", "US FOMC rate decision" → "FOMC". */
|
|
126
|
+
export function shortTitle(event) {
|
|
127
|
+
for (const [pattern, name] of SHORT_TITLES) {
|
|
128
|
+
if (!pattern.test(event.title))
|
|
129
|
+
continue;
|
|
130
|
+
if (!name.includes('$'))
|
|
131
|
+
return name;
|
|
132
|
+
return event.title
|
|
133
|
+
.replace(pattern, (_m, count, unit, kind) => `${count}${unit[0].toUpperCase()} ${kind}`)
|
|
134
|
+
.replace(/\s+(auction|reopening)$/i, '')
|
|
135
|
+
.trim();
|
|
136
|
+
}
|
|
137
|
+
const stripped = event.title
|
|
138
|
+
.replace(/^(US|EU|UK|JP|CA|AU|CH|CN)\s+/, '')
|
|
139
|
+
.replace(/\s*\((YoY|MoM|QoQ|QoQ, SAAR)\)\s*$/i, '')
|
|
140
|
+
.trim();
|
|
141
|
+
return stripped.length > 16 ? `${stripped.slice(0, 15)}…` : stripped;
|
|
142
|
+
}
|
|
143
|
+
const ENGLISH_COUNTDOWN_UNITS = { day: 'd', hour: 'h', minute: 'm', lessThanMinute: '<1m' };
|
|
144
|
+
const englishWrap = (duration) => `in ${duration}`;
|
|
145
|
+
/** "18m", "4h 48m", "6d 5h", "<1m"; null once the instant has passed. */
|
|
146
|
+
function formatDuration(msLeft, units = ENGLISH_COUNTDOWN_UNITS) {
|
|
147
|
+
if (!Number.isFinite(msLeft) || msLeft <= 0)
|
|
148
|
+
return null;
|
|
149
|
+
const totalMinutes = Math.floor(msLeft / 60_000);
|
|
150
|
+
if (totalMinutes < 1)
|
|
151
|
+
return units.lessThanMinute;
|
|
152
|
+
if (totalMinutes < 60)
|
|
153
|
+
return `${totalMinutes}${units.minute}`;
|
|
154
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
155
|
+
const minutes = totalMinutes % 60;
|
|
156
|
+
if (hours < 24)
|
|
157
|
+
return minutes > 0 ? `${hours}${units.hour} ${minutes}${units.minute}` : `${hours}${units.hour}`;
|
|
158
|
+
const days = Math.floor(hours / 24);
|
|
159
|
+
const remHours = hours % 24;
|
|
160
|
+
return remHours > 0 ? `${days}${units.day} ${remHours}${units.hour}` : `${days}${units.day}`;
|
|
161
|
+
}
|
|
162
|
+
/** "in 18m", "in 4h 48m", "in 6d 5h"; null once the instant has passed. */
|
|
163
|
+
export function formatCountdown(msLeft, units = ENGLISH_COUNTDOWN_UNITS, wrap = englishWrap) {
|
|
164
|
+
const duration = formatDuration(msLeft, units);
|
|
165
|
+
return duration === null ? null : wrap(duration);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The Events tab's countdown: "17:04" under an hour, "2h 17m" under a day,
|
|
169
|
+
* "2d 3h" beyond. No "in": the column header already says so.
|
|
170
|
+
*/
|
|
171
|
+
export function formatCompactCountdown(msLeft, units = ENGLISH_COUNTDOWN_UNITS) {
|
|
172
|
+
if (!Number.isFinite(msLeft) || msLeft <= 0)
|
|
173
|
+
return null;
|
|
174
|
+
if (msLeft < 60 * 60 * 1000) {
|
|
175
|
+
const totalSeconds = Math.floor(msLeft / 1000);
|
|
176
|
+
return `${String(Math.floor(totalSeconds / 60)).padStart(2, '0')}:${String(totalSeconds % 60).padStart(2, '0')}`;
|
|
177
|
+
}
|
|
178
|
+
return formatDuration(msLeft, units);
|
|
179
|
+
}
|
|
180
|
+
/** "42m ago", "3h ago", "2d ago" for a print behind us. */
|
|
181
|
+
export function formatCompactAgo(msAgo, units = ENGLISH_COUNTDOWN_UNITS) {
|
|
182
|
+
if (!Number.isFinite(msAgo) || msAgo < 0)
|
|
183
|
+
return null;
|
|
184
|
+
const minutes = Math.floor(msAgo / 60_000);
|
|
185
|
+
if (minutes < 1)
|
|
186
|
+
return units.lessThanMinute;
|
|
187
|
+
if (minutes < 60)
|
|
188
|
+
return `${minutes}${units.minute}`;
|
|
189
|
+
const hours = Math.floor(minutes / 60);
|
|
190
|
+
if (hours < 24)
|
|
191
|
+
return `${hours}${units.hour}`;
|
|
192
|
+
return `${Math.floor(hours / 24)}${units.day}`;
|
|
193
|
+
}
|
|
194
|
+
/** "18:22" for the ticker cell inside the last hour, else the coarse countdown. */
|
|
195
|
+
export function formatTickerCountdown(msLeft, units = ENGLISH_COUNTDOWN_UNITS, wrap = englishWrap) {
|
|
196
|
+
if (!Number.isFinite(msLeft) || msLeft <= 0)
|
|
197
|
+
return null;
|
|
198
|
+
if (msLeft >= 60 * 60 * 1000)
|
|
199
|
+
return formatCountdown(msLeft, units, wrap);
|
|
200
|
+
const totalSeconds = Math.floor(msLeft / 1000);
|
|
201
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
202
|
+
const seconds = totalSeconds % 60;
|
|
203
|
+
return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
|
|
204
|
+
}
|
|
205
|
+
/** "08:30" in a fixed UTC-offset zone (the chart's time zone). */
|
|
206
|
+
export function formatClock(at, offsetMs) {
|
|
207
|
+
const shifted = new Date(at + offsetMs);
|
|
208
|
+
return `${String(shifted.getUTCHours()).padStart(2, '0')}:${String(shifted.getUTCMinutes()).padStart(2, '0')}`;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Rows that carry a number once released: macro and central-bank prints from
|
|
212
|
+
* a vendor, and earnings reports (the EPS). Expiries, auctions, holidays and
|
|
213
|
+
* dividends only ever pass, and an official agency calendar row never carries
|
|
214
|
+
* a value either (the chart reads its linked series), so no surface may show
|
|
215
|
+
* it as pending a number.
|
|
216
|
+
*/
|
|
217
|
+
export function printsValue(event) {
|
|
218
|
+
return ((event.kind === 'macro' || event.kind === 'central_bank' || event.kind === 'earnings') && event.source !== 'agency');
|
|
219
|
+
}
|
|
220
|
+
/** Minutes after Eastern midnight of the US open (09:30) and close (16:00). */
|
|
221
|
+
const US_OPEN_MINUTE = 9 * 60 + 30;
|
|
222
|
+
const US_CLOSE_MINUTE = 16 * 60;
|
|
223
|
+
/**
|
|
224
|
+
* When an earnings row reports against the US session: the served slot, else
|
|
225
|
+
* (a slot the row lacks) the one its Eastern clock gives; `unknown` for a
|
|
226
|
+
* date-only row, whose instant is an ordering placeholder. Null for every
|
|
227
|
+
* other kind.
|
|
228
|
+
*/
|
|
229
|
+
export function earningsSlot(event) {
|
|
230
|
+
if (event.kind !== 'earnings')
|
|
231
|
+
return null;
|
|
232
|
+
if (event.timing === 'date_only')
|
|
233
|
+
return 'unknown';
|
|
234
|
+
const served = event.earnings?.slot;
|
|
235
|
+
if (served && served !== 'unknown')
|
|
236
|
+
return served;
|
|
237
|
+
const [hours, minutes] = easternTime(event.at).split(':').map(Number);
|
|
238
|
+
const minute = hours * 60 + minutes;
|
|
239
|
+
if (!Number.isFinite(minute))
|
|
240
|
+
return 'unknown';
|
|
241
|
+
if (minute < US_OPEN_MINUTE)
|
|
242
|
+
return 'bmo';
|
|
243
|
+
return minute >= US_CLOSE_MINUTE ? 'amc' : 'session';
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The equity ticker a pane shows, synchronously: a US stock pane (POLYGON,
|
|
247
|
+
* its US_STOCKS alias, or a legacy listing venue NYSE / NASDAQ / CBOE) names
|
|
248
|
+
* it before the slash (`JPM/USD` → `JPM`). Null for any other market, and for
|
|
249
|
+
* a symbol the calendar could not be asked about. HIP-3 panes resolve through
|
|
250
|
+
* `usePaneTicker`.
|
|
251
|
+
*/
|
|
252
|
+
export function paneTicker(metadata) {
|
|
253
|
+
if (!metadata || !checkIsPolygon(metadata.exchange))
|
|
254
|
+
return null;
|
|
255
|
+
const ticker = (metadata.symbol ?? '').split('/')[0].trim().toUpperCase();
|
|
256
|
+
return EARNINGS_TICKER_PATTERN.test(ticker) ? ticker : null;
|
|
257
|
+
}
|
|
258
|
+
/** The first series an event links, the headline of the release; null when nothing is linked. */
|
|
259
|
+
export function headlineSeriesLink(event) {
|
|
260
|
+
return event.seriesLinks[0] ?? null;
|
|
261
|
+
}
|
|
262
|
+
// By the display name the calendar serves. A publisher off the map shows as served.
|
|
263
|
+
const PUBLISHER_IDS = {
|
|
264
|
+
'U.S. Bureau of Labor Statistics': 'bls',
|
|
265
|
+
'U.S. Bureau of Economic Analysis': 'bea',
|
|
266
|
+
'U.S. Census Bureau': 'census',
|
|
267
|
+
'U.S. Department of Labor': 'dol',
|
|
268
|
+
'Federal Reserve Board': 'fed',
|
|
269
|
+
'European Central Bank': 'ecb',
|
|
270
|
+
Eurostat: 'eurostat',
|
|
271
|
+
'Office for National Statistics': 'ons',
|
|
272
|
+
};
|
|
273
|
+
/** The agency behind a served publisher name, or null for one the map does not know. */
|
|
274
|
+
export function publisherId(publisher) {
|
|
275
|
+
return publisher ? (PUBLISHER_IDS[publisher] ?? null) : null;
|
|
276
|
+
}
|
|
277
|
+
/** How long a value-bearing print past its instant reads as "printing now" before it is just pending. */
|
|
278
|
+
export const PRINTING_HOLD_MS = 10 * 60 * 1000;
|
|
279
|
+
export function surpriseGlyph(event) {
|
|
280
|
+
if (event.surprise === 'above')
|
|
281
|
+
return '▲';
|
|
282
|
+
if (event.surprise === 'below')
|
|
283
|
+
return '▼';
|
|
284
|
+
if (event.surprise === 'inline')
|
|
285
|
+
return '=';
|
|
286
|
+
return '';
|
|
287
|
+
}
|
|
288
|
+
/** Escape vendor text before it rides an HTML-capable tooltip. */
|
|
289
|
+
export function escapeHtml(text) {
|
|
290
|
+
return text
|
|
291
|
+
.replace(/&/g, '&')
|
|
292
|
+
.replace(/</g, '<')
|
|
293
|
+
.replace(/>/g, '>')
|
|
294
|
+
.replace(/"/g, '"')
|
|
295
|
+
.replace(/'/g, ''');
|
|
296
|
+
}
|
|
297
|
+
/** Whether the calendar data can be trusted for countdowns. */
|
|
298
|
+
const MARKET_EVENTS_STALE_AFTER_MS = 2 * 60 * 60 * 1000;
|
|
299
|
+
export function isSourceFresh(lastSyncAt, now) {
|
|
300
|
+
return typeof lastSyncAt === 'number' && now - lastSyncAt <= MARKET_EVENTS_STALE_AFTER_MS;
|
|
301
|
+
}
|
|
302
|
+
/** Day bucket in a fixed UTC-offset zone (the chart's time zone), for list headers. */
|
|
303
|
+
export function dayKey(at, offsetMs) {
|
|
304
|
+
const shifted = new Date(at + offsetMs);
|
|
305
|
+
return `${shifted.getUTCFullYear()}-${String(shifted.getUTCMonth() + 1).padStart(2, '0')}-${String(shifted.getUTCDate()).padStart(2, '0')}`;
|
|
306
|
+
}
|
|
307
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
308
|
+
const easternDate = new Intl.DateTimeFormat('en-CA', {
|
|
309
|
+
timeZone: 'America/New_York',
|
|
310
|
+
year: 'numeric',
|
|
311
|
+
month: '2-digit',
|
|
312
|
+
day: '2-digit',
|
|
313
|
+
});
|
|
314
|
+
/**
|
|
315
|
+
* The calendar day a row belongs to in the zone. A date-only row (every
|
|
316
|
+
* dividend, a report with no announced time) carries a 09:30 Eastern
|
|
317
|
+
* placeholder instant that only orders the day: it keeps its US date in every
|
|
318
|
+
* zone, instead of sliding to the next day east of UTC+10.
|
|
319
|
+
*/
|
|
320
|
+
export function rowDayKey(event, offsetMs) {
|
|
321
|
+
return event.timing === 'date_only' ? easternDate.format(new Date(event.at)) : dayKey(event.at, offsetMs);
|
|
322
|
+
}
|
|
323
|
+
/** The instant a `YYYY-MM-DD` day starts in the zone, epoch ms. */
|
|
324
|
+
const zoneDayStartOf = (dateKey, offsetMs) => {
|
|
325
|
+
const [year, month, day] = dateKey.split('-').map(Number);
|
|
326
|
+
return Date.UTC(year, month - 1, day) - offsetMs;
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* Rows by calendar day in a fixed UTC-offset zone (the chart's time zone), in
|
|
330
|
+
* order of first appearance (pass rows sorted by time). Raw keys only: the
|
|
331
|
+
* panels word them.
|
|
332
|
+
*/
|
|
333
|
+
export function dayGroups(events, nowMs, offsetMs) {
|
|
334
|
+
const todayKey = dayKey(nowMs, offsetMs);
|
|
335
|
+
const tomorrowKey = dayKey(nowMs + DAY_MS, offsetMs);
|
|
336
|
+
const groups = new Map();
|
|
337
|
+
for (const event of events) {
|
|
338
|
+
const dateKey = rowDayKey(event, offsetMs);
|
|
339
|
+
let group = groups.get(dateKey);
|
|
340
|
+
if (!group) {
|
|
341
|
+
const key = dateKey === todayKey ? 'today' : dateKey === tomorrowKey ? 'tomorrow' : 'date';
|
|
342
|
+
const dayStartMs = zoneDayStartOf(dateKey, offsetMs);
|
|
343
|
+
group = { key, dateKey, dayStartMs, events: [] };
|
|
344
|
+
groups.set(dateKey, group);
|
|
345
|
+
}
|
|
346
|
+
group.events.push(event);
|
|
347
|
+
}
|
|
348
|
+
return [...groups.values()];
|
|
349
|
+
}
|
|
350
|
+
/** Whether an exact print is close enough that surfaces should poll fast; earnings and dividends never count. */
|
|
351
|
+
export function isNearRelease(events, now, beforeMs, afterMs) {
|
|
352
|
+
return events.some((event) => countsDown(event) && event.timing === 'exact' && now >= event.at - beforeMs && now <= event.at + afterMs);
|
|
353
|
+
}
|
|
354
|
+
/** How far ahead a chart can usefully frame an instant, in bars of its interval. */
|
|
355
|
+
const CHART_REACH_BARS = 500;
|
|
356
|
+
/** Framing a future instant: this many bars of the latest candles, and this many past the instant. */
|
|
357
|
+
const FRAME_BACK_BARS = 60;
|
|
358
|
+
const FRAME_AHEAD_BARS = 10;
|
|
359
|
+
/** Centring a printed instant: this many bars either side. */
|
|
360
|
+
const CENTER_BARS = 40;
|
|
361
|
+
/** Intervals a trader can switch to, smallest first, with their bar length in ms. */
|
|
362
|
+
const REACH_INTERVALS = [
|
|
363
|
+
['1m', 60_000],
|
|
364
|
+
['5m', 300_000],
|
|
365
|
+
['15m', 900_000],
|
|
366
|
+
['30m', 1_800_000],
|
|
367
|
+
['1h', 3_600_000],
|
|
368
|
+
['4h', 14_400_000],
|
|
369
|
+
['12h', 43_200_000],
|
|
370
|
+
['1d', 86_400_000],
|
|
371
|
+
['1w', 604_800_000],
|
|
372
|
+
];
|
|
373
|
+
export function chartReach(at, now, intervalMs, interval) {
|
|
374
|
+
const ahead = at - now;
|
|
375
|
+
if (ahead <= 0 || !(intervalMs > 0))
|
|
376
|
+
return { ok: true, interval, barsAhead: 0, suggested: null };
|
|
377
|
+
const barsAhead = ahead / intervalMs;
|
|
378
|
+
if (barsAhead <= CHART_REACH_BARS)
|
|
379
|
+
return { ok: true, interval, barsAhead, suggested: null };
|
|
380
|
+
const suggestion = REACH_INTERVALS.find(([, ms]) => ms > intervalMs && ahead / ms <= CHART_REACH_BARS);
|
|
381
|
+
return { ok: false, interval, barsAhead, suggested: suggestion ? suggestion[0] : null };
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* The visible range that frames an instant: a printed one is centred; a
|
|
385
|
+
* coming one keeps the latest candles on screen and the marker just inside
|
|
386
|
+
* the right edge, so the chart never opens on empty space with a lone line.
|
|
387
|
+
*/
|
|
388
|
+
export function frameWindow(at, now, intervalMs) {
|
|
389
|
+
if (at <= now)
|
|
390
|
+
return { start: at - CENTER_BARS * intervalMs, end: at + CENTER_BARS * intervalMs };
|
|
391
|
+
return { start: now - FRAME_BACK_BARS * intervalMs, end: at + FRAME_AHEAD_BARS * intervalMs };
|
|
392
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function easternTime(at: number): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// The release instant in Eastern time, as the US agencies announce it
|
|
2
|
+
// ("08:30"); shown as a tooltip on the time cell of US prints.
|
|
3
|
+
const easternClock = new Intl.DateTimeFormat('en-US', {
|
|
4
|
+
timeZone: 'America/New_York',
|
|
5
|
+
hour: '2-digit',
|
|
6
|
+
minute: '2-digit',
|
|
7
|
+
hour12: false,
|
|
8
|
+
});
|
|
9
|
+
export function easternTime(at) {
|
|
10
|
+
return easternClock.format(new Date(at)).replace(/^24/, '00');
|
|
11
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { OptionVenue } from '../../constants/option-venues.constants.js';
|
|
2
|
+
import type { CmeServedAccess } from '../../interfaces/cme-realtime.interface.js';
|
|
3
|
+
/** The tier a governed venue's numbers were served on; absent means nobody confirmed one. */
|
|
4
|
+
export type OptionVenueServedTier = 'realtime' | 'delayed';
|
|
5
|
+
type Translate = (key: string, params?: Record<string, unknown>) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Minutes a delayed surface of the venue runs behind: what the gate's tier frame reported for the
|
|
8
|
+
* venue's exchange when it did, else the venue's nominal delay (OPRA: 15), else its plane's.
|
|
9
|
+
*/
|
|
10
|
+
export declare function optionVenueDelayMinutes(venue: OptionVenue, access?: CmeServedAccess): number;
|
|
11
|
+
/**
|
|
12
|
+
* The line every surface showing an OPRA venue's numbers carries (the chain's price pill, table marker,
|
|
13
|
+
* strike preview and index notice, the Flow Tape header, the Terminal Options tab, a stock chart's
|
|
14
|
+
* options overlay legend, a browser-run Indicator's legend note): the tier that served them. A tier
|
|
15
|
+
* nobody confirmed reads delayed, so a surface never claims real-time it cannot show. A delayed OPRA
|
|
16
|
+
* venue reads OPRA's delay notice verbatim (`OPRA_DELAY_NOTICE`, Exhibit A section 14: the exact phrase
|
|
17
|
+
* on every screen of delayed OPRA data, never translated, whatever minutes the gate reports); real-time
|
|
18
|
+
* names the source by its full name. Any other gate plane keeps the translated source-and-minutes line.
|
|
19
|
+
*/
|
|
20
|
+
export declare function optionVenueDisclosure(venue: OptionVenue, tier: OptionVenueServedTier | undefined, minutes: number, t: Translate): string;
|
|
21
|
+
/** The index roots a venue lists by name only (trades and open interest, no underlying or greeks). */
|
|
22
|
+
export declare function isOptionVenueIndexRoot(venue: OptionVenue | null | undefined, root: string | null | undefined): boolean;
|
|
23
|
+
/** The served-access read the delayed test needs: the cme-realtime store, or a stand-in in specs. */
|
|
24
|
+
export interface OpraRoutedAccess {
|
|
25
|
+
isRealtimeRouted(exchange: string | undefined | null): boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Whether `exchange` is an OPRA-governed venue whose data rides the delayed tier here: not ROUTED real-time (a tier
|
|
29
|
+
* nobody confirmed reads delayed, the delay badge's rule). The one test behind every surface that must show OPRA's
|
|
30
|
+
* delay notice where the delayed data shows: the chart's chip and the phone header row it takes, the watchlist and the
|
|
31
|
+
* Board's market lists, the footer line of a chart that holds an overlay reading OPRA.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isOpraDelayed(exchange: string | undefined | null, served: OpraRoutedAccess): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The short delay mark beside one governed price on a delayed tier (`mins` behind): OPRA's delay notice verbatim on an
|
|
36
|
+
* OPRA market (Exhibit A section 14: the exact phrase where its delayed price shows, never on a hover alone), the
|
|
37
|
+
* minutes ("10m") on any other plane. A list of rows keeps the minutes per row and shows the notice once for the list
|
|
38
|
+
* (`useCmeGovernance().opraDelayNotice`).
|
|
39
|
+
*/
|
|
40
|
+
export declare function governedDelayLabel(exchange: string | undefined | null, mins: number, t: Translate): string;
|
|
41
|
+
/** The same mark as a sentence (a hover title, a line): OPRA's notice verbatim, the plane's minutes sentence elsewhere. */
|
|
42
|
+
export declare function governedDelaySentence(exchange: string | undefined | null, mins: number, t: Translate): string;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { OPRA_DELAY_NOTICE } from '../../constants/opra-compliance.constants.js';
|
|
2
|
+
import { getExchangeFullName } from '../chart/cme-realtime.util.js';
|
|
3
|
+
import { delayedDefaultMinutesFor, isOpraGoverned } from '../v2/gate-plane.util.js';
|
|
4
|
+
/**
|
|
5
|
+
* Minutes a delayed surface of the venue runs behind: what the gate's tier frame reported for the
|
|
6
|
+
* venue's exchange when it did, else the venue's nominal delay (OPRA: 15), else its plane's.
|
|
7
|
+
*/
|
|
8
|
+
export function optionVenueDelayMinutes(venue, access) {
|
|
9
|
+
if (access?.status === 'known' && access.timing === 'delayed' && typeof access.delaySeconds === 'number') {
|
|
10
|
+
return Math.max(1, Math.round(access.delaySeconds / 60));
|
|
11
|
+
}
|
|
12
|
+
return venue.delayMinutes ?? delayedDefaultMinutesFor(venue.exchanges[0]);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The line every surface showing an OPRA venue's numbers carries (the chain's price pill, table marker,
|
|
16
|
+
* strike preview and index notice, the Flow Tape header, the Terminal Options tab, a stock chart's
|
|
17
|
+
* options overlay legend, a browser-run Indicator's legend note): the tier that served them. A tier
|
|
18
|
+
* nobody confirmed reads delayed, so a surface never claims real-time it cannot show. A delayed OPRA
|
|
19
|
+
* venue reads OPRA's delay notice verbatim (`OPRA_DELAY_NOTICE`, Exhibit A section 14: the exact phrase
|
|
20
|
+
* on every screen of delayed OPRA data, never translated, whatever minutes the gate reports); real-time
|
|
21
|
+
* names the source by its full name. Any other gate plane keeps the translated source-and-minutes line.
|
|
22
|
+
*/
|
|
23
|
+
export function optionVenueDisclosure(venue, tier, minutes, t) {
|
|
24
|
+
if (tier !== 'realtime' && venue.plane === 'opra')
|
|
25
|
+
return OPRA_DELAY_NOTICE;
|
|
26
|
+
const source = getExchangeFullName(venue.exchanges[0], t);
|
|
27
|
+
return tier === 'realtime'
|
|
28
|
+
? t('symbolSelection.optionChain.servedRealtime', { source })
|
|
29
|
+
: t('symbolSelection.optionChain.servedDelayed', { source, minutes });
|
|
30
|
+
}
|
|
31
|
+
/** The index roots a venue lists by name only (trades and open interest, no underlying or greeks). */
|
|
32
|
+
export function isOptionVenueIndexRoot(venue, root) {
|
|
33
|
+
return !!root && !!venue?.syntheticRoots?.includes(root.toUpperCase());
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Whether `exchange` is an OPRA-governed venue whose data rides the delayed tier here: not ROUTED real-time (a tier
|
|
37
|
+
* nobody confirmed reads delayed, the delay badge's rule). The one test behind every surface that must show OPRA's
|
|
38
|
+
* delay notice where the delayed data shows: the chart's chip and the phone header row it takes, the watchlist and the
|
|
39
|
+
* Board's market lists, the footer line of a chart that holds an overlay reading OPRA.
|
|
40
|
+
*/
|
|
41
|
+
export function isOpraDelayed(exchange, served) {
|
|
42
|
+
return isOpraGoverned(exchange) && !served.isRealtimeRouted(exchange);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The short delay mark beside one governed price on a delayed tier (`mins` behind): OPRA's delay notice verbatim on an
|
|
46
|
+
* OPRA market (Exhibit A section 14: the exact phrase where its delayed price shows, never on a hover alone), the
|
|
47
|
+
* minutes ("10m") on any other plane. A list of rows keeps the minutes per row and shows the notice once for the list
|
|
48
|
+
* (`useCmeGovernance().opraDelayNotice`).
|
|
49
|
+
*/
|
|
50
|
+
export function governedDelayLabel(exchange, mins, t) {
|
|
51
|
+
return isOpraGoverned(exchange) ? OPRA_DELAY_NOTICE : t('watchlist.table.delayShort', { mins });
|
|
52
|
+
}
|
|
53
|
+
/** The same mark as a sentence (a hover title, a line): OPRA's notice verbatim, the plane's minutes sentence elsewhere. */
|
|
54
|
+
export function governedDelaySentence(exchange, mins, t) {
|
|
55
|
+
return isOpraGoverned(exchange) ? OPRA_DELAY_NOTICE : t('cmeRealtimeData.badge.delay', { mins });
|
|
56
|
+
}
|