fix flake8 and mypy
This commit is contained in:
parent
256588af48
commit
729ccdb2d7
@ -36,7 +36,7 @@ AVAILABLE_PAIRLISTS = ['StaticPairList', 'VolumePairList', 'ProducerPairList',
|
||||
'PrecisionFilter', 'PriceFilter', 'RangeStabilityFilter',
|
||||
'ShuffleFilter', 'SpreadFilter', 'VolatilityFilter']
|
||||
AVAILABLE_PROTECTIONS = ['CooldownPeriod', 'LowProfitPairs', 'MaxDrawdown',
|
||||
'StoplossGuard', 'ProfitLimit']
|
||||
'StoplossGuard', 'ProfitLimit']
|
||||
AVAILABLE_DATAHANDLERS_TRADES = ['json', 'jsongz', 'hdf5']
|
||||
AVAILABLE_DATAHANDLERS = AVAILABLE_DATAHANDLERS_TRADES + ['feather', 'parquet']
|
||||
BACKTEST_BREAKDOWNS = ['day', 'week', 'month']
|
||||
|
@ -9,6 +9,7 @@ from freqtrade.plugins.protections import IProtection, ProtectionReturn
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ProfitLimit(IProtection):
|
||||
|
||||
has_global_stop: bool = True
|
||||
@ -47,8 +48,8 @@ class ProfitLimit(IProtection):
|
||||
# Not enough trades in the relevant period
|
||||
return None
|
||||
|
||||
profit_sum = trades['profit_abs'].sum()
|
||||
stake_sum = trades['stake_amount'].sum()
|
||||
profit_sum = sum(trade.close_profit_abs for trade in trades if trade.close_profit_abs)
|
||||
stake_sum = sum(trade.stake_amount for trade in trades)
|
||||
profit_ratio = profit_sum / stake_sum
|
||||
|
||||
if profit_ratio >= self._required_profit:
|
||||
|
Loading…
Reference in New Issue
Block a user