Merge pull request #4282 from pan-long/patch-1

Fix a bug when compare sell_profit_offset
This commit is contained in:
Matthias 2021-02-02 08:22:38 +01:00 committed by GitHub
commit fa8156b321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -530,8 +530,8 @@ class IStrategy(ABC):
current_time=date)) current_time=date))
if (ask_strategy.get('sell_profit_only', False) if (ask_strategy.get('sell_profit_only', False)
and trade.calc_profit(rate=rate) <= ask_strategy.get('sell_profit_offset', 0)): and current_profit <= ask_strategy.get('sell_profit_offset', 0)):
# Negative profits and sell_profit_only - ignore sell signal # sell_profit_only and profit doesn't reach the offset - ignore sell signal
sell_signal = False sell_signal = False
else: else:
sell_signal = sell and not buy and ask_strategy.get('use_sell_signal', True) sell_signal = sell and not buy and ask_strategy.get('use_sell_signal', True)

View File

@ -3159,9 +3159,9 @@ def test_sell_profit_only_enable_profit(default_conf, limit_buy_order, limit_buy
mocker.patch.multiple( mocker.patch.multiple(
'freqtrade.exchange.Exchange', 'freqtrade.exchange.Exchange',
fetch_ticker=MagicMock(return_value={ fetch_ticker=MagicMock(return_value={
'bid': 0.00002172, 'bid': 0.00001172,
'ask': 0.00002173, 'ask': 0.00001173,
'last': 0.00002172 'last': 0.00001172
}), }),
buy=MagicMock(return_value=limit_buy_order_open), buy=MagicMock(return_value=limit_buy_order_open),
get_fee=fee, get_fee=fee,