ccxt icon indicating copy to clipboard operation
ccxt copied to clipboard

Wrong argument in docs for OKex

Open adradr opened this issue 3 years ago • 3 comments

: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

adradr avatar Oct 13 '22 12:10 adradr

Hello @adradr marginMode is the unified term used by ccxt across all exchanges to describe the margin mode

carlosmiei avatar Oct 13 '22 13:10 carlosmiei

Hello @adradr marginMode is 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': ''}

adradr avatar Oct 13 '22 13:10 adradr

Hello @adradr what is your ccxt version? I think this issue is fixed on the latest versions of ccxt

carlosmiei avatar Oct 13 '22 13:10 carlosmiei

@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.

ttodua avatar Oct 24 '22 08:10 ttodua

@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!

adradr avatar Oct 24 '22 08:10 adradr