added coin API WS implementation

This commit is contained in:
Dobromir Popov
2025-08-08 01:00:38 +03:00
parent bd15bdc87d
commit ba532327b6
5 changed files with 165 additions and 8 deletions

View File

@ -356,7 +356,8 @@ class COBDashboardServer:
if mid_price <= 0:
return
now = datetime.now()
from datetime import timezone
now = datetime.now(timezone.utc)
current_second = now.replace(microsecond=0)
# Get or create current candle
@ -377,7 +378,7 @@ class COBDashboardServer:
if current_second > current_candle['timestamp']:
# Close previous candle
finished_candle = {
'timestamp': current_candle['timestamp'].isoformat(),
'timestamp': current_candle['timestamp'].isoformat(), # UTC ISO8601
'open': current_candle['open'],
'high': current_candle['high'],
'low': current_candle['low'],