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

Issue with ELF / POLY listing #4

Closed
bwasik opened this issue Sep 8, 2021 · 9 comments
Closed

Issue with ELF / POLY listing #4

bwasik opened this issue Sep 8, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@bwasik
Copy link

bwasik commented Sep 8, 2021

It didn't purchase and crashed with this log:

[ERROR] 2021-09-08 10:00:04,145: Traceback (most recent call last):
  File "C:\py\trading-bot-new-coins-oop\bot\bot.py", line 71, in run_async
    self.process_new_ticker(new_ticker)
  File "C:\py\trading-bot-new-coins-oop\bot\bot.py", line 228, in process_new_ticker
    price = self.broker.get_current_price(new_ticker)
  File "C:\py\trading-bot-new-coins-oop\broker\broker.py", line 166, in get_current_price
    return float(self.futures_mark_price(symbol=ticker.ticker)["markPrice"])
  File "C:\Users\Bawa\AppData\Roaming\Python\Python39\site-packages\binance\client.py", line 5203, in futures_mark_price
    return self._request_futures_api('get', 'premiumIndex', data=params)
  File "C:\Users\Bawa\AppData\Roaming\Python\Python39\site-packages\binance\client.py", line 339, in _request_futures_api
    return self._request(method, uri, signed, True, **kwargs)
  File "C:\Users\Bawa\AppData\Roaming\Python\Python39\site-packages\binance\client.py", line 315, in _request
    return self._handle_response(self.response)
  File "C:\Users\Bawa\AppData\Roaming\Python\Python39\site-packages\binance\client.py", line 324, in _handle_response
    raise BinanceAPIException(response, response.status_code, response.text)
binance.exceptions.BinanceAPIException: APIError(code=-1121): Invalid symbol.
@easyguyme
Copy link

It didn't purchase and crashed with this log:

[ERROR] 2021-09-08 10:00:04,145: Traceback (most recent call last):
  File "C:\py\trading-bot-new-coins-oop\bot\bot.py", line 71, in run_async
    self.process_new_ticker(new_ticker)
  File "C:\py\trading-bot-new-coins-oop\bot\bot.py", line 228, in process_new_ticker
    price = self.broker.get_current_price(new_ticker)
  File "C:\py\trading-bot-new-coins-oop\broker\broker.py", line 166, in get_current_price
    return float(self.futures_mark_price(symbol=ticker.ticker)["markPrice"])
  File "C:\Users\Bawa\AppData\Roaming\Python\Python39\site-packages\binance\client.py", line 5203, in futures_mark_price
    return self._request_futures_api('get', 'premiumIndex', data=params)
  File "C:\Users\Bawa\AppData\Roaming\Python\Python39\site-packages\binance\client.py", line 339, in _request_futures_api
    return self._request(method, uri, signed, True, **kwargs)
  File "C:\Users\Bawa\AppData\Roaming\Python\Python39\site-packages\binance\client.py", line 315, in _request
    return self._handle_response(self.response)
  File "C:\Users\Bawa\AppData\Roaming\Python\Python39\site-packages\binance\client.py", line 324, in _handle_response
    raise BinanceAPIException(response, response.status_code, response.text)
binance.exceptions.BinanceAPIException: APIError(code=-1121): Invalid symbol.

I am also getting the same error.

@cdalton713
Copy link
Owner

Sorry for the delay on this. I unfortunately don't have enough information to replicate the issue (I missed this sale myself) - I'm assuming there's a problem with the ticker format passed to the Binance API. If anyone has a record of the value of the ticker processed and sent to the API that would help.

To avoid this issue in the future, I've added a verbose logging file that saves much more information about each attempted transaction. Please pull this new version and include the relevant information for this new log file for any other issues. I've also added 'retries' for connection refusals which periodically occur.

@bwasik
Copy link
Author

bwasik commented Sep 16, 2021

Thanks, I think you are right as original repository has very simillar issue reported as well. There is json format mismatch for real trades. I will pull latest changes and keep it running and I will get back to you in case of any findings.

@cdalton713
Copy link
Owner

I just reread my code again but still haven't found anything standing out as problematic. This script is executing quickly, I suppose it's possible the program is requesting a price from Binance before their API is even ready for it... I just added retry's to get_current_price and place_order - if either of these methods fails, they will retry 2 times each with a 3-second delay between each failure. This should hopefully add enough time to still make the purchase without too much of a delay (if that's indeed the issue).

@cdalton713
Copy link
Owner

It looks like there was a new coin on Sept 22, did either of you happen to catch it in your logs @bwasik @easyguyme? I'm testing a new version with notifications (dev branch) and mistakenly missed it 😔. The verbose log should have enough information for me to fix whatever this issue is.

@easyguyme
Copy link

I have no logs logged for sept 22 only 19th

@jarrodjay
Copy link

I missed two coins today, both with the "binance.exceptions.BinanceAPIException: APIError(code=-1121): Invalid symbol."

Verbose logs were:

[DEBUG] 2021-09-24 06:00:00,384: PROCESSING NEW TICKER:
{"ticker": "YGGUSDT", "base_ticker": "YGG", "quote_ticker": "USDT"}.
[DEBUG] 2021-09-24 06:00:00,384: [BINANCE]      Preparing to buy YGGUSDT.
[DEBUG] 2021-09-24 10:00:00,405: PROCESSING NEW TICKER:
{"ticker": "SYSUSDT", "base_ticker": "SYS", "quote_ticker": "USDT"}.
[DEBUG] 2021-09-24 10:00:00,405: [BINANCE]      Preparing to buy SYSUSDT.

Actual error:

[ERROR] 2021-09-24 10:00:03,912: Traceback (most recent call last):
  File "/root/trading-bot-new-coins/bot/bot.py", line 72, in run_async
    self.process_new_ticker(new_ticker)
  File "/root/trading-bot-new-coins/bot/bot.py", line 240, in process_new_ticker
    price = self.broker.get_current_price(new_ticker)
  File "/usr/local/lib/python3.6/dist-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/root/trading-bot-new-coins/util/decorators.py", line 113, in retry_decorator
    logger,
  File "/root/trading-bot-new-coins/util/decorators.py", line 41, in __retry_internal
    return f()
  File "/root/trading-bot-new-coins/broker/broker.py", line 229, in get_current_price
    return float(self.futures_mark_price(symbol=ticker.ticker)["markPrice"])
  File "/usr/local/lib/python3.6/dist-packages/binance/client.py", line 5203, in futures_mark_price
    return self._request_futures_api('get', 'premiumIndex', data=params)
  File "/usr/local/lib/python3.6/dist-packages/binance/client.py", line 339, in _request_futures_api
    return self._request(method, uri, signed, True, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/binance/client.py", line 315, in _request
    return self._handle_response(self.response)
  File "/usr/local/lib/python3.6/dist-packages/binance/client.py", line 324, in _handle_response
    raise BinanceAPIException(response, response.status_code, response.text)
binance.exceptions.BinanceAPIException: APIError(code=-1121): Invalid symbol.

@cdalton713
Copy link
Owner

Fixed! Thank you @jarrodjay for posting.

FYI, this new update also now has notifications - details are in the readme. Right now I have Discord and Telegram set up, but if anyone wants another service open an issue/discussion.

@jarrodjay
Copy link

jarrodjay commented Sep 25, 2021

Thank YOU for this fork. It's inspired me to start playing around with Python too. Love the notification setup.

@cdalton713 cdalton713 added the bug Something isn't working label Nov 5, 2021
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

4 participants