brianleect / binance-pump-alerts

Tracks prices of pairs on binance and notifies when price movements based on pre-defined parameters are met.
142 stars 42 forks source link

[BUG] Restart after reload of the pairs list #33

Closed patbaumgartner closed 3 years ago

patbaumgartner commented 3 years ago

The app is restarting after message -1565 new pairs found, adding to monitored list - Restarting because I use a docker deployment, but it seems the process dies and docker restarts the process.

The following messages are printed in the logs

binance-pump-alerts_1 | Extract time: 0.26943373680114746 / Time ran: 0:02:02.101398 binance-pump-alerts_1 | checkNewListings(data) binance-pump-alerts_1 | File "/binance-pump-alerts/price_tracker.py", line 70, in checkNewListings binance-pump-alerts_1 | symbols_to_add = [asset['symbol'] for asset in data_t if asset['symbol'] not in init_symbols ] binance-pump-alerts_1 | File "/binance-pump-alerts/price_tracker.py", line 70, in binance-pump-alerts_1 | symbols_to_add = [asset['symbol'] for asset in data_t if asset['symbol'] not in init_symbols ] binance-pump-alerts_1 | TypeError: string indices must be integers

binance-pump-alerts_1 | Extracting after 1 s binance-pump-alerts_1 | Extract time: 0.27173900604248047 / Time ran: 0:02:55.764196 binance-pump-alerts_1 | Extracting after 1 s binance-pump-alerts_1 | symbols_to_add = [asset['symbol'] for asset in data_t if asset['symbol'] not in init_symbols ] binance-pump-alerts_1 | TypeError: string indices must be integers binance-pump-alerts_1 | Traceback (most recent call last): binance-pump-alerts_1 | File "/binance-pump-alerts/price_tracker.py", line 22, in binance-pump-alerts_1 | init_data = data[:] # Used for checking for new listings binance-pump-alerts_1 | TypeError: unhashable type: 'slice' binance-pump-alerts_1 | Hard Alert Interval is being used binance-pump-alerts_1 | Extract interval: 1 binance-pump-alerts_1 | Hard Alert Interval is being used binance-pump-alerts_1 | Extract interval: 1

binance-pump-alerts_1 | Hard Alert Interval is being used binance-pump-alerts_1 | Extract interval: 1 binance-pump-alerts_1 | Traceback (most recent call last): binance-pump-alerts_1 | File "/binance-pump-alerts/price_tracker.py", line 22, in binance-pump-alerts_1 | init_data = data[:] # Used for checking for new listings binance-pump-alerts_1 | TypeError: unhashable type: 'slice' binance-pump-alerts_1 | Hard Alert Interval is being used binance-pump-alerts_1 | Extract interval: 1 binance-pump-alerts_1 | Added symbol: BTCUSDT binance-pump-alerts_1 | Added symbol: ETHUSDT

brianleect commented 3 years ago

Have you managed to run it successfully previously? Did the error come in only after my recent changes?

Also, could you show me what params you are using? Decent chance it's caused by the set of parameters being used.

Can you try to set it to just 'USDT' pairs and see if the error persists?

patbaumgartner commented 3 years ago

Hi Brian,

i was running without any issue the whole afternoon. Then added the recent changes you added to the master branch and things started to behave strange. Probably the last commit. Not sure if I hit some API limitations (because there is minus coins -> -1615), but I shouldn't.

I am running with the defaults. Just changed Telegram token and chat id.

Best, Patrick

On Thu, Aug 5, 2021 at 5:57 PM Brian Lee Cheow Teng < @.***> wrote:

Have you managed to run it successfully previously? Did the error come in only after my recent changes?

Also, could you show me what params you are using? Decent chance it's caused by the set of parameters being used.

Can you try to set it to just 'USDT' pairs and see if the error persists?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brianleect/binance-pump-alerts/issues/33#issuecomment-893572335, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADDJ7HH66PJIS6O75CPJ2DT3KYFJANCNFSM5BUDF2PQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

brianleect commented 3 years ago

Hi Brian, i was running without any issue the whole afternoon. Then added the recent changes you added to the master branch and things started to behave strange. Probably the last commit. Not sure if I hit some API limitations (because there is minus coins -> -1615), but I shouldn't. I am running with the defaults. Just changed Telegram token and chat id. Best, Patrick

Hmm ok I'll take a look at my commit history and see if there were any possible issues.

I just tested running on my machine and it doesn't seem to have any issues. I don't think the -1565 pair is normal though. With default settings we should only be seeing 260 pairs being monitored.

I'll try running it on my PC and on my aws ec2 server to see if I can replicate this error.

patbaumgartner commented 3 years ago

I assume this could be also related to some API calls, e.g. weight issues. Maybe there is a way to catch this problem and then not to refresh the list but still sending some messages to telegram? Thanks :)

brianleect commented 3 years ago

I assume this could be also related to some API calls, e.g. weight issues. Maybe there is a way to catch this problem and then not to refresh the list but still sending some messages to telegram? Thanks :)

image

I have an idea on what may have happened. The issue seems to lie in the checkNewListing function. I suspect it's my statement on comparing the length.

We might have had a situation where there was a reduction in pair which was not considered in my code. What is weird however is that to end up with -1565 pairs it would mean that for the latest price array fetched from the REST API from binance there had to be a difference of 1565 pairs? Which makes no sense to me to be honest.

A possible quick fix for now I suppose would to be either completely disable the checking for new listings. Or I could just add a simple conditional to check for cases where we have lesser pairs detected and just exit the function from there to prevent any errors from occuring.

Do let me know what you think @patbaumgartner

patbaumgartner commented 3 years ago

I have also read something about the unavailability of finance. Probably we need to catch an exception.

Removals or additions of coins happen all the time on finance. But the issue still happens after restarts. I guess its an issue with API weights. Is there a possibility to log more?

On Thu, Aug 5, 2021 at 7:05 PM Brian Lee Cheow Teng < @.***> wrote:

I assume this could be also related to some API calls, e.g. weight issues. Maybe there is a way to catch this problem and then not to refresh the list but still sending some messages to telegram? Thanks :)

[image: image] https://user-images.githubusercontent.com/63389110/128390928-cd7ee199-815f-498c-b031-c8a653e6291e.png

I have an idea on what may have happened. The issue seems to lie in the checkNewListing function. I suspect it's my statement on comparing the length.

We might have had a situation where there was a reduction in pair which was not considered in my code. What is weird however is that to end up with -1565 pairs it would mean that for the latest price array fetched from the REST API from binance there had to be a difference of 1565 pairs? Which makes no sense to me to be honest.

A possible quick fix for now I suppose would to be either completely disable the checking for new listings. Or I could just add a simple conditional to check for cases where we have lesser pairs detected and just exit the function from there to prevent any errors from occuring.

Do let me know what you think @patbaumgartner https://github.com/patbaumgartner

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/brianleect/binance-pump-alerts/issues/33#issuecomment-893619740, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADDJ7FFOZE26PCYUTWMNMDT3LAFHANCNFSM5BUDF2PQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

brianleect commented 3 years ago

I have also read something about the unavailability of finance. Probably we need to catch an exception. Removals or additions of coins happen all the time on finance. But the issue still happens after restarts. I guess its an issue with API weights. Is there a possibility to log more?

I don't think the issue is API weights. If weight was exceeded, the price request should have returned an error.

I have updated the new version with a modified version of the function checkNewListings and also an option to disable it in params.py

image

Try running the original version first and see if there's an issue. If it fails try setting the parameter above to False and see if it fixes the problem.

Also, have you tried running the program outside of docker to see if it is a docker related issue or a program one? I have ran the latest version both on my PC and my aws ec2 server and am currently unable to replicate the error.

brianleect commented 3 years ago

@patbaumgartner

https://github.com/brianleect/binance-pump-alerts/issues/13

Another possible cause for the problem if network connectivity is not stable. But seems to be a different error.

patbaumgartner commented 3 years ago

I will deploy the current version tomorrow and see how it works. Will provide feedback afterwards.