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

Method fetch_margin_modes

python/ccxt/async_support/binance.py:12940–13029  ·  view source on GitHub ↗

fetches margin modes("isolated" or "cross") that the market for the symbol in in, with symbol=None all markets for a subType(linear/inverse) are returned https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Account-Information https://devel

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

Source from the content-addressed store, hash-verified

12938 }
12939
12940 async def fetch_margin_modes(self, symbols: Strings = None, params={}) -> MarginModes:
12941 """
12942 fetches margin modes("isolated" or "cross") that the market for the symbol in in, with symbol=None all markets for a subType(linear/inverse) are returned
12943
12944 https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Account-Information
12945 https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2
12946 https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Symbol-Config
12947
12948 :param str[] symbols: unified market symbols
12949 :param dict [params]: extra parameters specific to the exchange API endpoint
12950 :param str [params.subType]: "linear" or "inverse"
12951 :returns dict: a list of `margin mode structures <https://docs.ccxt.com/?id=margin-mode-structure>`
12952 """
12953 await self.load_markets()
12954 market = None
12955 if symbols is not None:
12956 symbols = self.market_symbols(symbols)
12957 market = self.market(symbols[0])
12958 subType = None
12959 subType, params = self.handle_sub_type_and_params('fetchMarginMode', market, params)
12960 response = None
12961 if subType == 'linear':
12962 response = await self.fapiPrivateGetSymbolConfig(params)
12963 #
12964 # [
12965 # {
12966 # "symbol": "BTCUSDT",
12967 # "marginType": "CROSSED",
12968 # "isAutoAddMargin": "false",
12969 # "leverage": 21,
12970 # "maxNotionalValue": "1000000",
12971 # }
12972 # ]
12973 #
12974 elif subType == 'inverse':
12975 response = await self.dapiPrivateGetAccount(params)
12976 #
12977 # {
12978 # feeTier: '0',
12979 # canTrade: True,
12980 # canDeposit: True,
12981 # canWithdraw: True,
12982 # updateTime: '0',
12983 # assets: [
12984 # {
12985 # asset: 'APT',
12986 # walletBalance: '0.00000000',
12987 # unrealizedProfit: '0.00000000',
12988 # marginBalance: '0.00000000',
12989 # maintMargin: '0.00000000',
12990 # initialMargin: '0.00000000',
12991 # positionInitialMargin: '0.00000000',
12992 # openOrderInitialMargin: '0.00000000',
12993 # maxWithdrawAmount: '0.00000000',
12994 # crossWalletBalance: '0.00000000',
12995 # crossUnPnl: '0.00000000',
12996 # availableBalance: '0.00000000',
12997 # updateTime: '0'

Callers 1

fetch_margin_modeMethod · 0.95

Calls 9

marketMethod · 0.95
dapiPrivateGetAccountMethod · 0.95
BadRequestClass · 0.90
market_symbolsMethod · 0.80
safe_listMethod · 0.80
parse_margin_modesMethod · 0.80
load_marketsMethod · 0.45

Tested by

no test coverage detected