From 88bb8beacfa1d835d9f2bf71c8f36cd50a142a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1lli=20Zolt=C3=A1n?= Date: Thu, 19 Aug 2021 01:30:44 +0200 Subject: [PATCH] rebalance: division by zero fix this occurs if I don't have any transaction forward for a day --- rebalance/rebalance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rebalance/rebalance.py b/rebalance/rebalance.py index 2b39cec..3b9d732 100755 --- a/rebalance/rebalance.py +++ b/rebalance/rebalance.py @@ -705,7 +705,10 @@ def get_avg_forward_fees(plugin: Plugin, intervals): # return average intermediate for idx, i in enumerate(res): - res[idx] = fees[idx] / total[idx] * 10**6 + if int(total[idx]) > 0: + res[idx] = fees[idx] / total[idx] * 10**6 + else: + res[idx] = 0 return res