fixes around pivot points and BOM matrix

This commit is contained in:
Dobromir Popov
2025-06-24 21:09:35 +03:00
parent 6a4a73ff0b
commit 8685319989
7 changed files with 136 additions and 23 deletions

View File

@ -25,9 +25,11 @@ import logging
import time
try:
import websockets
from websockets.client import connect as websockets_connect
except ImportError:
# Fallback for environments where websockets is not available
websockets = None
websockets_connect = None
import numpy as np
import pandas as pd
from datetime import datetime, timedelta
@ -465,9 +467,9 @@ class MultiExchangeCOBProvider:
ws_url = f"{config.websocket_url}{config.symbols_mapping[symbol].lower()}@depth20@100ms"
logger.info(f"Connecting to Binance WebSocket: {ws_url}")
if websockets is None:
if websockets is None or websockets_connect is None:
raise ImportError("websockets module not available")
async with websockets.connect(ws_url) as websocket:
async with websockets_connect(ws_url) as websocket:
self.exchange_order_books[symbol]['binance']['connected'] = True
logger.info(f"Connected to Binance order book stream for {symbol}")
@ -696,9 +698,9 @@ class MultiExchangeCOBProvider:
ws_url = f"{config.websocket_url}{config.symbols_mapping[symbol].lower()}@trade"
logger.info(f"Connecting to Binance trade stream: {ws_url}")
if websockets is None:
if websockets is None or websockets_connect is None:
raise ImportError("websockets module not available")
async with websockets.connect(ws_url) as websocket:
async with websockets_connect(ws_url) as websocket:
logger.info(f"Connected to Binance trade stream for {symbol}")
async for message in websocket: