-1

I have an application that uses the binance api to trade and do some other stuff. The app worked fine for like 2 years, but one day it stopped working. So i decided to create a basic script to validate the core functionality of the api. I did everything exactly like its described in several offical docs and tutorials but its still not working as expected. Here is my code:

from binance import Client, ThreadedWebsocketManager
api_key = 'my_key'
api_secret = 'my_secret'
client = Client(api_key, api_secret)
def process_message(msg):
 print("message type: {}".format(msg['e']))
 print(msg)
twm = ThreadedWebsocketManager(api_key=api_key, api_secret=api_secret)
twm.start()
ret = twm.start_kline_socket(callback=process_message, symbol='BTCEUR', interval='1m')
print(ret)
twm.join()

So, what happens at all? The twm is created and my print statement returns btceur@kline_1m
thats all. I expected the script to call the process_message func every 1 minute, but it does not get called after a 1 min session has completed. I have seen some similar troubles with older versions, have tried all possible solutions but I wasn ́t able to fix it. I am using the latest python-binance version, v1.0.19 - 2023年08月11日 and python 3.12.3

asked May 25, 2024 at 15:35

1 Answer 1

-1

python 3.12 is not well supported by all libraries.

You should use python 3.11 for production.

You can also try to upgrade all dependencies, especially aiohttp.

answered May 25, 2024 at 15:50
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Actually downgrading python to 3.11 solved my problem.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.