@orangecharts/wrun-chart-host 0.11.1 → 0.14.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 +3 -4
- package/dist/constants/feature-flags.constants.js +34 -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 +55 -3
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +36 -3
- package/dist/index.d.ts +17 -0
- package/dist/index.js +18 -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 +97 -19
- 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 +4 -4
- package/dist/market-data/venues/stocks.contract.copy.json +4 -4
- package/dist/market-data/venues/stocks.d.ts +4 -4
- package/dist/market-data/venues/stocks.js +15 -13
- 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 +28 -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 +15 -7
- package/dist/utility/chart/cache-alignment.util.js +14 -7
- 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/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 +29 -12
- package/dist/utility/chart/wrun-run-result.util.js +89 -25
- 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 +41 -22
- package/dist/utility/wrun/wrun-batched-marks.util.js +255 -59
- 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.js +7 -3
- 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-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 +648 -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-overlay-drivers.util.d.ts +75 -11
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +176 -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-run.util.d.ts +239 -24
- package/dist/utility/wrun/wrun-overlay-run.util.js +2204 -405
- package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-panel-mount.util.js +20 -14
- 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 +89 -2
- package/dist/utility/wrun/wrun-run-health.util.js +204 -1
- 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 +13 -3
- package/dist/utility/wrun/wrun-script-inputs.util.js +51 -13
- 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-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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { displayWallMs, displayWallToUtcMs } from '../chart/display-offset.leaf.js';
|
|
1
2
|
import { checkIsPolygon, getMarketKind } from '../chart/marketKind.util.js';
|
|
2
3
|
import { EARNINGS_TICKER_PATTERN } from './earnings-scope.util.js';
|
|
3
4
|
import { easternTime } from './zoned-clock.util.js';
|
|
@@ -299,10 +300,17 @@ const MARKET_EVENTS_STALE_AFTER_MS = 2 * 60 * 60 * 1000;
|
|
|
299
300
|
export function isSourceFresh(lastSyncAt, now) {
|
|
300
301
|
return typeof lastSyncAt === 'number' && now - lastSyncAt <= MARKET_EVENTS_STALE_AFTER_MS;
|
|
301
302
|
}
|
|
302
|
-
/**
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
return `${
|
|
303
|
+
/** `YYYY-MM-DD` of a UTC-shaped wall clock epoch. */
|
|
304
|
+
const wallDateKey = (wallMs) => {
|
|
305
|
+
const wall = new Date(wallMs);
|
|
306
|
+
return `${wall.getUTCFullYear()}-${String(wall.getUTCMonth() + 1).padStart(2, '0')}-${String(wall.getUTCDate()).padStart(2, '0')}`;
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Day bucket in the chart's time zone, for list headers: the instant's own wall date, `offset` read at the instant
|
|
310
|
+
* (a fixed shift, or the shift at each instant for a zone that moves its clock).
|
|
311
|
+
*/
|
|
312
|
+
export function dayKey(at, offset) {
|
|
313
|
+
return wallDateKey(displayWallMs(offset, at));
|
|
306
314
|
}
|
|
307
315
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
308
316
|
const easternDate = new Intl.DateTimeFormat('en-CA', {
|
|
@@ -317,29 +325,34 @@ const easternDate = new Intl.DateTimeFormat('en-CA', {
|
|
|
317
325
|
* placeholder instant that only orders the day: it keeps its US date in every
|
|
318
326
|
* zone, instead of sliding to the next day east of UTC+10.
|
|
319
327
|
*/
|
|
320
|
-
export function rowDayKey(event,
|
|
321
|
-
return event.timing === 'date_only' ? easternDate.format(new Date(event.at)) : dayKey(event.at,
|
|
328
|
+
export function rowDayKey(event, offset) {
|
|
329
|
+
return event.timing === 'date_only' ? easternDate.format(new Date(event.at)) : dayKey(event.at, offset);
|
|
322
330
|
}
|
|
323
|
-
/**
|
|
324
|
-
const
|
|
331
|
+
/** A `YYYY-MM-DD` as its UTC midnight (the day's wall midnight as a UTC-shaped epoch). */
|
|
332
|
+
const dateKeyWallMs = (dateKey) => {
|
|
325
333
|
const [year, month, day] = dateKey.split('-').map(Number);
|
|
326
|
-
return Date.UTC(year, month - 1, day)
|
|
334
|
+
return Date.UTC(year, month - 1, day);
|
|
327
335
|
};
|
|
336
|
+
/** The instant a `YYYY-MM-DD` day starts in the zone, epoch ms: its wall midnight on that midnight's own offset. */
|
|
337
|
+
const zoneDayStartOf = (dateKey, offset) => displayWallToUtcMs(offset, dateKeyWallMs(dateKey));
|
|
328
338
|
/**
|
|
329
|
-
* Rows by calendar day in
|
|
330
|
-
*
|
|
331
|
-
*
|
|
339
|
+
* Rows by calendar day in the chart's time zone, in order of first
|
|
340
|
+
* appearance (pass rows sorted by time). Each row reads its own day at its
|
|
341
|
+
* own instant's offset (a zone moves its clock: one offset read now puts a
|
|
342
|
+
* row across a clock change an hour off its day), and tomorrow is the
|
|
343
|
+
* calendar's next date, never now plus 24 hours (a zone day around a change
|
|
344
|
+
* is 23 or 25 hours long). Raw keys only: the panels word them.
|
|
332
345
|
*/
|
|
333
|
-
export function dayGroups(events, nowMs,
|
|
334
|
-
const todayKey = dayKey(nowMs,
|
|
335
|
-
const tomorrowKey =
|
|
346
|
+
export function dayGroups(events, nowMs, offset) {
|
|
347
|
+
const todayKey = dayKey(nowMs, offset);
|
|
348
|
+
const tomorrowKey = wallDateKey(dateKeyWallMs(todayKey) + DAY_MS);
|
|
336
349
|
const groups = new Map();
|
|
337
350
|
for (const event of events) {
|
|
338
|
-
const dateKey = rowDayKey(event,
|
|
351
|
+
const dateKey = rowDayKey(event, offset);
|
|
339
352
|
let group = groups.get(dateKey);
|
|
340
353
|
if (!group) {
|
|
341
354
|
const key = dateKey === todayKey ? 'today' : dateKey === tomorrowKey ? 'tomorrow' : 'date';
|
|
342
|
-
const dayStartMs = zoneDayStartOf(dateKey,
|
|
355
|
+
const dayStartMs = zoneDayStartOf(dateKey, offset);
|
|
343
356
|
group = { key, dateKey, dayStartMs, events: [] };
|
|
344
357
|
groups.set(dateKey, group);
|
|
345
358
|
}
|
|
@@ -56,20 +56,15 @@ export declare function changeNumberFormat(value: number, precision: number): st
|
|
|
56
56
|
*/
|
|
57
57
|
export declare function formatAdaptiveVolume(value: number): string;
|
|
58
58
|
export declare function safeDivide(a: number, b: number): number;
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
* (`src/utility/chart/market-price-text.util.ts`), which falls back to this for
|
|
69
|
-
* a plain price; through this ladder a crypto index market cap printed all
|
|
70
|
-
* thirteen digits.
|
|
71
|
-
*/
|
|
72
|
-
export declare function formatPriceByMagnitude(value: number, reference?: number): string;
|
|
59
|
+
/** A market's price convention while its tick is unknown, named by market-price-text.util (no venue imports here). */
|
|
60
|
+
export type PriceConvention = 'usEquity' | 'ladder';
|
|
61
|
+
/** The one price-decimals rule: a known tick decides, else a US stock prints 2 from $1 and 4 below, else null. */
|
|
62
|
+
export declare function conventionPriceDecimals(magnitude: number, convention: PriceConvention, tick: number | null | undefined): number | null;
|
|
63
|
+
/** The ticker's digits: the market's decimals, else the magnitude ladder; surfaces ask market-price-text.util. */
|
|
64
|
+
export declare function formatPriceByMagnitude(value: number, convention: PriceConvention, opts?: {
|
|
65
|
+
reference?: number;
|
|
66
|
+
tick?: number | null;
|
|
67
|
+
}): string;
|
|
73
68
|
export declare function titlePriceDirection(curr: unknown, prev: unknown, lastGlyph?: string): string;
|
|
74
69
|
/**
|
|
75
70
|
* The tab title's price: the ticker bar's text (formatPriceByMagnitude) with
|
|
@@ -78,14 +73,12 @@ export declare function titlePriceDirection(curr: unknown, prev: unknown, lastGl
|
|
|
78
73
|
* (0.9992810927390368), and an axis stretched by one stray value cut the same
|
|
79
74
|
* ratio to "1.00". Negative values (spread formulas) keep the magnitude rule.
|
|
80
75
|
*/
|
|
81
|
-
export declare function formatTitlePrice(price: number
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* (`src/utility/chart/market-price-text.util.ts`), so a crypto index reads in its own unit (`$1.08T ▲`).
|
|
86
|
-
*/
|
|
76
|
+
export declare function formatTitlePrice(price: number, convention: PriceConvention, opts?: {
|
|
77
|
+
tick?: number | null;
|
|
78
|
+
}): string;
|
|
79
|
+
/** The tab title's price and glyph per chart and market; `formatPrice` prints the market's text (no blind default). */
|
|
87
80
|
export declare function formatChartTitlePrice(price: number, tc: TitleChart, context: {
|
|
88
81
|
symbolKey: string;
|
|
89
82
|
previousPrice?: number;
|
|
90
|
-
}, formatPrice
|
|
83
|
+
}, formatPrice: (price: number) => string): string;
|
|
91
84
|
export {};
|
|
@@ -163,26 +163,42 @@ export function safeDivide(a, b) {
|
|
|
163
163
|
*/
|
|
164
164
|
const TICKER_MIN_SIGNIFICANT_DIGITS = 3;
|
|
165
165
|
const MAX_TICKER_DECIMALS = 20;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
166
|
+
// SEC Rule 612: US stocks and ETFs quote in cents from $1 and in hundredths of a cent below it.
|
|
167
|
+
const US_EQUITY_DECIMALS_FROM_ONE_DOLLAR = 2;
|
|
168
|
+
const US_EQUITY_DECIMALS_BELOW_ONE_DOLLAR = 4;
|
|
169
|
+
/** A tick reads to at most this many decimals, the price axis's bound (pricePrecisionFromStep). */
|
|
170
|
+
const MAX_TICK_DECIMALS = 10;
|
|
171
|
+
const tickKnown = (tick) => typeof tick === 'number' && Number.isFinite(tick) && tick > 0;
|
|
172
|
+
/** A tick's decimals as the price axis prints a known tick (pricePrecisionFromStep, step mode), so the two agree. */
|
|
173
|
+
function tickDecimals(tick) {
|
|
174
|
+
for (let d = 0; d <= MAX_TICK_DECIMALS; d++) {
|
|
175
|
+
if (Math.abs(tick - Number(tick.toFixed(d))) <= tick * 1e-9)
|
|
176
|
+
return d;
|
|
177
|
+
}
|
|
178
|
+
return MAX_TICK_DECIMALS;
|
|
179
|
+
}
|
|
180
|
+
/** The one price-decimals rule: a known tick decides, else a US stock prints 2 from $1 and 4 below, else null. */
|
|
181
|
+
export function conventionPriceDecimals(magnitude, convention, tick) {
|
|
182
|
+
if (tickKnown(tick))
|
|
183
|
+
return tickDecimals(tick);
|
|
184
|
+
if (convention !== 'usEquity')
|
|
185
|
+
return null;
|
|
186
|
+
return Math.abs(magnitude) >= 1 ? US_EQUITY_DECIMALS_FROM_ONE_DOLLAR : US_EQUITY_DECIMALS_BELOW_ONE_DOLLAR;
|
|
187
|
+
}
|
|
188
|
+
/** The magnitude ladder: 1 to 5 decimals by size, and under 1 enough for three significant digits of `magnitude`. */
|
|
189
|
+
function tickerLadderDecimals(value, magnitude) {
|
|
180
190
|
const ladder = value >= 10000 ? 1 : value >= 1000 ? 2 : value >= 100 ? 3 : value >= 10 ? 4 : 5;
|
|
181
|
-
const magnitude = Math.abs(reference);
|
|
182
191
|
const floor = magnitude > 0 && magnitude < 1
|
|
183
192
|
? Math.min(TICKER_MIN_SIGNIFICANT_DIGITS - 1 - Math.floor(Math.log10(magnitude)), MAX_TICKER_DECIMALS)
|
|
184
193
|
: 0;
|
|
185
|
-
|
|
194
|
+
return Math.max(ladder, floor);
|
|
195
|
+
}
|
|
196
|
+
/** The ticker's digits: the market's decimals, else the magnitude ladder; surfaces ask market-price-text.util. */
|
|
197
|
+
export function formatPriceByMagnitude(value, convention,
|
|
198
|
+
// `reference`: the price a difference belongs to, whose decimals it prints at.
|
|
199
|
+
opts = {}) {
|
|
200
|
+
const magnitude = Math.abs(opts.reference ?? value);
|
|
201
|
+
const decimals = conventionPriceDecimals(magnitude, convention, opts.tick) ?? tickerLadderDecimals(value, magnitude);
|
|
186
202
|
return value >= 10000
|
|
187
203
|
? value.toLocaleString('en-US', { minimumFractionDigits: decimals, maximumFractionDigits: decimals })
|
|
188
204
|
: value.toFixed(decimals);
|
|
@@ -204,22 +220,20 @@ export function titlePriceDirection(curr, prev, lastGlyph = '') {
|
|
|
204
220
|
* (0.9992810927390368), and an axis stretched by one stray value cut the same
|
|
205
221
|
* ratio to "1.00". Negative values (spread formulas) keep the magnitude rule.
|
|
206
222
|
*/
|
|
207
|
-
export function formatTitlePrice(price) {
|
|
223
|
+
export function formatTitlePrice(price, convention, opts = {}) {
|
|
208
224
|
if (!Number.isFinite(price))
|
|
209
225
|
return '';
|
|
210
|
-
const [whole, fraction] = formatPriceByMagnitude(Math.abs(price)
|
|
226
|
+
const [whole, fraction] = formatPriceByMagnitude(Math.abs(price), convention, { tick: opts.tick })
|
|
227
|
+
.replace(/,/g, '')
|
|
228
|
+
.split('.');
|
|
211
229
|
const grouped = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
212
230
|
const text = fraction === undefined ? grouped : `${grouped}.${fraction}`;
|
|
213
231
|
return price < 0 ? `-${text}` : text;
|
|
214
232
|
}
|
|
215
233
|
// Keyed by the chart instance so a destroyed chart takes its entry with it (no retainer).
|
|
216
234
|
const titlePricesByChart = new WeakMap();
|
|
217
|
-
/**
|
|
218
|
-
|
|
219
|
-
* (default `formatTitlePrice`, venue-blind): the web passes its market-aware text
|
|
220
|
-
* (`src/utility/chart/market-price-text.util.ts`), so a crypto index reads in its own unit (`$1.08T ▲`).
|
|
221
|
-
*/
|
|
222
|
-
export function formatChartTitlePrice(price, tc, context, formatPrice = formatTitlePrice) {
|
|
235
|
+
/** The tab title's price and glyph per chart and market; `formatPrice` prints the market's text (no blind default). */
|
|
236
|
+
export function formatChartTitlePrice(price, tc, context, formatPrice) {
|
|
223
237
|
const stored = titlePricesByChart.get(tc);
|
|
224
238
|
const previous = stored?.symbolKey === context.symbolKey ? stored : undefined;
|
|
225
239
|
const glyph = titlePriceDirection(price, previous ? previous.price : context.previousPrice, previous?.glyph);
|
|
@@ -15,7 +15,8 @@ export declare function optionVenueDelayMinutes(venue: OptionVenue, access?: Cme
|
|
|
15
15
|
* nobody confirmed reads delayed, so a surface never claims real-time it cannot show. A delayed OPRA
|
|
16
16
|
* venue reads OPRA's delay notice verbatim (`OPRA_DELAY_NOTICE`, Exhibit A section 14: the exact phrase
|
|
17
17
|
* on every screen of delayed OPRA data, never translated, whatever minutes the gate reports); real-time
|
|
18
|
-
*
|
|
18
|
+
* reads the filed Exhibit A display screen's "Real-time · OPRA". Any other gate plane keeps the translated
|
|
19
|
+
* source-and-minutes line.
|
|
19
20
|
*/
|
|
20
21
|
export declare function optionVenueDisclosure(venue: OptionVenue, tier: OptionVenueServedTier | undefined, minutes: number, t: Translate): string;
|
|
21
22
|
/** The index roots a venue lists by name only (trades and open interest, no underlying or greeks). */
|
|
@@ -32,12 +33,45 @@ export interface OpraRoutedAccess {
|
|
|
32
33
|
*/
|
|
33
34
|
export declare function isOpraDelayed(exchange: string | undefined | null, served: OpraRoutedAccess): boolean;
|
|
34
35
|
/**
|
|
35
|
-
* The short delay mark beside one governed price on a delayed tier (`mins` behind): OPRA's delay
|
|
36
|
-
* OPRA market (Exhibit A section 14: the exact phrase where its delayed price shows, never on a
|
|
37
|
-
*
|
|
38
|
-
* (
|
|
36
|
+
* The short delay mark beside one governed price on a delayed tier (`mins` behind), worded per venue: OPRA's delay
|
|
37
|
+
* notice verbatim on an OPRA market (Exhibit A section 14: the exact phrase where its delayed price shows, never on a
|
|
38
|
+
* hover alone), the stocks tape's CTA statement verbatim on a tape market ("Delayed 15 minutes", never the minutes
|
|
39
|
+
* chip), the minutes ("10m") on CME. A list of rows keeps the minutes per CME row and shows OPRA's notice once for the
|
|
40
|
+
* list (`useCmeGovernance().delayNotice`).
|
|
39
41
|
*/
|
|
40
42
|
export declare function governedDelayLabel(exchange: string | undefined | null, mins: number, t: Translate): string;
|
|
41
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The same mark as a sentence (a hover title, a line, a footnote): OPRA's notice and the stocks statement verbatim,
|
|
45
|
+
* CME's translated minutes sentence.
|
|
46
|
+
*/
|
|
42
47
|
export declare function governedDelaySentence(exchange: string | undefined | null, mins: number, t: Translate): string;
|
|
48
|
+
/** The served-tier read a delay statement needs: the cme-realtime store, or a stand-in in specs. */
|
|
49
|
+
export interface GovernedRoutedAccess extends OpraRoutedAccess {
|
|
50
|
+
/** Minutes the exchange's delayed tier runs behind (the tier frame's, else the plane default). */
|
|
51
|
+
delayMinutes(exchange: string | undefined | null): number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Whether `exchange` is a gate-governed venue (CME, OPRA, the US stocks tape) whose data rides the delayed tier here:
|
|
55
|
+
* not ROUTED real-time, the delay badge's rule (a tier nobody confirmed reads delayed, so no surface claims real time it
|
|
56
|
+
* cannot show). The one venue-neutral test behind every delay label; `isOpraDelayed` is its OPRA-only case.
|
|
57
|
+
*/
|
|
58
|
+
export declare function isGovernedDelayed(exchange: string | undefined | null, served: OpraRoutedAccess): boolean;
|
|
59
|
+
/** The venue's delay statement while `exchange` rides its delayed tier (`governedDelaySentence`), else null. */
|
|
60
|
+
export declare function governedDelayStatement(exchange: string | undefined | null, served: GovernedRoutedAccess, t: Translate): string | null;
|
|
61
|
+
/**
|
|
62
|
+
* The delay statements a surface holding markets of its own (an unsynced Time and sales, an order book, a picture of
|
|
63
|
+
* a chart) must show itself: one per delayed governed plane among `own` that no chart on the screen labels already.
|
|
64
|
+
* The licences ask for one label on the screen while the delayed data shows, never one per panel: a chart streaming
|
|
65
|
+
* the same plane on its delayed tier carries the plane's tag (`chartStreams`: each shown chart's stream venue, the
|
|
66
|
+
* tape a Trades stock chart rides, never its POLYGON identity), so the surface stays bare beside it. With no chart on
|
|
67
|
+
* the screen (a phone's full-screen panel) pass none, and every delayed plane reads its statement. Deduped, in the
|
|
68
|
+
* order the planes first appear in `own`.
|
|
69
|
+
*/
|
|
70
|
+
export declare function uncoveredDelayStatements(own: readonly (string | undefined | null)[], chartStreams: readonly (string | undefined | null)[], served: GovernedRoutedAccess, t: Translate): string[];
|
|
71
|
+
/**
|
|
72
|
+
* Whether a list row may paint a market's price figures (last price, change, sparkline) with no delay mark of its own:
|
|
73
|
+
* never on a gate-governed plane. A search reply names no tier, so a governed figure there is a delayed price nobody
|
|
74
|
+
* labels or a real-time quote beside a delayed chart; the stocks feed row and a CME futures row alike draw none.
|
|
75
|
+
*/
|
|
76
|
+
export declare function rowFiguresAllowed(exchange: string | undefined | null): boolean;
|
|
43
77
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OPRA_DELAY_NOTICE } from '../../constants/opra-compliance.constants.js';
|
|
2
|
+
import { STOCKS_DELAY_STATEMENT } from '../../constants/stocks-compliance.constants.js';
|
|
2
3
|
import { getExchangeFullName } from '../chart/cme-realtime.util.js';
|
|
3
|
-
import { delayedDefaultMinutesFor, isOpraGoverned } from '../v2/gate-plane.util.js';
|
|
4
|
+
import { delayedDefaultMinutesFor, gateProviderForExchange, isOpraGoverned, isStocksTapeGoverned, } from '../v2/gate-plane.util.js';
|
|
4
5
|
/**
|
|
5
6
|
* Minutes a delayed surface of the venue runs behind: what the gate's tier frame reported for the
|
|
6
7
|
* venue's exchange when it did, else the venue's nominal delay (OPRA: 15), else its plane's.
|
|
@@ -18,11 +19,13 @@ export function optionVenueDelayMinutes(venue, access) {
|
|
|
18
19
|
* nobody confirmed reads delayed, so a surface never claims real-time it cannot show. A delayed OPRA
|
|
19
20
|
* venue reads OPRA's delay notice verbatim (`OPRA_DELAY_NOTICE`, Exhibit A section 14: the exact phrase
|
|
20
21
|
* on every screen of delayed OPRA data, never translated, whatever minutes the gate reports); real-time
|
|
21
|
-
*
|
|
22
|
+
* reads the filed Exhibit A display screen's "Real-time · OPRA". Any other gate plane keeps the translated
|
|
23
|
+
* source-and-minutes line.
|
|
22
24
|
*/
|
|
23
25
|
export function optionVenueDisclosure(venue, tier, minutes, t) {
|
|
24
|
-
if (
|
|
25
|
-
return OPRA_DELAY_NOTICE;
|
|
26
|
+
if (venue.plane === 'opra') {
|
|
27
|
+
return tier === 'realtime' ? t('symbolSelection.optionChain.servedRealtimeOpra') : OPRA_DELAY_NOTICE;
|
|
28
|
+
}
|
|
26
29
|
const source = getExchangeFullName(venue.exchanges[0], t);
|
|
27
30
|
return tier === 'realtime'
|
|
28
31
|
? t('symbolSelection.optionChain.servedRealtime', { source })
|
|
@@ -42,15 +45,72 @@ export function isOpraDelayed(exchange, served) {
|
|
|
42
45
|
return isOpraGoverned(exchange) && !served.isRealtimeRouted(exchange);
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
45
|
-
* The short delay mark beside one governed price on a delayed tier (`mins` behind): OPRA's delay
|
|
46
|
-
* OPRA market (Exhibit A section 14: the exact phrase where its delayed price shows, never on a
|
|
47
|
-
*
|
|
48
|
-
* (
|
|
48
|
+
* The short delay mark beside one governed price on a delayed tier (`mins` behind), worded per venue: OPRA's delay
|
|
49
|
+
* notice verbatim on an OPRA market (Exhibit A section 14: the exact phrase where its delayed price shows, never on a
|
|
50
|
+
* hover alone), the stocks tape's CTA statement verbatim on a tape market ("Delayed 15 minutes", never the minutes
|
|
51
|
+
* chip), the minutes ("10m") on CME. A list of rows keeps the minutes per CME row and shows OPRA's notice once for the
|
|
52
|
+
* list (`useCmeGovernance().delayNotice`).
|
|
49
53
|
*/
|
|
50
54
|
export function governedDelayLabel(exchange, mins, t) {
|
|
51
|
-
|
|
55
|
+
if (isOpraGoverned(exchange))
|
|
56
|
+
return OPRA_DELAY_NOTICE;
|
|
57
|
+
if (isStocksTapeGoverned(exchange))
|
|
58
|
+
return STOCKS_DELAY_STATEMENT;
|
|
59
|
+
return t('watchlist.table.delayShort', { mins });
|
|
52
60
|
}
|
|
53
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* The same mark as a sentence (a hover title, a line, a footnote): OPRA's notice and the stocks statement verbatim,
|
|
63
|
+
* CME's translated minutes sentence.
|
|
64
|
+
*/
|
|
54
65
|
export function governedDelaySentence(exchange, mins, t) {
|
|
55
|
-
|
|
66
|
+
if (isOpraGoverned(exchange))
|
|
67
|
+
return OPRA_DELAY_NOTICE;
|
|
68
|
+
if (isStocksTapeGoverned(exchange))
|
|
69
|
+
return STOCKS_DELAY_STATEMENT;
|
|
70
|
+
return t('cmeRealtimeData.badge.delay', { mins });
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Whether `exchange` is a gate-governed venue (CME, OPRA, the US stocks tape) whose data rides the delayed tier here:
|
|
74
|
+
* not ROUTED real-time, the delay badge's rule (a tier nobody confirmed reads delayed, so no surface claims real time it
|
|
75
|
+
* cannot show). The one venue-neutral test behind every delay label; `isOpraDelayed` is its OPRA-only case.
|
|
76
|
+
*/
|
|
77
|
+
export function isGovernedDelayed(exchange, served) {
|
|
78
|
+
return gateProviderForExchange(exchange) !== null && !served.isRealtimeRouted(exchange);
|
|
79
|
+
}
|
|
80
|
+
/** The venue's delay statement while `exchange` rides its delayed tier (`governedDelaySentence`), else null. */
|
|
81
|
+
export function governedDelayStatement(exchange, served, t) {
|
|
82
|
+
return isGovernedDelayed(exchange, served) ? governedDelaySentence(exchange, served.delayMinutes(exchange), t) : null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The delay statements a surface holding markets of its own (an unsynced Time and sales, an order book, a picture of
|
|
86
|
+
* a chart) must show itself: one per delayed governed plane among `own` that no chart on the screen labels already.
|
|
87
|
+
* The licences ask for one label on the screen while the delayed data shows, never one per panel: a chart streaming
|
|
88
|
+
* the same plane on its delayed tier carries the plane's tag (`chartStreams`: each shown chart's stream venue, the
|
|
89
|
+
* tape a Trades stock chart rides, never its POLYGON identity), so the surface stays bare beside it. With no chart on
|
|
90
|
+
* the screen (a phone's full-screen panel) pass none, and every delayed plane reads its statement. Deduped, in the
|
|
91
|
+
* order the planes first appear in `own`.
|
|
92
|
+
*/
|
|
93
|
+
export function uncoveredDelayStatements(own, chartStreams, served, t) {
|
|
94
|
+
const labelled = new Set(chartStreams.filter((venue) => isGovernedDelayed(venue, served)).map((venue) => gateProviderForExchange(venue)));
|
|
95
|
+
const planes = new Set();
|
|
96
|
+
const out = [];
|
|
97
|
+
for (const exchange of own) {
|
|
98
|
+
const plane = gateProviderForExchange(exchange);
|
|
99
|
+
if (plane === null || labelled.has(plane) || planes.has(plane))
|
|
100
|
+
continue;
|
|
101
|
+
const statement = governedDelayStatement(exchange, served, t);
|
|
102
|
+
if (statement === null)
|
|
103
|
+
continue;
|
|
104
|
+
planes.add(plane);
|
|
105
|
+
out.push(statement);
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Whether a list row may paint a market's price figures (last price, change, sparkline) with no delay mark of its own:
|
|
111
|
+
* never on a gate-governed plane. A search reply names no tier, so a governed figure there is a delayed price nobody
|
|
112
|
+
* labels or a real-time quote beside a delayed chart; the stocks feed row and a CME futures row alike draw none.
|
|
113
|
+
*/
|
|
114
|
+
export function rowFiguresAllowed(exchange) {
|
|
115
|
+
return gateProviderForExchange(exchange) === null;
|
|
56
116
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Category, Exchange } from '
|
|
1
|
+
import { Category, Exchange } from '../v2/v2-enums.leaf.js';
|
|
2
2
|
import { type OptionVenue } from '../../constants/option-venues.constants.js';
|
|
3
3
|
import type { GateProvider } from '../../workers/constants/socket-slots.js';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Category, Exchange } from '
|
|
1
|
+
import { Category, Exchange } from '../v2/v2-enums.leaf.js';
|
|
2
2
|
import { OPTION_VENUES } from '../../constants/option-venues.constants.js';
|
|
3
3
|
/**
|
|
4
4
|
* Whether a gate plane's chain stamps true expiry instants (OptionVenue.expiryInstants: OPRA and CME both,
|
|
@@ -15,6 +15,13 @@ export declare function poolSymbolPair(raw: string): {
|
|
|
15
15
|
} | undefined;
|
|
16
16
|
/** A whole string that is a Solana address: a memecoin mint pasted into search, a launchpad key. */
|
|
17
17
|
export declare function isSolanaBase58Address(text: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The one Solana address in text a user pasted into search, or null: the bare address, or one in quotes or brackets,
|
|
20
|
+
* after a label, with trailing punctuation, or closing a link. Base58 is case-sensitive, so every search box reads a
|
|
21
|
+
* pasted address through this before anything canonicalizes its words (`poolAwareUppercase`). Null for text holding
|
|
22
|
+
* a venue delimiter: a market token (`SOLANA_LAUNCHPAD|<mint>`, a pool token) or a formula is not a paste.
|
|
23
|
+
*/
|
|
24
|
+
export declare function pastedSolanaAddress(text: string): string | null;
|
|
18
25
|
export declare function poolAwareTokens(text: string, tokenizeLegacy: (text: string) => string[]): string[];
|
|
19
26
|
/** Canonicalize venue spelling, never the raw pool symbol, including incomplete typed input. */
|
|
20
27
|
export declare function poolAwareUppercase(text: string): string;
|
|
@@ -22,6 +22,46 @@ const SOLANA_ADDRESS = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
|
22
22
|
export function isSolanaBase58Address(text) {
|
|
23
23
|
return SOLANA_ADDRESS.test(text);
|
|
24
24
|
}
|
|
25
|
+
// What a pasted address arrives in: quotes or brackets, the full stop of the sentence it was copied from, a label
|
|
26
|
+
// ending in a colon ("CA:", "Mint:", "Contract address:", the fullwidth colon too), or a link to the token whose last
|
|
27
|
+
// path segment it is (pump.fun/coin/<mint>, solscan.io/token/<mint>).
|
|
28
|
+
const ADDRESS_OPENERS = /^["'`“‘(<[{\s]+/;
|
|
29
|
+
const ADDRESS_CLOSERS = /["'`”’)>\]}.,;:!?\s]+$/;
|
|
30
|
+
const ADDRESS_LABEL = /^[$A-Za-z][$A-Za-z0-9 ]{0,24}[::]\s*/;
|
|
31
|
+
const ADDRESS_LINK = /^https?:\/\/[^\s/]+\/(\S+)$/i;
|
|
32
|
+
const unwrapAddress = (text) => text.replace(ADDRESS_OPENERS, '').replace(ADDRESS_CLOSERS, '');
|
|
33
|
+
/**
|
|
34
|
+
* The one Solana address in text a user pasted into search, or null: the bare address, or one in quotes or brackets,
|
|
35
|
+
* after a label, with trailing punctuation, or closing a link. Base58 is case-sensitive, so every search box reads a
|
|
36
|
+
* pasted address through this before anything canonicalizes its words (`poolAwareUppercase`). Null for text holding
|
|
37
|
+
* a venue delimiter: a market token (`SOLANA_LAUNCHPAD|<mint>`, a pool token) or a formula is not a paste.
|
|
38
|
+
*/
|
|
39
|
+
export function pastedSolanaAddress(text) {
|
|
40
|
+
let rest = text.trim();
|
|
41
|
+
if (isSolanaBase58Address(rest))
|
|
42
|
+
return rest;
|
|
43
|
+
if (rest.includes('|'))
|
|
44
|
+
return null;
|
|
45
|
+
const link = ADDRESS_LINK.exec(rest);
|
|
46
|
+
if (link)
|
|
47
|
+
rest = link[1].split(/[?#]/)[0].split('/').filter(Boolean).pop() ?? '';
|
|
48
|
+
rest = unwrapAddress(unwrapAddress(rest).replace(ADDRESS_LABEL, ''));
|
|
49
|
+
return isSolanaBase58Address(rest) ? rest : null;
|
|
50
|
+
}
|
|
51
|
+
// An address standing among other words (not inside a longer one): a base58 run of address length. The boundary
|
|
52
|
+
// before it is a group, not a lookbehind, so older Safari still parses the module.
|
|
53
|
+
const ADDRESS_RUN = /(^|[^A-Za-z0-9])([1-9A-HJ-NP-Za-km-z]{32,44})(?![A-Za-z0-9])/g;
|
|
54
|
+
/** Uppercase, except the address runs (`ADDRESS_RUN`), which keep their case. */
|
|
55
|
+
function upperKeepingAddresses(text) {
|
|
56
|
+
let result = '';
|
|
57
|
+
let start = 0;
|
|
58
|
+
for (const match of text.matchAll(ADDRESS_RUN)) {
|
|
59
|
+
const runStart = match.index + match[1].length;
|
|
60
|
+
result += text.slice(start, runStart).toUpperCase() + match[2];
|
|
61
|
+
start = runStart + match[2].length;
|
|
62
|
+
}
|
|
63
|
+
return result + text.slice(start).toUpperCase();
|
|
64
|
+
}
|
|
25
65
|
// Only explicitly routed pool markets are atoms in a formula. Other venues keep
|
|
26
66
|
// their existing tokenizer, including slash as division and legacy aliases.
|
|
27
67
|
const POOL_TOKEN = /\b(?:BNB_ONCHAIN|SOLANA_ONCHAIN)\|[A-Za-z0-9._]+\/[A-Za-z0-9._-]+:[A-Za-z0-9]+/gi;
|
|
@@ -38,11 +78,16 @@ export function poolAwareTokens(text, tokenizeLegacy) {
|
|
|
38
78
|
/** Canonicalize venue spelling, never the raw pool symbol, including incomplete typed input. */
|
|
39
79
|
export function poolAwareUppercase(text) {
|
|
40
80
|
// A pasted address is a case-sensitive identity (a memecoin's mint, a launchpad key): it is
|
|
41
|
-
// looked up as typed, never canonicalized.
|
|
42
|
-
|
|
43
|
-
|
|
81
|
+
// looked up as typed, never canonicalized, and what it was pasted in (`pastedSolanaAddress`) drops away. A whole
|
|
82
|
+
// address keeps the spacing typed around it: that is the person's text, not a wrapping.
|
|
83
|
+
const address = pastedSolanaAddress(text);
|
|
84
|
+
if (address)
|
|
85
|
+
return isSolanaBase58Address(text.trim()) ? text : address;
|
|
44
86
|
if (poolSymbolPair(text))
|
|
45
87
|
return text;
|
|
88
|
+
// Outside market tokens an address among other words keeps its case as well, so deleting the words around it
|
|
89
|
+
// leaves the address, not its capitals. A venue token's id is the venue's to spell (a prediction id's hex run).
|
|
90
|
+
const upper = text.includes('|') ? (part) => part.toUpperCase() : upperKeepingAddresses;
|
|
46
91
|
return poolAwareTokens(text, (part) => {
|
|
47
92
|
// While typing, keep the tail after a known venue intact before the pair/ID is complete. A
|
|
48
93
|
// launchpad market is keyed by a bare base58 or checksummed address, which ends at the next
|
|
@@ -52,11 +97,11 @@ export function poolAwareUppercase(text) {
|
|
|
52
97
|
let start = 0;
|
|
53
98
|
for (const match of part.matchAll(pattern)) {
|
|
54
99
|
const venue = match[1] ?? match[2];
|
|
55
|
-
result += part.slice(start, match.index)
|
|
100
|
+
result += upper(part.slice(start, match.index));
|
|
56
101
|
result += venue.toUpperCase() + match[0].slice(venue.length);
|
|
57
102
|
start = match.index + match[0].length;
|
|
58
103
|
}
|
|
59
|
-
return [result + part.slice(start)
|
|
104
|
+
return [result + upper(part.slice(start))];
|
|
60
105
|
})
|
|
61
106
|
.map((part) => {
|
|
62
107
|
const boundary = part.indexOf('|');
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** What a display path knows of a market: its exchange code, and its asset class where a catalog row names one. */
|
|
2
|
+
export interface StockDisplayMarket {
|
|
3
|
+
exchange?: string | null;
|
|
4
|
+
assetClass?: string | null;
|
|
5
|
+
}
|
|
6
|
+
/** A US stock listing: a US equities venue (tradfi: the free lane, a listing venue, a SIP tape), never an index. */
|
|
7
|
+
export declare function isUsStockListing(market: StockDisplayMarket | null | undefined): boolean;
|
|
8
|
+
/** The ticker a US stock listing shows (`POLYGON|SOXL/USD` reads SOXL); null for every other market. */
|
|
9
|
+
export declare function stockDisplayTicker(exchange: string | null | undefined, symbol: string | null | undefined, assetClass?: string | null): string | null;
|
|
10
|
+
/** The symbol a market shows where no resolved split is at hand: a US stock's ticker, else the stored symbol. */
|
|
11
|
+
export declare function marketDisplaySymbol(exchange: string | null | undefined, symbol: string | null | undefined): string;
|
|
12
|
+
/** The quote a market's name shows after its base: none on a US stock listing, the given quote on any other market. */
|
|
13
|
+
export declare function marketDisplayQuote(market: StockDisplayMarket | null | undefined, quote: string): string;
|
|
14
|
+
/** Display tokens with each US stock token whole: its slash is the vendor's, never division (entry keeps its own). */
|
|
15
|
+
export declare function stockAwareTokens(text: string, tokenizeRest: (text: string) => string[]): string[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// A US stock's stored pair (POLYGON|SOXL/USD) carries the vendor's /USD, no quote: every display names the bare ticker.
|
|
2
|
+
import { checkIsTradFi } from '../chart/marketKind.util.js';
|
|
3
|
+
/** A US stock listing: a US equities venue (tradfi: the free lane, a listing venue, a SIP tape), never an index. */
|
|
4
|
+
export function isUsStockListing(market) {
|
|
5
|
+
return !!market && checkIsTradFi(market.exchange) && market.assetClass !== 'ASSET_CLASS_INDEX';
|
|
6
|
+
}
|
|
7
|
+
// The pair's /USD or its normalized -USD (SOXL-USD); display only: identity, URLs, search and requests keep the pair.
|
|
8
|
+
const VENDOR_QUOTE = /[/-]USD$/i;
|
|
9
|
+
/** The ticker a US stock listing shows (`POLYGON|SOXL/USD` reads SOXL); null for every other market. */
|
|
10
|
+
export function stockDisplayTicker(exchange, symbol, assetClass) {
|
|
11
|
+
if (typeof symbol !== 'string' || !isUsStockListing({ exchange, assetClass }))
|
|
12
|
+
return null;
|
|
13
|
+
return symbol.trim().replace(VENDOR_QUOTE, '') || null;
|
|
14
|
+
}
|
|
15
|
+
/** The symbol a market shows where no resolved split is at hand: a US stock's ticker, else the stored symbol. */
|
|
16
|
+
export function marketDisplaySymbol(exchange, symbol) {
|
|
17
|
+
return stockDisplayTicker(exchange, symbol) ?? symbol ?? '';
|
|
18
|
+
}
|
|
19
|
+
/** The quote a market's name shows after its base: none on a US stock listing, the given quote on any other market. */
|
|
20
|
+
export function marketDisplayQuote(market, quote) {
|
|
21
|
+
return isUsStockListing(market) ? '' : quote;
|
|
22
|
+
}
|
|
23
|
+
// The ticker class carries dots (BRK.B) but no hyphen: a hyphen between tokens is the formula's minus.
|
|
24
|
+
const STOCK_PAIR_TOKEN = /\b([A-Z][A-Z0-9_]*)\|([A-Z0-9.]+\/USD)\b/gi;
|
|
25
|
+
/** Display tokens with each US stock token whole: its slash is the vendor's, never division (entry keeps its own). */
|
|
26
|
+
export function stockAwareTokens(text, tokenizeRest) {
|
|
27
|
+
const tokens = [];
|
|
28
|
+
let start = 0;
|
|
29
|
+
for (const match of text.matchAll(STOCK_PAIR_TOKEN)) {
|
|
30
|
+
if (!isUsStockListing({ exchange: match[1] }))
|
|
31
|
+
continue;
|
|
32
|
+
tokens.push(...tokenizeRest(text.slice(start, match.index)), match[0]);
|
|
33
|
+
start = match.index + match[0].length;
|
|
34
|
+
}
|
|
35
|
+
tokens.push(...tokenizeRest(text.slice(start)));
|
|
36
|
+
return tokens;
|
|
37
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// be misread as month codes.
|
|
5
5
|
import { isContinuousSymbol } from '../chart/continuous-contracts.util.js';
|
|
6
6
|
import { getDateLocale } from '../intl-locale.util.js';
|
|
7
|
+
import { serverNowMs } from '../auth/server-clock.util.js';
|
|
7
8
|
/** CME delivery month codes, in month order (F=Jan ... Z=Dec). */
|
|
8
9
|
const MONTH_CODES = 'FGHJKMNQUVXZ';
|
|
9
10
|
// Root (1+ chars, lazily matched) + month code + 1- or 2-digit year.
|
|
@@ -15,7 +16,7 @@ const CONTRACT_RE = /^(.+?)([FGHJKMNQUVXZ])(\d{1,2})$/;
|
|
|
15
16
|
* nearby expiries, and the window tolerates recently expired contracts
|
|
16
17
|
* without ever wrapping a live listing into the past decade.
|
|
17
18
|
*/
|
|
18
|
-
export function parseCmeContractExpiry(rawSymbol, now = new Date()) {
|
|
19
|
+
export function parseCmeContractExpiry(rawSymbol, now = new Date(serverNowMs())) {
|
|
19
20
|
if (!rawSymbol)
|
|
20
21
|
return null;
|
|
21
22
|
const match = CONTRACT_RE.exec(rawSymbol.trim().toUpperCase());
|
|
@@ -45,7 +46,7 @@ export function parseCmeContractExpiry(rawSymbol, now = new Date()) {
|
|
|
45
46
|
export function contractExpiryEndMs(expiry) {
|
|
46
47
|
return Date.UTC(expiry.year, expiry.monthIndex + 1, 1) - 1;
|
|
47
48
|
}
|
|
48
|
-
export function isContractExpired(rawSymbol, now = new Date()) {
|
|
49
|
+
export function isContractExpired(rawSymbol, now = new Date(serverNowMs())) {
|
|
49
50
|
const expiry = parseCmeContractExpiry(rawSymbol, now);
|
|
50
51
|
if (!expiry)
|
|
51
52
|
return false;
|
|
@@ -54,7 +55,7 @@ export function isContractExpired(rawSymbol, now = new Date()) {
|
|
|
54
55
|
/** One delivery-label formatter per date locale: the venue list labels every contract row with it. */
|
|
55
56
|
const deliveryFormatters = new Map();
|
|
56
57
|
/** Localized delivery label, e.g. "Jul 2026" / "2026年7月". '' when undecodable. */
|
|
57
|
-
export function formatContractExpiry(rawSymbol, locale, now = new Date()) {
|
|
58
|
+
export function formatContractExpiry(rawSymbol, locale, now = new Date(serverNowMs())) {
|
|
58
59
|
const expiry = parseCmeContractExpiry(rawSymbol, now);
|
|
59
60
|
if (!expiry)
|
|
60
61
|
return '';
|
|
@@ -82,7 +83,7 @@ export function formatContractExpiry(rawSymbol, locale, now = new Date()) {
|
|
|
82
83
|
* front-month tag: they are the "just chart it" entry point above the
|
|
83
84
|
* concrete expiries.
|
|
84
85
|
*/
|
|
85
|
-
export function annotateGovernedContracts(venues, isGoverned, now = new Date()) {
|
|
86
|
+
export function annotateGovernedContracts(venues, isGoverned, now = new Date(serverNowMs())) {
|
|
86
87
|
const nowMs = now.getTime();
|
|
87
88
|
const kept = [];
|
|
88
89
|
const continuous = [];
|
|
@@ -61,6 +61,12 @@ export declare function classifyGateRequestPlane(exchange: unknown): GateRequest
|
|
|
61
61
|
export declare function governedPlaneOf(exchange: unknown): GatePlane | null;
|
|
62
62
|
/** True when a gate plane governs the exchange (string or same-plane array). */
|
|
63
63
|
export declare function isGovernedPlaneExchange(exchange: unknown): boolean;
|
|
64
|
+
/** The venue a wall refused and its plane: the first member a gate governs, by the walls' `.some` (never routing's
|
|
65
|
+
* same-plane rule, `governedPlaneOf`), or null. A refusal's words and record row follow this plane alone. */
|
|
66
|
+
export declare function walledVenueOf(exchange: unknown): {
|
|
67
|
+
plane: GateProvider;
|
|
68
|
+
exchange: string;
|
|
69
|
+
} | null;
|
|
64
70
|
/** Nominal delayed-tier seconds for an exchange: the plane's default, or CME's when ungoverned (legacy callers). */
|
|
65
71
|
export declare function delayedDefaultSecondsFor(exchange: unknown): number;
|
|
66
72
|
/** Display twin of `delayedDefaultSecondsFor`, in whole minutes. */
|