make Strategy store roi and stoploss values as numbers to avoid later casting
This commit is contained in:
@@ -296,14 +296,13 @@ def min_roi_reached(trade: Trade, current_rate: float, current_time: datetime) -
|
||||
strategy = Strategy()
|
||||
|
||||
current_profit = trade.calc_profit_percent(current_rate)
|
||||
if strategy.stoploss is not None and current_profit < float(strategy.stoploss):
|
||||
if strategy.stoploss is not None and current_profit < strategy.stoploss:
|
||||
logger.debug('Stop loss hit.')
|
||||
return True
|
||||
|
||||
# Check if time matches and current rate is above threshold
|
||||
time_diff = (current_time.timestamp() - trade.open_date.timestamp()) / 60
|
||||
for duration_string, threshold in strategy.minimal_roi.items():
|
||||
duration = float(duration_string)
|
||||
for duration, threshold in strategy.minimal_roi.items():
|
||||
if time_diff < duration:
|
||||
return False
|
||||
if time_diff > duration and current_profit > threshold:
|
||||
|
Reference in New Issue
Block a user