Wrong argument in docs for OKex
:param str params['marginMode']: 'cross' or 'isolated'`
should be changed to reflect actual code to:
:param str params['mgnMode']: 'cross' or 'isolated'
https://github.com/ccxt/ccxt/blob/a200ae66b3c7c1cba72284cbbc3cf8ca2a3abf85/python/ccxt/okx.py#L4460
Hello @adradr marginMode is the unified term used by ccxt across all exchanges to describe the margin mode
Hello @adradr
marginModeis the unified term used by ccxt across all exchanges to describe the margin mode
I got that but it was returning with an error for okex (using ccxt==1.92.30 )
BadRequest: okex setLeverage() params["mgnMode"] must be either cross or isolated
>> cex.set_leverage(leverage=1, symbol='ETH/USD:USDC', params={'marginMode': 'isolated'})
File ~/miniforge3/envs/trading-service/lib/python3.9/site-packages/ccxt/okx.py:4436, in okx.set_leverage(self, leverage, symbol, params)
4434 params = self.omit(params, ['mgnMode'])
4435 if (marginMode != 'cross') and (marginMode != 'isolated'):
-> 4436 raise BadRequest(self.id + ' setLeverage() params["mgnMode"] must be either cross or isolated')
4437 request = {
4438 'lever': leverage,
4439 'mgnMode': marginMode,
4440 'instId': market['id'],
4441 }
4442 response = self.privatePostAccountSetLeverage(self.extend(request, params))
BadRequest: okex setLeverage() params["mgnMode"] must be either cross or isolated
>> cex.set_leverage(leverage=1, symbol='ETH/USD:USDC', params={'mgnMode': 'isolated'})
{'code': '0',
'data': [{'instId': 'ETH-USDC-SWAP',
'lever': '1',
'mgnMode': 'isolated',
'posSide': ''}],
'msg': ''}
Hello @adradr what is your ccxt version? I think this issue is fixed on the latest versions of ccxt
@adradr as advised by Carlos above, please update your CCXT version to latest and the issue should be gone. If still any issues, please let us know.
@adradr as advised by Carlos above, please update your CCXT version to latest and the issue should be gone. If still any issues, please let us know.
Thanks for the replies, can confirm its solved in the latest version!