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

Method fetch_positions

python/ccxt/aster.py:3433–3457  ·  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

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected