Check if symbol is not None

This commit is contained in:
Matthias
2022-03-25 18:09:18 +01:00
parent d3ea14de68
commit 46f4227329
2 changed files with 28 additions and 2 deletions

View File

@@ -402,7 +402,7 @@ class Exchange:
return trades
def _order_contracts_to_amount(self, order: Dict) -> Dict:
if 'symbol' in order:
if 'symbol' in order and order['symbol'] is not None:
contract_size = self._get_contract_size(order['symbol'])
if contract_size != 1:
for prop in ['amount', 'cost', 'filled', 'remaining']:
@@ -1108,10 +1108,10 @@ class Exchange:
self._lev_prep(pair, leverage, side)
order = self._api.create_order(symbol=pair, type=ordertype, side=side,
amount=amount, price=rate, params=params)
self._log_exchange_response('create_stoploss_order', order)
order = self._order_contracts_to_amount(order)
logger.info(f"stoploss {user_order_type} order added for {pair}. "
f"stop price: {stop_price}. limit: {rate}")
self._log_exchange_response('create_stoploss_order', order)
return order
except ccxt.InsufficientFunds as e:
raise InsufficientFundsError(