Open kasahh opened 2 years ago
It works okay when using a live futures market. So I guess it hasn't been implemented for testnet yet.
The issue appears to be the futures_user_socket function.
On line 1067 in streams.py it is passing self.FSTREAM_URL to the _get_account_socket internal function. _get_account_socket in turn passes the stream_url to _get_stream_url which does not process the client's Testnet flag if a stream_url parameter is passed.
I also note that the class variable FSTREAM_TESTNET_URL appears incorrect
[all references to streams.py] 297:
class BinanceSocketManager:
STREAM_URL = 'wss://stream.binance.{}:9443/'
STREAM_TESTNET_URL = 'wss://testnet.binance.vision/'
FSTREAM_URL = 'wss://fstream.binance.{}/'
**FSTREAM_TESTNET_URL = 'wss://stream.binancefuture.com/'**
DSTREAM_URL = 'wss://dstream.binance.{}/'
DSTREAM_TESTNET_URL = 'wss://dstream.binancefuture.com/'
VSTREAM_URL = 'wss://vstream.binance.{}/'
VSTREAM_TESTNET_URL = 'wss://testnetws.binanceops.{}/'
I altered lines 301 and 1067 as follows:
301 - Before
FSTREAM_TESTNET_URL = 'wss://stream.binancefuture.com/'
301 - After
FSTREAM_TESTNET_URL = 'wss://testnet.binancefuture.com/'
1067 - Before
return self._get_account_socket('futures', stream_url=self.FSTREAM_URL)
1067 - After
return self._get_account_socket('futures', self.FSTREAM_TESTNET_URL if self.testnet else self.FSTREAM_URL)
These changes have sorted out futures_users_socket on testnet for me and do not appear to have caused regression on mainnet
The issue appears to be the futures_user_socket function.
On line 1067 in streams.py it is passing self.FSTREAM_URL to the _get_account_socket internal function. _get_account_socket in turn passes the stream_url to _get_stream_url which does not process the client's Testnet flag if a stream_url parameter is passed.
I also note that the class variable FSTREAM_TESTNET_URL appears incorrect
[all references to streams.py] 297:
class BinanceSocketManager: STREAM_URL = 'wss://stream.binance.{}:9443/' STREAM_TESTNET_URL = 'wss://testnet.binance.vision/' FSTREAM_URL = 'wss://fstream.binance.{}/' **FSTREAM_TESTNET_URL = 'wss://stream.binancefuture.com/'** DSTREAM_URL = 'wss://dstream.binance.{}/' DSTREAM_TESTNET_URL = 'wss://dstream.binancefuture.com/' VSTREAM_URL = 'wss://vstream.binance.{}/' VSTREAM_TESTNET_URL = 'wss://testnetws.binanceops.{}/'
I altered lines 301 and 1067 as follows:
301 - Before
FSTREAM_TESTNET_URL = 'wss://stream.binancefuture.com/'
301 - After
FSTREAM_TESTNET_URL = 'wss://testnet.binancefuture.com/'
1067 - Before
return self._get_account_socket('futures', stream_url=self.FSTREAM_URL)
1067 - After
return self._get_account_socket('futures', self.FSTREAM_TESTNET_URL if self.testnet else self.FSTREAM_URL)
These changes have sorted out futures_users_socket on testnet for me and do not appear to have caused regression on mainnet
Were you able to test it out? It didn't work for me. I also came accross this on binance-docs.github.io
These changes have sorted out futures_users_socket on testnet for me and do not appear to have caused regression on mainnet
Thanks @trpt-nt, it works
Describe the bug I want to get the account updates for things like position open/close, order open/close and balance stream. After running the code below, I get no response even after I create orders and open position on my testnet account.
To Reproduce Code snippet to reproduce the behavior:
Expected behavior I expected to get some sort of data stream but i get none.
Environment (please complete the following information):