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

View File

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