From 775c2a1a9ac5eb4a6ed0dfd4bb3da2cccc52caf0 Mon Sep 17 00:00:00 2001 From: gcarq Date: Thu, 18 May 2017 18:53:22 +0200 Subject: [PATCH] respect stake_currency conf --- main.py | 4 ++-- utils.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 165ca7467..b9318938d 100755 --- a/main.py +++ b/main.py @@ -185,8 +185,8 @@ def create_trade(stake_amount: float, exchange): logger.info('Creating new trade with stake_amount: {} ...'.format(stake_amount)) whitelist = conf[exchange.name.lower()]['pair_whitelist'] # Check if btc_amount is fulfilled - if api_wrapper.get_balance('BTC') < stake_amount: - raise ValueError('BTC amount is not fulfilled') + if api_wrapper.get_balance(conf['stake_currency']) < stake_amount: + raise ValueError('stake amount is not fulfilled (currency={}'.format(conf['stake_currency'])) # Remove currently opened and latest pairs from whitelist latest_trade = Trade.query.filter(Trade.is_open.is_(False)).order_by(Trade.id.desc()).first() diff --git a/utils.py b/utils.py index 5032d417c..85b112339 100644 --- a/utils.py +++ b/utils.py @@ -30,6 +30,8 @@ def validate_conf(conf): """ if not isinstance(conf.get('max_open_trades'), int): raise ValueError('max_open_trades must be a int') + if not isinstance(conf.get('stake_currency'), str): + raise ValueError('stake_currency must be a str') if not isinstance(conf.get('stake_amount'), float): raise ValueError('stake_amount must be a float') if not isinstance(conf.get('dry_run'), bool):