Expand description
Block time monitoring for dYdX short-term order expiration estimation.
This module provides BlockTimeMonitor, a component that tracks rolling average
block times from WebSocket data to enable accurate estimation of short-term order
expiration in wall-clock time.
§Overview
dYdX short-term orders expire by block height (typically 20 blocks). Without knowing the actual block time, it’s impossible to estimate when an order will expire in wall-clock time. This monitor captures block timestamps from WebSocket updates and
Structs§
- Block
Time Monitor - Monitors block times and provides estimation utilities for order expiration.
Constants§
- DEFAULT_
BLOCK_ TIME_ MS - Default block time in milliseconds (dYdX mainnet ~500ms).
- DEFAULT_
BLOCK_ TIME_ WINDOW_ SIZE - Default rolling window size for block time averaging.
- MIN_
SAMPLES_ FOR_ ESTIMATE - Minimum number of samples required before trusting the rolling average.
- MIN_
VALID_ BLOCK_ TIME_ MS - Minimum valid block time in milliseconds.