ThreadedWebsocketManager()
@pcriadoperez ci sta già lavorando.
Dal 24/10/2024.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Describe the bug
I'm using python-binance's example of a threaded websocket manager, to retrieve BTCUSDT prices. When running the script within jupyter lab i receive the follwoing RuntimeError:Exception in thread Thread-9:
Traceback (most recent call last):
File "C:\Users\pb\Documents\Python_Anaconda3\envs\CryptoPredictor\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\pb\Documents\Python_Anaconda3\envs\CryptoPredictor\lib\site-packages\binance\threaded_stream.py", line 59, in run
self._loop.run_until_complete(self.socket_listener())
File "C:\Users\pb\Documents\Python_Anaconda3\envs\CryptoPredictor\lib\asyncio\base_events.py", line 625, in run_until_complete
self._check_running()
File "C:\Users\pb\Documents\Python_Anaconda3\envs\CryptoPredictor\lib\asyncio\base_events.py", line 584, in _check_running
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
If running it in PyCharm i don't receive any errors but also no output and nothing seems to be happening.
To Reproduce
`import time
from binance import ThreadedWebsocketManager
api_key = '<api_key'>
api_secret = '<api_secret'>
def main():
symbol = 'BNBBTC'
twm = ThreadedWebsocketManager(api_key=api_key, api_secret=api_secret)
# start is required to initialise its internal loop
twm.start()
def handle_socket_message(msg):
print(f"message type: {msg['e']}")
print(msg)
twm.start_kline_socket(callback=handle_socket_message, symbol=symbol)
# multiple sockets can be started
twm.start_depth_socket(callback=handle_socket_message, symbol=symbol)
# or a multiplex socket can be started like this
# see Binance docs for stream names
streams = ['bnbbtc@miniTicker', 'bnbbtc@bookTicker']
twm.start_multiplex_socket(callback=handle_socket_message, streams=streams)
twm.join()
if name == "main":
main()`
Expected behavior
A clear and concise description of what you expected to happen.
Environment (please complete the following information):
- Python version: [e.g. 3.5]
- Virtual Env: [e.g. virtualenv, conda]
- OS: [e.g. Mac, Ubuntu]
- python-binance version
Logs or Additional context
Jupyter Lab Python Setup:
- Python = 3.10.13
- jupyter lab = 4.0.10
- python-binance = 1.0.19
PyCharm Setup:
- Python = 3.9.13
- python-binance = 1.0.19
Any Ideas on how to fix this? I saw different posts about this from 2022 and 2023 and was wondering if it is still the same fix, replacing some line of code within the python-binance library
- Lingua principale
- Python
- Stelle
- 7.2k
- Fork
- 2.3k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sammchardy/python-binance
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
sammchardy/python-binance#1666 · 1 commento ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 65/100
sammchardy/python-binance#864 ·
-
Would you be interested in trying out picows as a websocket client?Forse di nuovo libera @pcriadoperez l’ha presa 225 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
sammchardy/python-binance#1671 · 2 commenti · 2 assegnatari ·
-
Signature IssueForse di nuovo libera @carlosmiei l’ha presa 225 giorni fa e non c’è nessuna pull request aperta. Aperta
sammchardy/python-binance#1669 · 1 commento · 1 assegnatario ·
-
Binance Testnet DNS Resolution Failure (testnet.binance.vision) Causes “Exchange not connected”Forse di nuovo libera @carlosmiei l’ha presa 245 giorni fa e non c’è nessuna pull request aperta. Aperta
sammchardy/python-binance#1667 · 1 commento · 1 assegnatario ·
Tutte le issue di sammchardy/python-binance
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
qgis/QGIS-Plugins-Website#459 ·
-
bug severity:medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
bot-found bug priority: P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
madenvel/KalinkaPlayer#179 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ls1intum/edutelligence#1098 ·
I maintainer di solito rispondono entro 1 giorno