Fix some more default argument usage in exchange classes

This commit is contained in:
Matthias 2024-04-20 09:24:51 +02:00
parent 31f6030c67
commit a078088ea3
3 changed files with 9 additions and 4 deletions

View File

@ -1350,7 +1350,7 @@ class Exchange:
and order.get('filled') == 0.0)
@retrier
def cancel_order(self, order_id: str, pair: str, params: Dict = {}) -> Dict:
def cancel_order(self, order_id: str, pair: str, params: Optional[Dict] = None) -> Dict:
if self._config['dry_run']:
try:
order = self.fetch_dry_run_order(order_id)
@ -1360,6 +1360,8 @@ class Exchange:
except InvalidOrderException:
return {}
if params is None:
params = {}
try:
order = self._api.cancel_order(order_id, pair, params=params)
self._log_exchange_response('cancel_order', order)
@ -1376,7 +1378,8 @@ class Exchange:
except ccxt.BaseError as e:
raise OperationalException(e) from e
def cancel_stoploss_order(self, order_id: str, pair: str, params: Dict = {}) -> Dict:
def cancel_stoploss_order(
self, order_id: str, pair: str, params: Optional[Dict] = None) -> Dict:
return self.cancel_order(order_id, pair, params)
def is_cancel_order_result_suitable(self, corder) -> bool:

View File

@ -119,7 +119,8 @@ class Gate(Exchange):
return order1
return order
def cancel_stoploss_order(self, order_id: str, pair: str, params: Dict = {}) -> Dict:
def cancel_stoploss_order(
self, order_id: str, pair: str, params: Optional[Dict] = None) -> Dict:
return self.cancel_order(
order_id=order_id,
pair=pair,

View File

@ -232,7 +232,8 @@ class Okx(Exchange):
return safe_value_fallback2(order, order, 'id_stop', 'id')
return order['id']
def cancel_stoploss_order(self, order_id: str, pair: str, params: Dict = {}) -> Dict:
def cancel_stoploss_order(
self, order_id: str, pair: str, params: Optional[Dict] = None) -> Dict:
params1 = {'stop': True}
# 'ordType': 'conditional'
#