summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortehcoderer <me@tehcoderer.com>2024-05-30 11:04:25 -0400
committertehcoderer <me@tehcoderer.com>2024-05-30 11:04:25 -0400
commit23ef701786714325d475603e286863a539df1745 (patch)
tree5a90d148cc132c126fad8a9d03869746f7aa11fb
parent846f63e1327af2269bab66d3427d6f0a11d079cf (diff)
Update crypto_historical.py
-rw-r--r--openbb_platform/providers/binance/openbb_binance/models/crypto_historical.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/openbb_platform/providers/binance/openbb_binance/models/crypto_historical.py b/openbb_platform/providers/binance/openbb_binance/models/crypto_historical.py
index 796910a8ac8..3dc2f9da373 100644
--- a/openbb_platform/providers/binance/openbb_binance/models/crypto_historical.py
+++ b/openbb_platform/providers/binance/openbb_binance/models/crypto_historical.py
@@ -72,13 +72,12 @@ class BinanceCryptoHistoricalFetcher(Fetcher):
) as websocket:
logger.info("Connected to WebSocket server.")
end_time = datetime.now() + timedelta(seconds=query.lifetime)
- print("Connected to WebSocket server.")
try:
- chunk = await websocket.recv()
- print(f"Chunk me baby: {chunk}")
- while datetime.now() < end_time:
- chunk = await websocket.recv()
- yield json.loads(chunk)
+ async for message in websocket:
+ data = json.loads(message)
+ yield data
+ if datetime.now() >= end_time:
+ break
except websockets.exceptions.ConnectionClosed as e:
logger.error("WebSocket connection closed.")
raise e