Fix hyperopt exchange name
This commit is contained in:
parent
9ca61389cb
commit
c819d73cb0
@ -19,10 +19,10 @@ from hyperopt.mongoexp import MongoTrials
|
|||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
|
||||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||||
|
from freqtrade import OperationalException
|
||||||
# Monkey patch config
|
# Monkey patch config
|
||||||
from freqtrade import main # noqa; noqa
|
from freqtrade import main # noqa; noqa
|
||||||
from freqtrade import exchange, misc, optimize
|
from freqtrade import exchange, misc, optimize
|
||||||
from freqtrade.exchange import Bittrex
|
|
||||||
from freqtrade.misc import load_config
|
from freqtrade.misc import load_config
|
||||||
from freqtrade.optimize import backtesting
|
from freqtrade.optimize import backtesting
|
||||||
from freqtrade.optimize.backtesting import backtest
|
from freqtrade.optimize.backtesting import backtest
|
||||||
@ -401,7 +401,8 @@ def optimizer(params):
|
|||||||
|
|
||||||
results = backtest({'stake_amount': OPTIMIZE_CONFIG['stake_amount'],
|
results = backtest({'stake_amount': OPTIMIZE_CONFIG['stake_amount'],
|
||||||
'processed': PROCESSED,
|
'processed': PROCESSED,
|
||||||
'stoploss': params['stoploss']})
|
'stoploss': params['stoploss'],
|
||||||
|
'exchange_name': _CONFIG['exchange']['name']})
|
||||||
result_explanation = format_results(results)
|
result_explanation = format_results(results)
|
||||||
|
|
||||||
total_profit = results.profit_percent.sum()
|
total_profit = results.profit_percent.sum()
|
||||||
@ -445,12 +446,10 @@ def format_results(results: DataFrame):
|
|||||||
|
|
||||||
|
|
||||||
def start(args):
|
def start(args):
|
||||||
global TOTAL_TRIES, PROCESSED, TRIALS, _CURRENT_TRIES
|
global TOTAL_TRIES, PROCESSED, TRIALS, _CURRENT_TRIES, _CONFIG
|
||||||
|
|
||||||
TOTAL_TRIES = args.epochs
|
TOTAL_TRIES = args.epochs
|
||||||
|
|
||||||
exchange._API = Bittrex({'key': '', 'secret': ''})
|
|
||||||
|
|
||||||
# Initialize logger
|
# Initialize logger
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=args.loglevel,
|
level=args.loglevel,
|
||||||
@ -458,18 +457,27 @@ def start(args):
|
|||||||
)
|
)
|
||||||
|
|
||||||
logger.info('Using config: %s ...', args.config)
|
logger.info('Using config: %s ...', args.config)
|
||||||
config = load_config(args.config)
|
_CONFIG = load_config(args.config)
|
||||||
pairs = config['exchange']['pair_whitelist']
|
pairs = _CONFIG['exchange']['pair_whitelist']
|
||||||
|
|
||||||
|
exchange_name = _CONFIG['exchange']['name']
|
||||||
|
try:
|
||||||
|
exchange_class = exchange.Exchanges[exchange_name.upper()].value
|
||||||
|
except KeyError:
|
||||||
|
raise OperationalException('Exchange {} is not supported'.format(
|
||||||
|
exchange_name))
|
||||||
|
|
||||||
|
exchange._API = exchange_class({'key': '', 'secret': ''})
|
||||||
|
|
||||||
# If -i/--ticker-interval is use we override the configuration parameter
|
# If -i/--ticker-interval is use we override the configuration parameter
|
||||||
# (that will override the strategy configuration)
|
# (that will override the strategy configuration)
|
||||||
if args.ticker_interval:
|
if args.ticker_interval:
|
||||||
config.update({'ticker_interval': args.ticker_interval})
|
_CONFIG.update({'ticker_interval': args.ticker_interval})
|
||||||
|
|
||||||
# init the strategy to use
|
# init the strategy to use
|
||||||
config.update({'strategy': args.strategy})
|
_CONFIG.update({'strategy': args.strategy})
|
||||||
strategy = Strategy()
|
strategy = Strategy()
|
||||||
strategy.init(config)
|
strategy.init(_CONFIG)
|
||||||
|
|
||||||
timerange = misc.parse_timerange(args.timerange)
|
timerange = misc.parse_timerange(args.timerange)
|
||||||
data = optimize.load_data(args.datadir, pairs=pairs,
|
data = optimize.load_data(args.datadir, pairs=pairs,
|
||||||
|
Loading…
Reference in New Issue
Block a user