fetch all open positions https://www.bitget.com/api-doc/contract/position/get-all-position https://www.bitget.com/api-doc/contract/position/Get-History-Position https://www.bitget.com/api-doc/uta/trade/Get-Position :param str[] [symbols]: list of unified ma
(self, symbols: Strings = None, params={})
| 7572 | return self.parse_position(first, market) |
| 7573 | |
| 7574 | def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]: |
| 7575 | """ |
| 7576 | fetch all open positions |
| 7577 | |
| 7578 | https://www.bitget.com/api-doc/contract/position/get-all-position |
| 7579 | https://www.bitget.com/api-doc/contract/position/Get-History-Position |
| 7580 | https://www.bitget.com/api-doc/uta/trade/Get-Position |
| 7581 | |
| 7582 | :param str[] [symbols]: list of unified market symbols |
| 7583 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 7584 | :param str [params.marginCoin]: the settle currency of the positions, needs to match the productType |
| 7585 | :param str [params.productType]: 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' |
| 7586 | :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) |
| 7587 | :param boolean [params.useHistoryEndpoint]: default False, when True will use the historic endpoint to fetch positions |
| 7588 | :param str [params.method]: either(default) 'privateMixGetV2MixPositionAllPosition', 'privateMixGetV2MixPositionHistoryPosition', or 'privateUtaGetV3PositionCurrentPosition' |
| 7589 | :param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False |
| 7590 | :returns dict[]: a list of `position structure <https://docs.ccxt.com/?id=position-structure>` |
| 7591 | """ |
| 7592 | self.load_markets() |
| 7593 | paginate = False |
| 7594 | paginate, params = self.handle_option_and_params(params, 'fetchPositions', 'paginate') |
| 7595 | if paginate: |
| 7596 | return self.fetch_paginated_call_cursor('fetchPositions', None, None, None, params, 'endId', 'idLessThan') |
| 7597 | method = None |
| 7598 | useHistoryEndpoint = self.safe_bool(params, 'useHistoryEndpoint', False) |
| 7599 | if useHistoryEndpoint: |
| 7600 | method = 'privateMixGetV2MixPositionHistoryPosition' |
| 7601 | else: |
| 7602 | method, params = self.handle_option_and_params(params, 'fetchPositions', 'method', 'privateMixGetV2MixPositionAllPosition') |
| 7603 | market = None |
| 7604 | if symbols is not None: |
| 7605 | first = self.safe_string(symbols, 0) |
| 7606 | # symbols can be None or [] |
| 7607 | if first is not None: |
| 7608 | market = self.market(first) |
| 7609 | productType = None |
| 7610 | productType, params = self.handle_product_type_and_params(market, params) |
| 7611 | request = {} |
| 7612 | response = None |
| 7613 | isHistory = False |
| 7614 | uta = None |
| 7615 | uta, params = self.handle_option_and_params(params, 'fetchPositions', 'uta', False) |
| 7616 | if uta: |
| 7617 | request['category'] = productType |
| 7618 | response = self.privateUtaGetV3PositionCurrentPosition(self.extend(request, params)) |
| 7619 | elif method == 'privateMixGetV2MixPositionAllPosition': |
| 7620 | marginCoin = self.safe_string(params, 'marginCoin', 'USDT') |
| 7621 | if market is not None: |
| 7622 | marginCoin = market['settleId'] |
| 7623 | elif productType == 'USDT-FUTURES': |
| 7624 | marginCoin = 'USDT' |
| 7625 | elif productType == 'USDC-FUTURES': |
| 7626 | marginCoin = 'USDC' |
| 7627 | elif productType == 'SUSDT-FUTURES': |
| 7628 | marginCoin = 'SUSDT' |
| 7629 | elif productType == 'SUSDC-FUTURES': |
| 7630 | marginCoin = 'SUSDC' |
| 7631 | elif (productType == 'SCOIN-FUTURES') or (productType == 'COIN-FUTURES'): |
nothing calls this directly
no test coverage detected