introduce experimental variable and fix test naming
This commit is contained in:
parent
8a44dff595
commit
cbfee51f32
@ -172,7 +172,8 @@ class Analyze(object):
|
||||
if the threshold is reached and updates the trade record.
|
||||
:return: True if trade should be sold, False otherwise
|
||||
"""
|
||||
if buy and self.config.get('experimental', {}).get('ignore_roi_if_buy_signal', False):
|
||||
experimental = self.config.get('experimental', {})
|
||||
if buy and experimental.get('ignore_roi_if_buy_signal', False):
|
||||
logger.debug('Buy signal still active - not selling.')
|
||||
return False
|
||||
|
||||
@ -181,13 +182,11 @@ class Analyze(object):
|
||||
logger.debug('Required profit reached. Selling..')
|
||||
return True
|
||||
|
||||
# Experimental: Check if the trade is profitable before selling it (avoid selling at loss)
|
||||
if self.config.get('experimental', {}).get('sell_profit_only', False):
|
||||
if experimental.get('sell_profit_only', False):
|
||||
logger.debug('Checking if trade is profitable..')
|
||||
if trade.calc_profit(rate=rate) <= 0:
|
||||
return False
|
||||
|
||||
if sell and not buy and self.config.get('experimental', {}).get('use_sell_signal', False):
|
||||
if sell and not buy and experimental.get('use_sell_signal', False):
|
||||
logger.debug('Sell signal received. Selling..')
|
||||
return True
|
||||
|
||||
|
@ -423,9 +423,8 @@ with limit `{buy_limit:.8f} ({stake_amount:.6f} \
|
||||
current_rate = self.exchange.get_ticker(trade.pair)['bid']
|
||||
|
||||
(buy, sell) = (False, False)
|
||||
|
||||
if (self.config.get('experimental', {}).get('use_sell_signal')
|
||||
or self.config.get('experimental', {}).get('ignore_roi_if_buy_signal')):
|
||||
experimental = self.config.get('experimental', {})
|
||||
if experimental.get('use_sell_signal') or experimental.get('ignore_roi_if_buy_signal'):
|
||||
(buy, sell) = self.analyze.get_signal(self.exchange,
|
||||
trade.pair, self.analyze.get_ticker_interval())
|
||||
|
||||
|
@ -1335,7 +1335,7 @@ def test_sell_profit_only_disable_loss(default_conf, limit_buy_order, fee, mocke
|
||||
assert freqtrade.handle_trade(trade) is True
|
||||
|
||||
|
||||
def ignore_roi_if_buy_signal(default_conf, limit_buy_order, fee, mocker) -> None:
|
||||
def test_ignore_roi_if_buy_signal(default_conf, limit_buy_order, fee, mocker) -> None:
|
||||
"""
|
||||
Test sell_profit_only feature when enabled and we have a loss
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user