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

Method fetch_margin_modes

python/ccxt/ascendex.py:3321–3380  ·  view source on GitHub ↗

fetches the set margin mode of the user https://ascendex.github.io/ascendex-futures-pro-api-v2/#position :param str[] [symbols]: a list of unified market symbols :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: a l

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

Source from the content-addressed store, hash-verified

3319 }
3320
3321 def fetch_margin_modes(self, symbols: Strings = None, params={}) -> MarginModes:
3322 """
3323 fetches the set margin mode of the user
3324
3325 https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
3326
3327 :param str[] [symbols]: a list of unified market symbols
3328 :param dict [params]: extra parameters specific to the exchange API endpoint
3329 :returns dict: a list of `margin mode structures <https://docs.ccxt.com/?id=margin-mode-structure>`
3330 """
3331 self.load_markets()
3332 self.load_accounts()
3333 account = self.safe_dict(self.accounts, 0, {})
3334 accountGroup = self.safe_string(account, 'id')
3335 request = {
3336 'account-group': accountGroup,
3337 }
3338 response = self.v2PrivateAccountGroupGetFuturesPosition(self.extend(request, params))
3339 #
3340 # {
3341 # "code": 0,
3342 # "data": {
3343 # "accountId": "fut2ODPhGiY71Pl4vtXnOZ00ssgD7QGn",
3344 # "ac": "FUTURES",
3345 # "collaterals": [
3346 # {
3347 # "asset": "USDT",
3348 # "balance": "44.570287262",
3349 # "referencePrice": "1",
3350 # "discountFactor": "1"
3351 # }
3352 # ],
3353 # "contracts": [
3354 # {
3355 # "symbol": "BTC-PERP",
3356 # "side": "LONG",
3357 # "position": "0.0001",
3358 # "referenceCost": "-3.12277254",
3359 # "unrealizedPnl": "-0.001700233",
3360 # "realizedPnl": "0",
3361 # "avgOpenPrice": "31209",
3362 # "marginType": "isolated",
3363 # "isolatedMargin": "1.654972977",
3364 # "leverage": "2",
3365 # "takeProfitPrice": "0",
3366 # "takeProfitTrigger": "market",
3367 # "stopLossPrice": "0",
3368 # "stopLossTrigger": "market",
3369 # "buyOpenOrderNotional": "0",
3370 # "sellOpenOrderNotional": "0",
3371 # "markPrice": "31210.723063672",
3372 # "indexPrice": "31223.148857925"
3373 # },
3374 # ]
3375 # }
3376 # }
3377 #
3378 data = self.safe_dict(response, 'data', {})

Callers

nothing calls this directly

Calls 8

safe_dictMethod · 0.80
safe_stringMethod · 0.80
safe_listMethod · 0.80
parse_margin_modesMethod · 0.80
load_marketsMethod · 0.45
load_accountsMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected