python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

Binanse.US: start_kline_socket returns nothing for ???-USD pairs

Open Bob12345 opened this issue 4 years ago • 8 comments

Describe the bug I do get the historical klines but the interval updates are not working -- complete silence conn_key = bm.start_kline_socket(pair, process_message, interval=my_interval)

To Reproduce use "BNBUSD" as your pair, 1 minute interval conn_key = bm.start_kline_socket(pair, process_message, interval=my_interval)

Expected behavior I should be getting inteval klines as with all the non-USD pairs

Environment (please complete the following information):

  • Python version: 3.6
  • OS: Win 10 and Ubuntu.
  • python-binance version 0.7.5/0.7.9

Logs or Additional context no logs, no errors.

Thanks! P.S. I'm fully verified for trading by Binance.US and can trade -USD pairs on Binance.US manually. My non-USD pairs work with python-binance just fine.

Bob12345 avatar Mar 17 '21 23:03 Bob12345

Let me put it this way: is anyone reading this able to trade USD on Binance.US using this API or any other API?

Bob12345 avatar Mar 20 '21 17:03 Bob12345

I am having similar issue as you, you won't find BNBUSD listed when querying ExchangeInfo, however you can find it via Binance web, I'm not sure why. I'm finding similar case with other *USD cryptos. I was also looking at Bitsgap and was able to connect Binance exchange via API integrations, and there they had no problem pulling that info from Binance via API, I dont know how

gitsmash avatar Mar 21 '21 22:03 gitsmash

found solution, by default its using Binance.com exchange, if you want to use .us pass this to client: client = Client(api_key, api_secret, tld='us')

gitsmash avatar Mar 21 '21 23:03 gitsmash

found solution, by default its using Binance.com exchange, if you want to use .us pass this to client: client = Client(api_key, api_secret, tld='us')

I've been using tld='us' all along, because I only trade on .US now.

Bob12345 avatar Mar 23 '21 20:03 Bob12345

@gitsmash thank you sir. was getting api authentication issues for hours

calebpitts avatar Apr 03 '21 04:04 calebpitts

@Bob12345 I have the same issue and I have also been using tld='us'. Does anyone know if this is an issue with the python-binance client library or with the binance.us API?

Haakam21 avatar Apr 05 '21 22:04 Haakam21

Alright, I found the solution to get sockets for USD pairs on binance.us:

client = Client(api_key, api_secret, tld='us')
socket_manager = BinanceSocketManager(client)
socket_manager.STREAM_URL = 'wss://stream.binance.us:9443/
...

I tried out a different binance python client (unicorn-binance-websocket-api) and saw that it was correctly returning USD pair sockets. So after looking at the source code for python-binance I realized that setting tld in the Client does not carry over to the BinanceSocketManager. So one must do it manually.

Haakam21 avatar Apr 05 '21 23:04 Haakam21

Alright, I found the solution to get sockets for USD pairs on binance.us:

client = Client(api_key, api_secret, tld='us')
socket_manager = BinanceSocketManager(client)
socket_manager.STREAM_URL = 'wss://stream.binance.us:9443/
...

I tried out a different binance python client (unicorn-binance-websocket-api) and saw that it was correctly returning USD pair sockets. So after looking at the source code for python-binance I realized that setting tld in the Client does not carry over to the BinanceSocketManager. So one must do it manually.

Fantastic, that worked!!!! Thank you very much.

Bob12345 avatar Apr 28 '21 20:04 Bob12345