closes open positions for a market https://www.gate.com/docs/developers/apiv4/en/#place-futures-order https://www.gate.com/docs/developers/apiv4/en/#place-futures-order-2 https://www.gate.com/docs/developers/apiv4/en/#create-an-options-order :param str symb
(self, symbol: str, side: OrderSide = None, params={})
| 7589 | } |
| 7590 | |
| 7591 | def close_position(self, symbol: str, side: OrderSide = None, params={}) -> Order: |
| 7592 | """ |
| 7593 | closes open positions for a market |
| 7594 | |
| 7595 | https://www.gate.com/docs/developers/apiv4/en/#place-futures-order |
| 7596 | https://www.gate.com/docs/developers/apiv4/en/#place-futures-order-2 |
| 7597 | https://www.gate.com/docs/developers/apiv4/en/#create-an-options-order |
| 7598 | |
| 7599 | :param str symbol: Unified CCXT market symbol |
| 7600 | :param str side: 'buy' or 'sell' |
| 7601 | :param dict [params]: extra parameters specific to the okx api endpoint |
| 7602 | :returns dict[]: `A list of position structures <https://docs.ccxt.com/?id=position-structure>` |
| 7603 | """ |
| 7604 | request = { |
| 7605 | 'close': True, |
| 7606 | } |
| 7607 | params = self.extend(request, params) |
| 7608 | if side is None: |
| 7609 | side = '' # side is not used but needs to be present, otherwise crashes in php |
| 7610 | return self.create_order(symbol, 'market', side, 0, None, params) |
| 7611 | |
| 7612 | def fetch_leverage(self, symbol: str, params={}) -> Leverage: |
| 7613 | """ |
nothing calls this directly
no test coverage detected