Closed antonp01 closed 3 years ago
Running into the same issue on Binance KAVA/USDT (live) just now. v2.32.0 as well.
In my case I do own some KAVA, but it's pending in a sell order. Maybe that's tripping up the bot? The simulation ran just fine for me.
Config for simulation:
"config": {
"base_currency": "KAVA",
"quote_currency": "USDT",
"live": 0,
"autorestart": 1,
"granularity": "15m",
"sim": "fast-sample",
"simenddate": "now"
}
Config to actually run it:
"config": {
"base_currency": "KAVA",
"quote_currency": "USDT",
"live": 1,
"autorestart": 1,
"granularity": "15m"
}
Logs:
Restarting application after exception: ZeroDivisionError('float division by zero')
ZeroDivisionError('float division by zero')
Traceback (most recent call last):
File "/app/models/helper/MarginHelper.py", line 28, in calculate_margin
margin = round((profit / buy_size) * 100, precision)
ZeroDivisionError: float division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/models/helper/MarginHelper.py", line 28, in calculate_margin
margin = round((profit / buy_size) * 100, precision)
ZeroDivisionError: float division by zero
same problem on my side
Caused by #338
https://github.com/whittlem/pycryptobot/pull/338/files#diff-f1e8f1fd905f7dd48b2bb077d93ddad51edcec730e5ca6f6c8c37ef99b452ab7L111
needs self.last_action = 'SELL'
added back
@arma6655 Thanks for the clear description, I've opened a pull request to get it fixed.
Opened #367 to solve another case of division by zero from MarginHelper.py.
The retrieved orders (from getOrders
) contain orders with status filled
and new
.
The new
orders do not contain any buy_size
correct value. So it is converted as a 0
(zero) and the calling method raise this error.
This fix solve the "float division by zero" error message when running the bot in parallele of trading on limits.
Describe the bug just did a git pull to update source, and tried running --sim fast and got division by zero.
To Reproduce