Protect against 0 values
This commit is contained in:
parent
7e4fe23bf9
commit
29c6a9263d
@ -74,7 +74,7 @@ class VolatilityFilter(IPairList):
|
|||||||
if daily_candles is not None:
|
if daily_candles is not None:
|
||||||
highest_high = daily_candles['high'].max()
|
highest_high = daily_candles['high'].max()
|
||||||
lowest_low = daily_candles['low'].min()
|
lowest_low = daily_candles['low'].min()
|
||||||
pct_change = (highest_high - lowest_low) / lowest_low
|
pct_change = ((highest_high - lowest_low) / lowest_low) if lowest_low > 0 else 0
|
||||||
if pct_change >= self._min_volatility:
|
if pct_change >= self._min_volatility:
|
||||||
result = True
|
result = True
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user