Fix a bug when compare sell_profit_offset

It should be comparing the ratio instead of absolut profit.

Also updated the comment.
This commit is contained in:
Pan Long 2021-01-31 12:14:09 +08:00 committed by GitHub
parent 16dad8b6d4
commit 4cc93151c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 trade.calc_profit_ratio(rate=rate) <= 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)