From a963f1820c6a54fbc44dfc071e47f11d842c3da6 Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Thu, 16 Nov 2017 07:49:06 +0200 Subject: [PATCH] rename should_sell to min_roi_reached --- freqtrade/main.py | 6 +++--- freqtrade/tests/test_backtesting.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/freqtrade/main.py b/freqtrade/main.py index b2789ca9f..316e0c960 100755 --- a/freqtrade/main.py +++ b/freqtrade/main.py @@ -153,9 +153,9 @@ def execute_sell(trade: Trade, limit: float) -> None: telegram.send_msg(message) -def should_sell(trade: Trade, current_rate: float, current_time: datetime) -> bool: +def min_roi_reached(trade: Trade, current_rate: float, current_time: datetime) -> bool: """ - Based an earlier trade and current price and configuration, decides whether bot should sell + Based an earlier trade and current price and ROI configuration, decides whether bot should sell :return True if bot should sell at current rate """ current_profit = trade.calc_profit(current_rate) @@ -183,7 +183,7 @@ def handle_trade(trade: Trade) -> bool: logger.debug('Handling %s ...', trade) current_rate = exchange.get_ticker(trade.pair)['bid'] - if should_sell(trade, current_rate, datetime.utcnow()) or get_signal(trade.pair, SignalType.SELL): + if min_roi_reached(trade, current_rate, datetime.utcnow()) or get_signal(trade.pair, SignalType.SELL): execute_sell(trade, current_rate) return True return False diff --git a/freqtrade/tests/test_backtesting.py b/freqtrade/tests/test_backtesting.py index 7edce3df3..6a8ecacb0 100644 --- a/freqtrade/tests/test_backtesting.py +++ b/freqtrade/tests/test_backtesting.py @@ -9,7 +9,7 @@ from pandas import DataFrame from freqtrade import exchange from freqtrade.analyze import analyze_ticker from freqtrade.exchange import Bittrex -from freqtrade.main import should_sell +from freqtrade.main import min_roi_reached from freqtrade.persistence import Trade logging.disable(logging.DEBUG) # disable debug logs that slow backtesting a lot @@ -44,7 +44,7 @@ def backtest(backtest_conf, backdata, mocker): ) # calculate win/lose forwards from buy point for row2 in ticker[row.Index:].itertuples(index=True): - if should_sell(trade, row2.close, row2.date) or row2.sell == 1: + if min_roi_reached(trade, row2.close, row2.date) or row2.sell == 1: current_profit = trade.calc_profit(row2.close) trades.append((pair, current_profit, row2.Index - row.Index))