From 4fb9823cfb6e09ed16ca97f40b76b2647abd3c7f Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 19 Jul 2018 19:41:42 +0200 Subject: [PATCH] fix rebase problem --- freqtrade/freqtradebot.py | 4 ++-- freqtrade/optimize/backtesting.py | 2 +- freqtrade/strategy/interface.py | 3 +-- freqtrade/tests/test_freqtradebot.py | 7 +++---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 566b0670f..f6bdcdf52 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -393,8 +393,8 @@ class FreqtradeBot(object): open_date=datetime.utcnow(), exchange=self.exchange.id, open_order_id=order_id, - strategy=self.analyze.get_strategy_name(), - ticker_interval=constants.TICKER_INTERVAL_MINUTES[self.analyze.get_ticker_interval()] + strategy=self.strategy.get_strategy_name(), + ticker_interval=constants.TICKER_INTERVAL_MINUTES[self.config['ticker_interval']] ) Trade.session.add(trade) Trade.session.flush() diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 73899f9a2..db8e923b2 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -164,7 +164,7 @@ class Backtesting(object): buy_signal = sell_row.buy sell = self.strategy.should_sell(trade, sell_row.open, sell_row.date, buy_signal, - sell_row.sell) + sell_row.sell) if sell.sell_flag: return BacktestResult(pair=pair, diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 7b8d91010..9120d3e04 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -88,13 +88,12 @@ class IStrategy(ABC): :param dataframe: DataFrame :return: DataFrame with sell column """ - return self.strategy.populate_sell_trend(dataframe=dataframe) def get_strategy_name(self) -> str: """ Returns strategy class name """ - return self.strategy.__class__.__name__ + return self.__class__.__name__ def analyze_ticker(self, ticker_history: List[Dict]) -> DataFrame: """ diff --git a/freqtrade/tests/test_freqtradebot.py b/freqtrade/tests/test_freqtradebot.py index 65cd99689..223e7318d 100644 --- a/freqtrade/tests/test_freqtradebot.py +++ b/freqtrade/tests/test_freqtradebot.py @@ -16,11 +16,11 @@ import requests from freqtrade import (DependencyException, OperationalException, TemporaryError, constants) -from freqtrade.strategy.interface.IStrategy import SellType, SellCheckTuple from freqtrade.freqtradebot import FreqtradeBot from freqtrade.persistence import Trade from freqtrade.rpc import RPCMessageType from freqtrade.state import State +from freqtrade.strategy.interface import SellType, SellCheckTuple from freqtrade.tests.conftest import log_has, patch_coinmarketcap, patch_exchange @@ -1625,8 +1625,6 @@ def test_sell_profit_only_enable_loss(default_conf, limit_buy_order, fee, market """ patch_RPCManager(mocker) patch_coinmarketcap(mocker) - mocker.patch('freqtrade.freqtradebot.strategy.interface.stop_loss_reached', - return_value=SellCheckTuple(sell_flag=False, sell_type=SellType.NONE)) mocker.patch.multiple( 'freqtrade.exchange.Exchange', validate_pairs=MagicMock(), @@ -1647,7 +1645,8 @@ def test_sell_profit_only_enable_loss(default_conf, limit_buy_order, fee, market freqtrade = FreqtradeBot(conf) patch_get_signal(freqtrade) freqtrade.strategy.stop_loss_reached = \ - lambda current_rate, trade, current_time, current_profit: False + lambda current_rate, trade, current_time, current_profit: SellCheckTuple( + sell_flag=False, sell_type=SellType.NONE) freqtrade.create_trade() trade = Trade.query.first()