-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
websocket for Binance US #58
Comments
I noticed that this issue was not resolved, here is a corrected and working codes to pull data from Binance network. This is also working if you're in the USA.
TO use this, just run the function and pass the symbol of the coins as the parameterTo check BITCOIN and USDT, do this.
RESULT:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have the most primitive python code to see if I can use the websocket for getting data but it doesn't seem to be working properly.
Here's the code:
import websocket, json, pprint
SOCKET = "wss://stream.binance.us:9443/ws/ethusd@kline_1m"
def on_open(ws):
print('opened connection')
def on_close(ws):
print('closed connection')
def on_error(ws, error):
print(error)
def on_message(ws, message):
print('received message')
json_message = json.loads(message)
pprint.pprint(json_message)
ws = websocket.WebSocketApp(SOCKET, on_open=on_open, on_close=on_close, on_error=on_error, on_message=on_message)
ws.run_forever()
The result is the following:
[WinError 10061] No connection could be made because the target machine actively refused it
on_close() takes 1 positional argument but 3 were given
The text was updated successfully, but these errors were encountered: