feat: collect Bybit orderbook observations for training

This commit is contained in:
Курнат Андрей
2026-07-15 00:36:56 +03:00
parent d0869b5d29
commit 2967cd607c
14 changed files with 374 additions and 21 deletions
+8
View File
@@ -172,6 +172,8 @@ class Settings:
bybit_rest_base_url_override: str = ""
bybit_websocket_url_override: str = ""
time_series_fallback_mode: str = "trend_macd"
market_observation_enabled: bool = True
market_observation_sample_seconds: float = 30.0
@property
def rest_base_url(self) -> str:
@@ -358,6 +360,10 @@ def load_settings(env_file: str | Path | None = None) -> Settings:
time_series_fallback_mode=os.getenv(
"TIME_SERIES_FALLBACK_MODE", "trend_macd"
).strip().lower(),
market_observation_enabled=_bool_env("MARKET_OBSERVATION_ENABLED", True),
market_observation_sample_seconds=_float_env(
"MARKET_OBSERVATION_SAMPLE_SECONDS", 30.0
),
)
_validate_settings(settings)
if settings.trading_mode == "live" and not settings.live_ready:
@@ -396,6 +402,8 @@ def _validate_settings(settings: Settings) -> None:
errors.append("LIVE_RECONCILIATION_INTERVAL_SECONDS must be positive")
if settings.time_series_fallback_mode not in {"trend_macd", "legacy"}:
errors.append("TIME_SERIES_FALLBACK_MODE must be trend_macd or legacy")
if settings.market_observation_sample_seconds <= 0:
errors.append("MARKET_OBSERVATION_SAMPLE_SECONDS must be positive")
if errors:
raise ValueError("; ".join(errors))