Skip to content

Commit a95c804

Browse files
committed
Add Hyperliquid stream health monitoring
- Track Deltas, Depth10, and Quote receives per instrument - Warn on stalled streams with receive age, venue age, and count - Expose stale stream thresholds in Rust and Python configs - Cover monitor logic, stale-stream integration, and docs - Resolves #4298
1 parent 78b5c83 commit a95c804

8 files changed

Lines changed: 903 additions & 33 deletions

File tree

RELEASES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ releases as feedback arrives, before the final `2.0.0` release.
2626
### Enhancements
2727
- Added returns skewness and kurtosis portfolio statistics (#4334), thanks @Martingale42
2828
- Added WebSocket transport backend selection for Python and PyO3 configs (#4342), thanks @graceyangfan
29+
- Added Hyperliquid market data stream health warnings for stalled Deltas, Depth10, and Quote subscriptions (#4298)
2930

3031
### Breaking Changes
3132
- Removed `DataActor` order fill/cancel callbacks and subscription methods; use the message bus

crates/adapters/hyperliquid/src/config.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ pub struct HyperliquidDataClientConfig {
5555
/// WebSocket timeout in seconds.
5656
#[builder(default = 30)]
5757
pub ws_timeout_secs: u64,
58+
/// Receive-age threshold in seconds for warning about stale market-data streams.
59+
/// Choose a value above the instrument's expected quiet period.
60+
/// Set to 0 to disable the stream health monitor.
61+
#[builder(default = 120)]
62+
pub stale_stream_receive_timeout_secs: u64,
63+
/// Interval in seconds for running market-data stream health checks.
64+
/// Set to 0 to disable the stream health monitor.
65+
#[builder(default = 15)]
66+
pub stream_health_check_interval_secs: u64,
67+
/// Cooldown in seconds between stale warnings for the same market-data stream.
68+
#[builder(default = 60)]
69+
pub stale_stream_warning_cooldown_secs: u64,
5870
/// Interval for refreshing instruments in minutes.
5971
#[builder(default = 60)]
6072
pub update_instruments_interval_mins: u64,
@@ -255,6 +267,25 @@ transport_backend = "tungstenite"
255267
assert_eq!(config.http_timeout_secs, 30);
256268
assert_eq!(config.update_instruments_interval_mins, 10);
257269
assert_eq!(config.transport_backend, TransportBackend::Tungstenite);
270+
assert_eq!(config.stale_stream_receive_timeout_secs, 120);
271+
assert_eq!(config.stream_health_check_interval_secs, 15);
272+
assert_eq!(config.stale_stream_warning_cooldown_secs, 60);
273+
}
274+
275+
#[rstest]
276+
fn test_data_config_toml_stale_stream_settings() {
277+
let config: HyperliquidDataClientConfig = toml::from_str(
278+
"
279+
stale_stream_receive_timeout_secs = 30
280+
stream_health_check_interval_secs = 5
281+
stale_stream_warning_cooldown_secs = 20
282+
",
283+
)
284+
.unwrap();
285+
286+
assert_eq!(config.stale_stream_receive_timeout_secs, 30);
287+
assert_eq!(config.stream_health_check_interval_secs, 5);
288+
assert_eq!(config.stale_stream_warning_cooldown_secs, 20);
258289
}
259290

260291
#[rstest]

0 commit comments

Comments
 (0)