Open shadowk29 opened 5 years ago
Interesting! I never actually ran the Python 2 version, I immediately edited the program for Python 3.
Yea, I can maintain a 15 coin portfolio with room to spare in the python2 version, in python3 it can't keep up. Must be some tkinter backend changes between the versions.
It's a good excuse to learn multithreading (thanks for your example code, it will be immensely helpful) - but because pandas is not threadsafe I will have to refactor it drastically. I don't know how that lack of thread safety will manifest itself here, but I suspect it means that the GUI will diverge from reality over time, so please be careful using the threaded version to execute trades, as it may not be operating with the right information.
Some of the issues may also relate to the python-binance code, which it appears from their README (https://github.com/sammchardy/python-binance) may not be 3.7 compatible in its entirety. I notice that requests to binance through them are noticeably slower, so that might be the source of the issue. I may try 3.6 to see if it is better, since they say is supports 3.6.
Thanks for the heads up! I thought that the message queue would have solved any thread safe issues. Ill look into it further. I have been comparing the GUI data to the Binance app quiet regularly looking for any discrepancies but didn't notice anything unusual.
Obviously, feel free to refactor anything you need. After all its your show. Ill be looking out for any changes :)
It's possible that it works fine, but thread safety problems have a nasty habit of sneaking up on you in ways that are tricky to predict. At minimum I would restart it regularly, since any issues in syncing would presumably accumulate over time.
I would have assumed the queue solved it as well, but I was surprised to learn that pandas is not thread safe even when conducting read-only operations. How that is possible I have no idea, but so says stackoverflow.
Some of the issues may also relate to the python-binance code, which it appears from their README (https://github.com/sammchardy/python-binance) may not be 3.7 compatible in its entirety. I notice that requests to binance through them are noticeably slower, so that might be the source of the issue. I may try 3.6 to see if it is better, since they say is supports 3.6.
This seems very plausible.
While the Python 2 version on the legacy branch is able to keep a 15+ coin portfolio up to date using a single thread, the python 3 update cannot keep up with message processing.