From 85af68d8075ea4df19ec6ea4e653da13d81228ef Mon Sep 17 00:00:00 2001 From: Matthias Voppichler Date: Sat, 24 Mar 2018 19:45:23 +0100 Subject: [PATCH] ccxt - make backtesting work --- freqtrade/optimize/__init__.py | 4 ++-- freqtrade/optimize/backtesting.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/freqtrade/optimize/__init__.py b/freqtrade/optimize/__init__.py index a26744691..61694d884 100644 --- a/freqtrade/optimize/__init__.py +++ b/freqtrade/optimize/__init__.py @@ -35,7 +35,7 @@ def load_tickerdata_file( """ path = make_testdata_path(datadir) file = os.path.join(path, '{pair}-{ticker_interval}.json'.format( - pair=pair, + pair=pair.replace('/', '_'), ticker_interval=ticker_interval, )) gzipfile = file + '.gz' @@ -126,7 +126,7 @@ def download_backtesting_testdata(datadir: str, pair: str, interval: int = 5) -> interval ) - filepair = pair.replace("-", "_") + filepair = pair.replace("/", "_") filename = os.path.join(path, '{pair}-{interval}.json'.format( pair=filepair, interval=interval, diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 6202edead..2b583da3c 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -53,7 +53,10 @@ class Backtesting(object): self.tickerdata_to_dataframe = self.analyze.tickerdata_to_dataframe self.populate_buy_trend = self.analyze.populate_buy_trend self.populate_sell_trend = self.analyze.populate_sell_trend - exchange.init({'key': '', 'secret': ''}) + # Reest keys for backtesting + self.config['exchange']['key'] = '' + self.config['exchange']['secret'] = '' + exchange.init(self.config) @staticmethod def get_timeframe(data: Dict[str, DataFrame]) -> Tuple[arrow.Arrow, arrow.Arrow]: