Allow the use of sandbox APIs for testing without risking money.

This commit is contained in:
creslinux 2018-07-27 08:27:44 +00:00
parent a226d8920a
commit 7180fa0ee8
2 changed files with 6 additions and 4 deletions

View File

@ -124,6 +124,7 @@ CONF_SCHEMA = {
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'name': {'type': 'string'}, 'name': {'type': 'string'},
'sandbox': {'type': 'boolean'},
'key': {'type': 'string'}, 'key': {'type': 'string'},
'secret': {'type': 'string'}, 'secret': {'type': 'string'},
'pair_whitelist': { 'pair_whitelist': {

View File

@ -70,10 +70,6 @@ class Exchange(object):
# Check if all pairs are available # Check if all pairs are available
self.validate_pairs(config['exchange']['pair_whitelist']) self.validate_pairs(config['exchange']['pair_whitelist'])
if config.get('ticker_interval'):
# Check if timeframe is available
self.validate_timeframes(config['ticker_interval'])
def _init_ccxt(self, exchange_config: dict) -> ccxt.Exchange: def _init_ccxt(self, exchange_config: dict) -> ccxt.Exchange:
""" """
Initialize ccxt with given config and return valid Initialize ccxt with given config and return valid
@ -95,6 +91,11 @@ class Exchange(object):
except (KeyError, AttributeError): except (KeyError, AttributeError):
raise OperationalException(f'Exchange {name} is not supported') raise OperationalException(f'Exchange {name} is not supported')
# check if config requests sanbox, if so use ['test'] from url
if (exchange_config.get('sandbox')):
api.urls['api'] = api.urls['test'];
#exchange.urls['api'] = exchange.urls['test'];
return api return api
@property @property