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

When chosen pairing doesn't exist, print error accordingly #172

Open
coy123 opened this issue Feb 8, 2022 · 0 comments
Open

When chosen pairing doesn't exist, print error accordingly #172

coy123 opened this issue Feb 8, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@coy123
Copy link

coy123 commented Feb 8, 2022

trades = spot_api.list_trades(currency_pair=f"{base}_{quote}", limit=1)
assert len(trades) == 1

I had USDC as my preferred pairing in the last WOO anouncement. Gate.io, however, only makes USDT_WOO and ETH_WOO pairings available. This assert line caused the following error:

{"log":"Traceback (most recent call last):\n","stream":"stderr","time":"2022-02-08T02:20:56.351154707Z"}
{"log":"  File \"/usr/local/lib/python3.9/threading.py\", line 973, in _bootstrap_inner\n","stream":"stderr","time":"2022-02-08T02:20:56.351189051Z"}
{"log":"    self.run()\n","stream":"stderr","time":"2022-02-08T02:20:56.352852517Z"}
{"log":"  File \"/usr/local/lib/python3.9/threading.py\", line 910, in run\n","stream":"stderr","time":"2022-02-08T02:20:56.352999854Z"}
{"log":"    self._target(*self._args, **self._kwargs)\n","stream":"stderr","time":"2022-02-08T02:20:56.353485095Z"}
{"log":"  File \"/src/gateio_new_coins_announcements_bot/main.py\", line 79, in buy\n","stream":"stderr","time":"2022-02-08T02:20:56.353712756Z"}
{"log":"    obj = get_last_price(announcement_coin, globals.pairing, False)\n","stream":"stderr","time":"2022-02-08T02:20:56.353996537Z"}
{"log":"  File \"/src/gateio_new_coins_announcements_bot/trade_client.py\", line 23, in get_last_price\n","stream":"stderr","time":"2022-02-08T02:20:56.354121108Z"}
{"log":"    assert len(trades) == 1\n","stream":"stderr","time":"2022-02-08T02:20:56.354310747Z"}
{"log":"AssertionError\n","stream":"stderr","time":"2022-02-08T02:20:56.354449017Z"}

I would suggest having an if check and a good log message instead of an assert here, so that people don't have to look into code like I did. :)

@Linus045 Linus045 added the enhancement New feature or request label Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants