diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index a2944c784..06f83f4df 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -54,8 +54,8 @@ class Exchange: # Parameters to add directly to buy/sell calls (like agreeing to trading agreement) _params: Dict = {} - # Additional headers - added to the ccxt object - _headers: Dict = {} + # Additional parameters - added to the ccxt object + _ccxt_params: Dict = {} # Dict to specify which options each exchange implements # This defines defaults, which can be selectively overridden by subclasses using _ft_has @@ -242,9 +242,9 @@ class Exchange: } if ccxt_kwargs: logger.info('Applying additional ccxt config: %s', ccxt_kwargs) - if self._headers: - # Inject static headers after the above output to not confuse users. - ccxt_kwargs = deep_merge_dicts({'headers': self._headers}, ccxt_kwargs) + if self._ccxt_params: + # Inject static options after the above output to not confuse users. + ccxt_kwargs = deep_merge_dicts(self._ccxt_params, ccxt_kwargs) if ccxt_kwargs: ex_config.update(ccxt_kwargs) try: diff --git a/freqtrade/exchange/okx.py b/freqtrade/exchange/okx.py index 540e76fca..80373e071 100644 --- a/freqtrade/exchange/okx.py +++ b/freqtrade/exchange/okx.py @@ -39,6 +39,8 @@ class Okx(Exchange): net_only = True + _ccxt_params: Dict = {'options': {'brokerId': 'ffb5405ad327SUDE'}} + def ohlcv_candle_limit( self, timeframe: str, candle_type: CandleType, since_ms: Optional[int] = None) -> int: """ diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index be8d4b2cf..7e61f76cd 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -181,11 +181,11 @@ def test_init_ccxt_kwargs(default_conf, mocker, caplog): assert log_has("Applying additional ccxt config: {'TestKWARG': 11, 'TestKWARG44': 11}", caplog) assert log_has(asynclogmsg, caplog) # Test additional headers case - Exchange._headers = {'hello': 'world'} + Exchange._ccxt_params = {'hello': 'world'} ex = Exchange(conf) assert log_has("Applying additional ccxt config: {'TestKWARG': 11, 'TestKWARG44': 11}", caplog) - assert ex._api.headers == {'hello': 'world'} + assert ex._api.hello == 'world' assert ex._ccxt_config == {} Exchange._headers = {}