Harden trading, training, and monitoring

This commit is contained in:
Codex
2026-07-10 15:51:53 +03:00
parent 6fb79ee2a9
commit 069d75d2f2
55 changed files with 2658 additions and 2332049 deletions
+8 -1
View File
@@ -1,6 +1,6 @@
from __future__ import annotations
from crypto_spot_bot.market_data import _closed_candles, _is_closed_kline_row
from crypto_spot_bot.market_data import _candles_due, _closed_candles, _is_closed_kline_row
from crypto_spot_bot.models import Candle
@@ -19,3 +19,10 @@ def test_closed_candles_excludes_current_open_interval() -> None:
def test_websocket_kline_requires_confirmed_candle() -> None:
assert _is_closed_kline_row({"start": 7_200_000, "confirm": False}, "60") is False
assert _is_closed_kline_row({"start": 7_200_000, "confirm": True}, "60") is True
def test_rest_candles_refresh_only_after_next_bar_closes() -> None:
candle = Candle(10 * 60_000, 1, 1, 1, 1, 1)
assert _candles_due([candle], "1", now_ms=11 * 60_000 + 30_000) is False
assert _candles_due([candle], "1", now_ms=12 * 60_000) is True