diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 6e04862a4..ddcbe4af6 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -12,7 +12,7 @@ from copy import deepcopy from datetime import datetime, timedelta, timezone from math import floor, isnan from threading import Lock -from typing import Any, Literal, Optional, Union +from typing import Any, Literal, Optional, TypeGuard, Union import ccxt import ccxt.pro as ccxt_pro @@ -1586,7 +1586,7 @@ class Exchange: ) -> dict: return self.cancel_order(order_id, pair, params) - def is_cancel_order_result_suitable(self, corder) -> bool: + def is_cancel_order_result_suitable(self, corder) -> TypeGuard[CcxtOrder]: if not isinstance(corder, dict): return False @@ -2207,7 +2207,7 @@ class Exchange: return round((fee_cost * fee_to_quote_rate) / cost, 8) def extract_cost_curr_rate( - self, fee: dict, symbol: str, cost: float, amount: float + self, fee: dict[str, Any], symbol: str, cost: float, amount: float ) -> tuple[float, str, Optional[float]]: """ Extract tuple of cost, currency, rate. diff --git a/freqtrade/exchange/exchange_types.py b/freqtrade/exchange/exchange_types.py index d606bf69f..35d0f24ad 100644 --- a/freqtrade/exchange/exchange_types.py +++ b/freqtrade/exchange/exchange_types.py @@ -11,7 +11,7 @@ class FtHas(TypedDict, total=False): # Stoploss on exchange stoploss_on_exchange: bool stop_price_param: str - stop_price_prop: str + stop_price_prop: Literal["stopPrice", "stopLossPrice"] stop_price_type_field: str stop_price_type_value_mapping: dict stoploss_order_types: dict[str, str]