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

API exception when a new announcement is detected but the coin is not listed on on gate.io #4

Closed davidebonavita closed 3 years ago

davidebonavita commented 3 years ago

It seems that this exception is not handled. Shouldn't it try in a few minutes/hours again if the coin is not listed?


New annoucement detected: LAZIO
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/gate_api/api_client.py", line 190, in __call_api
    response_data = self.request(
  File "/usr/local/lib/python3.8/dist-packages/gate_api/api_client.py", line 447, in request
    return self.rest_client.GET(
  File "/usr/local/lib/python3.8/dist-packages/gate_api/rest.py", line 237, in GET
    return self.request(
  File "/usr/local/lib/python3.8/dist-packages/gate_api/rest.py", line 232, in request
    raise ApiException(http_resp=r)
gate_api.exceptions.ApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Date': 'Tue, 19 Oct 2021 09:28:30 GMT', 'Content-Type': 'application/json', 'Content-Length': '63', 'Connection': 'keep-alive', 'Server': 'openresty', 'X-Request-Id': '[66c99e50-81227577]'})
HTTP response body: {"label":"INVALID_CURRENCY","message":"Invalid currency LAZIO"}```
CyberPunkMetalHead commented 3 years ago

If the coin is not listed the set-up would lose its efficiency as it’s quite time sensitive to place a buy once the announcement lands, but I agree that it should be handled in any case.

theali2 commented 3 years ago

I made a quick temporary fix for this by adding LAZIO to the list of exclusions. new_listings_scraper.py Line 18 changed to: exclusions = ['Futures', 'Margin', 'adds', 'Adds', 'LAZIO']

Also delete file new_listing.json. (or remove "LAZIO" from it)

raulnavarro82 commented 3 years ago

I think it would be better to add 'Launchpad' to exclusions, better than 'LAZIO' because it will happen in any Launchpad coin announcement. But it would be much better to fix the error, of course.

yasinzaii commented 3 years ago

I think it would be better to add 'Launchpad' to exclusions, better than 'LAZIO' because it will happen in any Launchpad coin announcement. But it would be much better to fix the error, of course.

Thanks for the idea. Should be added to the upcoming upgrade of the bot