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

Method fetch_margin_modes

python/ccxt/async_support/ascendex.py:3322–3381  ·  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

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