Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after new Coin detection #136

Open
kahnesaaron opened this issue Jan 6, 2022 · 2 comments
Open

Error after new Coin detection #136

kahnesaaron opened this issue Jan 6, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@kahnesaaron
Copy link

Ive installed the Bot some days ago, but today was the first time it was running while a new Coin was detected.
But I instantly got this error after the detection.
Is this an error on my end and i need to fix a lib or something?

2022-01-06 10:42:21,312 INFO: New announcement detected: CLH
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "src/main.py", line 79, in buy
    obj = get_last_price(announcement_coin, globals.pairing, False)
  File "/home/pi/Desktop/announcement trade/src/trade_client.py", line 20, in get_last_price
    assert len(trades) == 1
AssertionError
@kahnesaaron kahnesaaron added the bug Something isn't working label Jan 6, 2022
@jase-Base
Copy link

same here

@Linus045
Copy link
Collaborator

Linus045 commented Jan 6, 2022

The method list_trades() should return the current market trades.
see. https://github.com/gateio/gateapi-python/blob/master/docs/SpotApi.md#list_trades

It seems though, that none were available for the given pair, which caused the exception.
This is a problem on the bot's end and not on your end.

To prevent the exception, assert should be replaced with an if-statement and that returns an invalid price (e.g. 0 / -1) if no trades are available. (buy() needs to be changed as well then to verify the price)
Or return back to list_tickers as it was before (see 22748ee).

@CyberPunkMetalHead what do you think is the best approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants