Remove hardcoded exchange while backtesting
This commit is contained in:
parent
685ee42fbc
commit
251c86197a
@ -3,7 +3,6 @@
|
||||
import logging
|
||||
from typing import Dict, Tuple
|
||||
|
||||
import ccxt
|
||||
import arrow
|
||||
from pandas import DataFrame, Series
|
||||
from tabulate import tabulate
|
||||
@ -114,7 +113,7 @@ def backtest(args) -> DataFrame:
|
||||
records = []
|
||||
trades = []
|
||||
trade_count_lock: dict = {}
|
||||
exchange._API = ccxt.binance()
|
||||
|
||||
for pair, pair_data in processed.items():
|
||||
pair_data['buy'], pair_data['sell'] = 0, 0
|
||||
ticker = populate_sell_trend(populate_buy_trend(pair_data))
|
||||
@ -165,13 +164,13 @@ def start(args):
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
)
|
||||
|
||||
exchange._API = ccxt.binance()
|
||||
|
||||
logger.info('Using config: %s ...', args.config)
|
||||
config = misc.load_config(args.config)
|
||||
ticker_interval = config.get('ticker_interval', args.ticker_interval)
|
||||
logger.info('Using ticker_interval: %s ...', ticker_interval)
|
||||
|
||||
exchange.init(config)
|
||||
|
||||
data = {}
|
||||
pairs = config['exchange']['pair_whitelist']
|
||||
if args.live:
|
||||
|
@ -162,6 +162,8 @@ def test_backtest_start(default_conf, mocker, caplog):
|
||||
mocker.patch('freqtrade.misc.load_config', new=lambda s: default_conf)
|
||||
mocker.patch.multiple('freqtrade.optimize',
|
||||
load_data=mocked_load_data)
|
||||
# patch validate_pairs to do nothing since UNITTEST/BTC pair doesn't exist
|
||||
mocker.patch('freqtrade.exchange.validate_pairs', new=lambda s: None)
|
||||
args = MagicMock()
|
||||
args.ticker_interval = '1m'
|
||||
args.level = 10
|
||||
|
Loading…
Reference in New Issue
Block a user