(self, symbol: str, amount, type, params={})
| 2898 | return self.parse_funding_rates(contracts, symbols) |
| 2899 | |
| 2900 | def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification: |
| 2901 | self.load_markets() |
| 2902 | self.load_accounts() |
| 2903 | market = self.market(symbol) |
| 2904 | account = self.safe_dict(self.accounts, 0, {}) |
| 2905 | accountGroup = self.safe_string(account, 'id') |
| 2906 | amount = self.amount_to_precision(symbol, amount) |
| 2907 | request = { |
| 2908 | 'account-group': accountGroup, |
| 2909 | 'symbol': market['id'], |
| 2910 | 'amount': amount, # positive value for adding margin, negative for reducing |
| 2911 | } |
| 2912 | response = self.v2PrivateAccountGroupPostFuturesIsolatedPositionMargin(self.extend(request, params)) |
| 2913 | # |
| 2914 | # Can only change margin for perpetual futures isolated margin positions |
| 2915 | # |
| 2916 | # { |
| 2917 | # "code": 0 |
| 2918 | # } |
| 2919 | # |
| 2920 | if type == 'reduce': |
| 2921 | amount = Precise.string_abs(amount) |
| 2922 | parsedAmount = self.parse_number(amount) |
| 2923 | return self.extend(self.parse_margin_modification(response, market), { |
| 2924 | 'amount': parsedAmount, |
| 2925 | 'type': type, |
| 2926 | }) |
| 2927 | |
| 2928 | def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification: |
| 2929 | # |
no test coverage detected