changes to base and subclass
This commit is contained in:
@@ -67,6 +67,7 @@ def retrier(f):
|
||||
class Exchange(object):
|
||||
|
||||
_conf: Dict = {}
|
||||
_params: Dict = {}
|
||||
|
||||
def __init__(self, config: dict) -> None:
|
||||
"""
|
||||
@@ -304,11 +305,12 @@ class Exchange(object):
|
||||
amount = self.symbol_amount_prec(pair, amount)
|
||||
rate = self.symbol_price_prec(pair, rate) if ordertype != 'market' else None
|
||||
|
||||
if time_in_force == 'gtc':
|
||||
return self._api.create_order(pair, ordertype, 'buy', amount, rate)
|
||||
else:
|
||||
return self._api.create_order(pair, ordertype, 'buy',
|
||||
amount, rate, {'timeInForce': time_in_force})
|
||||
params = self._params.copy()
|
||||
if time_in_force != 'gtc':
|
||||
params.update({'timeInForce': time_in_force})
|
||||
|
||||
return self._api.create_order(pair, ordertype, 'buy',
|
||||
amount, rate, params)
|
||||
|
||||
except ccxt.InsufficientFunds as e:
|
||||
raise DependencyException(
|
||||
@@ -347,11 +349,12 @@ class Exchange(object):
|
||||
amount = self.symbol_amount_prec(pair, amount)
|
||||
rate = self.symbol_price_prec(pair, rate) if ordertype != 'market' else None
|
||||
|
||||
if time_in_force == 'gtc':
|
||||
return self._api.create_order(pair, ordertype, 'sell', amount, rate)
|
||||
else:
|
||||
return self._api.create_order(pair, ordertype, 'sell',
|
||||
amount, rate, {'timeInForce': time_in_force})
|
||||
params = self._params.copy()
|
||||
if time_in_force != 'gtc':
|
||||
params.update({'timeInForce': time_in_force})
|
||||
|
||||
return self._api.create_order(pair, ordertype, 'sell',
|
||||
amount, rate, params)
|
||||
|
||||
except ccxt.InsufficientFunds as e:
|
||||
raise DependencyException(
|
||||
@@ -404,8 +407,11 @@ class Exchange(object):
|
||||
|
||||
try:
|
||||
|
||||
params = self._params.copy()
|
||||
params.update({'stopPrice': stop_price})
|
||||
|
||||
order = self._api.create_order(pair, 'stop_loss_limit', 'sell',
|
||||
amount, rate, {'stopPrice': stop_price})
|
||||
amount, rate, params)
|
||||
logger.info('stoploss limit order added for %s. '
|
||||
'stop price: %s. limit: %s' % (pair, stop_price, rate))
|
||||
return order
|
||||
|
||||
Reference in New Issue
Block a user