CyberPunkMetalHead / gateio-crypto-trading-bot-binance-announcements-new-coins

This is a crypto trading bot that scans the Binance Annoucements page for new coins, and places trades on Gateio
MIT License
1.22k stars 302 forks source link

Thread search_and_update stops without any error. #45

Open smuu opened 3 years ago

smuu commented 3 years ago

I fell that the search_and_update thread sometimes just stops and throws no error, and the application runs without it. Anyone else observed this? If so I would propose to invest some time in improving the different threads needed to have the bot running stable. In case I find some time, I can do that, or assist with that.

smuu commented 3 years ago

Looking at the logs it just stops to do anything. Not sure what happens here.

2021-10-25 02:56:32,358 INFO: No coins announced, or coin has already been bought/sold. Checking more frequently in case TP and SL need updating 2021-10-25 02:56:32,901 INFO: Checking for coin announcements every 1 minute (in a separate thread) 2021-10-25 02:56:35,363 INFO: No coins announced, or coin has already been bought/sold. Checking more frequently in case TP and SL need updating 2021-10-25 02:56:36,040 INFO: Checking for coin announcements every 1 minute (in a separate thread) 2021-10-25 02:56:38,368 INFO: No coins announced, or coin has already been bought/sold. Checking more frequently in case TP and SL need updating 2021-10-25 02:56:39,186 INFO: Checking for coin announcements every 1 minute (in a separate thread) 2021-10-25 02:56:41,373 INFO: No coins announced, or coin has already been bought/sold. Checking more frequently in case TP and SL need updating 2021-10-25 02:56:44,378 INFO: No coins announced, or coin has already been bought/sold. Checking more frequently in case TP and SL need updating 2021-10-25 02:56:47,383 INFO: No coins announced, or coin has already been bought/sold. Checking more frequently in case TP and SL need updating 2021-10-25 02:56:50,388 INFO: No coins announced, or coin has already been bought/sold. Checking more frequently in case TP and SL need updating 2021-10-25 02:56:53,393 INFO: No coins announced, or coin has already been bought/sold. Checking more frequently in case TP and SL need updating 2021-10-25 02:56:56,398 INFO: No coins announced, or coin has already been bought/sold. Checking more frequently in case TP and SL need updating

nitad54448 commented 3 years ago

I think this is because not coin has been listed (since CHESS).

smuu commented 3 years ago

But the 10 hours before it worked. So not sure why this is the cause.

shiron189002 commented 3 years ago

In get_last_coin() function, you need to be keep connection alive, you can try add something below:

    import requests
    from requests.structures import CaseInsensitiveDict

    ...
    headers = CaseInsensitiveDict()
    headers["Connection"] = "keep-alive"
    headers["Keep-Alive"] = "timeout=5, max=100"

    latest_announcement = requests.get(link, headers=headers)