set the level of leverage for a market https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-contract-leverage :param float leverage: the rate of leverage :param str symbol: unified market symbol :param dict [params]: extra parameters specific to t
(self, leverage: int, symbol: Str = None, params={})
| 2969 | return self.modify_margin_helper(symbol, amount, 'add', params) |
| 2970 | |
| 2971 | def set_leverage(self, leverage: int, symbol: Str = None, params={}): |
| 2972 | """ |
| 2973 | set the level of leverage for a market |
| 2974 | |
| 2975 | https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-contract-leverage |
| 2976 | |
| 2977 | :param float leverage: the rate of leverage |
| 2978 | :param str symbol: unified market symbol |
| 2979 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 2980 | :returns dict: response from the exchange |
| 2981 | """ |
| 2982 | if symbol is None: |
| 2983 | raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument') |
| 2984 | if (leverage < 1) or (leverage > 100): |
| 2985 | raise BadRequest(self.id + ' leverage should be between 1 and 100') |
| 2986 | self.load_markets() |
| 2987 | self.load_accounts() |
| 2988 | market = self.market(symbol) |
| 2989 | if not market['swap']: |
| 2990 | raise BadSymbol(self.id + ' setLeverage() supports swap contracts only') |
| 2991 | account = self.safe_dict(self.accounts, 0, {}) |
| 2992 | accountGroup = self.safe_string(account, 'id') |
| 2993 | request = { |
| 2994 | 'account-group': accountGroup, |
| 2995 | 'symbol': market['id'], |
| 2996 | 'leverage': leverage, |
| 2997 | } |
| 2998 | return self.v2PrivateAccountGroupPostFuturesLeverage(self.extend(request, params)) |
| 2999 | |
| 3000 | def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}): |
| 3001 | """ |
nothing calls this directly
no test coverage detected