You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Import the WebSockets library for WebSocket communication and JSON for data handlingusing WebSockets
using JSON
# Function to fetch data from Binance WebSocket APIfunctionfetch_binance_data(url::String)
# Open a WebSocket connection to the provided URL
WebSockets.open(url) do ws
# Loop to continuously read incoming messages from WebSocketwhiletruetry# Read a single message from the WebSocket connection
msg =read(ws, String)
# Parse the JSON message into a Julia dictionary
data = JSON.parse(msg)
# Print the received data (you may replace this with other processing code)println(data)
catch e
# Print any errors encountered while reading/parsing dataprintln("Error encountered: $e")
# Break out of the loop on error to avoid infinite error printingbreakendendendend# Binance WebSocket URL to fetch depth data for ADA/USDT and BTC/USDT pairs
url ="wss://stream.binance.com:9443/stream?streams=adausdt@depth20@100ms/btcusdt@depth20@100ms"# Call the function to initiate WebSocket data fetchingfetch_binance_data(url)
raises
Error encountered: ErrorException("OpenSSL.SSLStream does not support byte I/O")
I have no idea why?
Best regards
PS :
# Import the HTTP library for WebSocket communication and JSON for data handlingusing HTTP
using JSON
# Function to fetch data from Binance WebSocket APIfunctionfetch_binance_data(url::String)
# Open a WebSocket connection to the provided URL
HTTP.WebSockets.open(url) do ws
# Loop to continuously read incoming messages from WebSocketfor msg in ws
# Parse the JSON message into a Julia dictionary
data = JSON.parse(msg)
# Print the received data (you may replace this with other processing code)println(data)
endendend# Binance WebSocket URL to fetch depth data for ADA/USDT and BTC/USDT pairs
url ="wss://stream.binance.com:9443/stream?streams=adausdt@depth20@100ms/btcusdt@depth20@100ms"# Call the function to initiate WebSocket data fetchingfetch_binance_data(url)
is a workaround
The text was updated successfully, but these errors were encountered:
Hello,
The following code
raises
I have no idea why?
Best regards
PS :
is a workaround
The text was updated successfully, but these errors were encountered: