diff --git a/Trading/Exchange/binance/binance_exchange.py b/Trading/Exchange/binance/binance_exchange.py index 415d45550..6e6d509d2 100644 --- a/Trading/Exchange/binance/binance_exchange.py +++ b/Trading/Exchange/binance/binance_exchange.py @@ -161,6 +161,18 @@ def get_additional_connector_config(self): } return config + def is_authenticated_request(self, url: str, method: str, headers: dict, body) -> bool: + signature_identifier = "signature=" + return ( + ( + url + and signature_identifier in url # for GET & DELETE requests + ) or ( + body + and signature_identifier in body # for other requests + ) + ) + async def get_balance(self, **kwargs: dict): if self.exchange_manager.is_future: balance = [] diff --git a/Trading/Exchange/bingx/bingx_exchange.py b/Trading/Exchange/bingx/bingx_exchange.py index 946af2261..ecbd22908 100644 --- a/Trading/Exchange/bingx/bingx_exchange.py +++ b/Trading/Exchange/bingx/bingx_exchange.py @@ -57,6 +57,12 @@ async def get_my_recent_trades(self, symbol=None, since=None, limit=None, **kwar return await super().get_my_recent_trades(symbol=symbol, since=since, limit=limit, **kwargs) return await super().get_closed_orders(symbol=symbol, since=since, limit=limit, **kwargs) + def is_authenticated_request(self, url: str, method: str, headers: dict, body) -> bool: + signature_identifier = "signature=" + return ( + url + and signature_identifier in url + ) class BingxCCXTAdapter(exchanges.CCXTAdapter): diff --git a/Trading/Exchange/coinbase/coinbase_exchange.py b/Trading/Exchange/coinbase/coinbase_exchange.py index ea17848b4..9c41a5c04 100644 --- a/Trading/Exchange/coinbase/coinbase_exchange.py +++ b/Trading/Exchange/coinbase/coinbase_exchange.py @@ -169,7 +169,7 @@ async def get_account_id(self, **kwargs: dict) -> str: self.logger.exception( err, True, f"Error when fetching {self.get_name()} account id: {err} ({err.__class__.__name__}). " - f"This is not normal, endpoint might be deprecated, see" + f"This is not normal, endpoint might be deprecated, see " f"https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-users. " f"Using generated account id instead" ) @@ -264,6 +264,17 @@ def _get_ohlcv_params(self, time_frame, input_limit, **kwargs): kwargs["limit"] = limit return kwargs + def is_authenticated_request(self, url: str, method: str, headers: dict, body) -> bool: + signature_identifier = "CB-ACCESS-SIGN" + oauth_identifier = "Authorization" + return ( + headers + and ( + signature_identifier in headers + or oauth_identifier in headers + ) + ) + def is_market_open_for_order_type(self, symbol: str, order_type: trading_enums.TraderOrderType) -> bool: """ Override if necessary diff --git a/Trading/Exchange/kucoin/kucoin_exchange.py b/Trading/Exchange/kucoin/kucoin_exchange.py index 0fb38cbe4..6111d1e57 100644 --- a/Trading/Exchange/kucoin/kucoin_exchange.py +++ b/Trading/Exchange/kucoin/kucoin_exchange.py @@ -261,6 +261,13 @@ def should_log_on_ddos_exception(self, exception) -> bool: """ return Kucoin.INSTANT_RETRY_ERROR_CODE not in str(exception) + def is_authenticated_request(self, url: str, method: str, headers: dict, body) -> bool: + signature_identifier = "KC-API-SIGN" + return ( + headers + and signature_identifier in headers + ) + def get_order_additional_params(self, order) -> dict: params = {} if self.exchange_manager.is_future: diff --git a/Trading/Exchange/okx/okx_exchange.py b/Trading/Exchange/okx/okx_exchange.py index 27194e590..4c6df8954 100644 --- a/Trading/Exchange/okx/okx_exchange.py +++ b/Trading/Exchange/okx/okx_exchange.py @@ -86,6 +86,13 @@ async def create_market_stop_loss_order(self, symbol, quantity, price, side, cur symbol=symbol, quantity=quantity ) + def is_authenticated_request(self, url: str, method: str, headers: dict, body) -> bool: + signature_identifier = "OK-ACCESS-SIGN" + return ( + headers + and signature_identifier in headers + ) + class Okx(exchanges.RestExchange): DESCRIPTION = ""