set margin mode to 'cross' or 'isolated' https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-margin-type :param str marginMode: 'cross' or 'isolated' :param str symbol: unified market symbol :param dict [params]: extra parameters specific to the
(self, marginMode: str, symbol: Str = None, params={})
| 2998 | return self.v2PrivateAccountGroupPostFuturesLeverage(self.extend(request, params)) |
| 2999 | |
| 3000 | def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}): |
| 3001 | """ |
| 3002 | set margin mode to 'cross' or 'isolated' |
| 3003 | |
| 3004 | https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-margin-type |
| 3005 | |
| 3006 | :param str marginMode: 'cross' or 'isolated' |
| 3007 | :param str symbol: unified market symbol |
| 3008 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 3009 | :returns dict: response from the exchange |
| 3010 | """ |
| 3011 | if symbol is None: |
| 3012 | raise ArgumentsRequired(self.id + ' setMarginMode() requires a symbol argument') |
| 3013 | marginMode = marginMode.lower() |
| 3014 | if marginMode == 'cross': |
| 3015 | marginMode = 'crossed' |
| 3016 | if marginMode != 'isolated' and marginMode != 'crossed': |
| 3017 | raise BadRequest(self.id + ' setMarginMode() marginMode argument should be isolated or cross') |
| 3018 | self.load_markets() |
| 3019 | self.load_accounts() |
| 3020 | market = self.market(symbol) |
| 3021 | account = self.safe_dict(self.accounts, 0, {}) |
| 3022 | accountGroup = self.safe_string(account, 'id') |
| 3023 | request = { |
| 3024 | 'account-group': accountGroup, |
| 3025 | 'symbol': market['id'], |
| 3026 | 'marginType': marginMode, |
| 3027 | } |
| 3028 | if not market['swap']: |
| 3029 | raise BadSymbol(self.id + ' setMarginMode() supports swap contracts only') |
| 3030 | return self.v2PrivateAccountGroupPostFuturesMarginType(self.extend(request, params)) |
| 3031 | |
| 3032 | def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers: |
| 3033 | """ |
nothing calls this directly
no test coverage detected