Multi-threading api problem
evo11x opened this issue · 5 comments
I made a global ServiceProvider from where each thread gets it's api, but one thread is using the websockets, I don't know if that is a problem? But the application now works fine for 1-3 days until it closes without any error. You have any ideea what is happening? Because with the older version of API worked fine.
I don't have time to help debug application code. If someone can provide actionable information demonstrating a multi-threading API problem (and potentially a fix) that would be useful.
Hi, after I updated all the reference dll files and visual studio, now seems to work, except the api rate limiter for the order processor (which runs on another thread), it is too aggressive and cannot process the orders when there are more than 2-3 open orders, after manual stop and restart of the candlestick reader thread it continues to execute orders until it blocks again and some orders remain unfilled forever because of this. It's strange that when restarting the other thread it continues with the order processor thread and there are 1sec delays for each one.
Please note that binance let's a higher number of requests if larger amounts of orders get filled and without many unfilled moving orders.
@sonvister ok I will try to find the issue, the app is definitely not requesting more than 2-3/sec in total from all the threads combined and it hits the rate limiter very often when using the orders (cancel, get bid price, post new order and get order status), stopping and restarting the other thread it continues to work normally for a period of time.
Try refactoring your code completely using async - await. I guess you're mostly using sync code.