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

Method fetch_margin_modes

python/ccxt/binance.py:12939–13028  ·  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

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