Either adds or reduces margin in an isolated position in order to set the margin to a specific value https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#assign-position-balance-in-isolated-marign-mode :param str symbol: unified market symbol of
(self, symbol: str, amount: float, params={})
| 4157 | } |
| 4158 | |
| 4159 | def set_margin(self, symbol: str, amount: float, params={}) -> MarginModification: |
| 4160 | """ |
| 4161 | Either adds or reduces margin in an isolated position in order to set the margin to a specific value |
| 4162 | |
| 4163 | https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#assign-position-balance-in-isolated-marign-mode |
| 4164 | |
| 4165 | :param str symbol: unified market symbol of the market to set margin in |
| 4166 | :param float amount: the amount to set the margin to |
| 4167 | :param dict [params]: parameters specific to the exchange API endpoint |
| 4168 | :returns dict: A `margin structure <https://docs.ccxt.com/?id=margin-structure>` |
| 4169 | """ |
| 4170 | self.load_markets() |
| 4171 | market = self.market(symbol) |
| 4172 | request = { |
| 4173 | 'symbol': market['id'], |
| 4174 | 'posBalanceEv': self.to_ev(amount, market), |
| 4175 | } |
| 4176 | response = self.privatePostPositionsAssign(self.extend(request, params)) |
| 4177 | # |
| 4178 | # { |
| 4179 | # "code": 0, |
| 4180 | # "msg": "", |
| 4181 | # "data": "OK" |
| 4182 | # } |
| 4183 | # |
| 4184 | return self.extend(self.parse_margin_modification(response, market), { |
| 4185 | 'amount': amount, |
| 4186 | }) |
| 4187 | |
| 4188 | def parse_margin_status(self, status): |
| 4189 | statuses = { |
nothing calls this directly
no test coverage detected