exchange cleanup

This commit is contained in:
hroff-1902 2019-03-19 20:52:35 +03:00
commit 580ada8c4f

View File

@ -66,7 +66,7 @@ def retrier(f):
class Exchange(object):
_conf: Dict = {}
_config: Dict = {}
_params: Dict = {}
# Dict to specify which options each exchange implements
@ -82,7 +82,7 @@ class Exchange(object):
it does basic validation whether the specified exchange and pairs are valid.
:return: None
"""
self._conf.update(config)
self._config.update(config)
self._cached_ticker: Dict[str, Any] = {}
@ -239,7 +239,7 @@ class Exchange(object):
logger.warning('Unable to validate pairs (assuming they are correct).')
# return
stake_cur = self._conf['stake_currency']
stake_cur = self._config['stake_currency']
for pair in pairs:
# Note: ccxt has BaseCurrency/QuoteCurrency format for pairs
# TODO: add a support for having coins in BTC/USDT format
@ -374,7 +374,7 @@ class Exchange(object):
def buy(self, pair: str, ordertype: str, amount: float,
rate: float, time_in_force) -> Dict:
if self._conf['dry_run']:
if self._config['dry_run']:
dry_order = self.dry_run_order(pair, ordertype, "buy", amount, rate)
return dry_order
@ -387,7 +387,7 @@ class Exchange(object):
def sell(self, pair: str, ordertype: str, amount: float,
rate: float, time_in_force='gtc') -> Dict:
if self._conf['dry_run']:
if self._config['dry_run']:
dry_order = self.dry_run_order(pair, ordertype, "sell", amount, rate)
return dry_order
@ -412,7 +412,7 @@ class Exchange(object):
raise OperationalException(
'In stoploss limit order, stop price should be more than limit price')
if self._conf['dry_run']:
if self._config['dry_run']:
dry_order = self.dry_run_order(
pair, ordertype, "sell", amount, stop_price)
return dry_order
@ -427,8 +427,8 @@ class Exchange(object):
@retrier
def get_balance(self, currency: str) -> float:
if self._conf['dry_run']:
return 999.9
if self._config['dry_run']:
return constants.DRY_RUN_WALLET
# ccxt exception is already handled by get_balances
balances = self.get_balances()
@ -440,7 +440,7 @@ class Exchange(object):
@retrier
def get_balances(self) -> dict:
if self._conf['dry_run']:
if self._config['dry_run']:
return {}
try:
@ -611,7 +611,7 @@ class Exchange(object):
@retrier
def cancel_order(self, order_id: str, pair: str) -> None:
if self._conf['dry_run']:
if self._config['dry_run']:
return
try:
@ -627,7 +627,7 @@ class Exchange(object):
@retrier
def get_order(self, order_id: str, pair: str) -> Dict:
if self._conf['dry_run']:
if self._config['dry_run']:
order = self._dry_run_open_orders[order_id]
return order
try:
@ -664,7 +664,7 @@ class Exchange(object):
@retrier
def get_trades_for_order(self, order_id: str, pair: str, since: datetime) -> List:
if self._conf['dry_run']:
if self._config['dry_run']:
return []
if not self.exchange_has('fetchMyTrades'):
return []