Merge branch 'develop' into feat/freqai

This commit is contained in:
Matthias
2022-07-28 06:36:38 +02:00
12 changed files with 25 additions and 194 deletions

View File

@@ -1264,7 +1264,7 @@ class Exchange:
return False
required = ('fee', 'status', 'amount')
return all(k in corder for k in required)
return all(corder.get(k, None) is not None for k in required)
def cancel_order_with_result(self, order_id: str, pair: str, amount: float) -> Dict:
"""

View File

@@ -23,13 +23,14 @@ class StoplossGuard(IProtection):
self._trade_limit = protection_config.get('trade_limit', 10)
self._disable_global_stop = protection_config.get('only_per_pair', False)
self._only_per_side = protection_config.get('only_per_side', False)
self._profit_limit = protection_config.get('required_profit', 0.0)
def short_desc(self) -> str:
"""
Short method description - used for startup-messages
"""
return (f"{self.name} - Frequent Stoploss Guard, {self._trade_limit} stoplosses "
f"within {self.lookback_period_str}.")
f"with profit < {self._profit_limit:.2%} within {self.lookback_period_str}.")
def _reason(self) -> str:
"""
@@ -49,7 +50,7 @@ class StoplossGuard(IProtection):
trades = [trade for trade in trades1 if (str(trade.exit_reason) in (
ExitType.TRAILING_STOP_LOSS.value, ExitType.STOP_LOSS.value,
ExitType.STOPLOSS_ON_EXCHANGE.value)
and trade.close_profit and trade.close_profit < 0)]
and trade.close_profit and trade.close_profit < self._profit_limit)]
if self._only_per_side:
# Long or short trades only