MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_positions

Method fetch_positions

python/ccxt/async_support/aster.py:3434–3458  ·  view source on GitHub ↗

fetch all open positions https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#position-information-v3-user_data :param str[] [symbols]: list of unified market symbols :param dict [params]: extra parameters specific to the exchange API endpoint

(self, symbols: Strings = None, params={})

Source from the content-addressed store, hash-verified

3432 return self.filter_by_array_positions(result, 'symbol', symbols, False)
3433
3434 async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
3435 """
3436 fetch all open positions
3437
3438 https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#position-information-v3-user_data
3439
3440 :param str[] [symbols]: list of unified market symbols
3441 :param dict [params]: extra parameters specific to the exchange API endpoint
3442 :param str [params.method]: method name to call, "positionRisk", "account" or "option", default is "positionRisk"
3443 :returns dict[]: a list of `position structure <https://docs.ccxt.com/?id=position-structure>`
3444 """
3445 defaultMethod = None
3446 defaultMethod, params = self.handle_option_and_params(params, 'fetchPositions', 'method')
3447 if defaultMethod is None:
3448 options = self.safe_dict(self.options, 'fetchPositions')
3449 if options is None:
3450 defaultMethod = self.safe_string(self.options, 'fetchPositions', 'positionRisk')
3451 else:
3452 defaultMethod = 'positionRisk'
3453 if defaultMethod == 'positionRisk':
3454 return await self.fetch_positions_risk(symbols, params)
3455 elif defaultMethod == 'account':
3456 return await self.fetch_account_positions(symbols, params)
3457 else:
3458 raise NotSupported(self.id + '.options["fetchPositions"]["method"] or params["method"] = "' + defaultMethod + '" is invalid, please choose between "account" and "positionRisk"')
3459
3460 def parse_account_positions(self, account, filterClosed=False):
3461 positions = self.safe_list(account, 'positions', [])

Callers 1

Calls 6

fetch_positions_riskMethod · 0.95
NotSupportedClass · 0.90
safe_dictMethod · 0.80
safe_stringMethod · 0.80

Tested by

no test coverage detected