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

Method fetch_leverages

python/ccxt/gate.py:7715–7761  ·  view source on GitHub ↗

fetch the set leverage for all leverage markets, only spot margin is supported on gate https://www.gate.com/docs/developers/apiv4/en/#list-lending-markets :param str[] symbols: a list of unified market symbols :param dict [params]: extra parameters specific to the

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

Source from the content-addressed store, hash-verified

7713 return self.parse_leverage(response, market)
7714
7715 def fetch_leverages(self, symbols: Strings = None, params={}) -> Leverages:
7716 """
7717 fetch the set leverage for all leverage markets, only spot margin is supported on gate
7718
7719 https://www.gate.com/docs/developers/apiv4/en/#list-lending-markets
7720
7721 :param str[] symbols: a list of unified market symbols
7722 :param dict [params]: extra parameters specific to the exchange API endpoint
7723 :param boolean [params.unified]: default False, set to True for fetching unified account leverages
7724 :returns dict: a list of `leverage structures <https://docs.ccxt.com/?id=leverage-structure>`
7725 """
7726 self.load_markets()
7727 symbols = self.market_symbols(symbols)
7728 response: List
7729 isUnified = self.safe_bool(params, 'unified')
7730 params = self.omit(params, 'unified')
7731 marketIdRequest = 'id'
7732 if isUnified:
7733 marketIdRequest = 'currency_pair'
7734 response = self.publicMarginGetUniCurrencyPairs(params)
7735 #
7736 # [
7737 # {
7738 # "currency_pair": "1INCH_USDT",
7739 # "base_min_borrow_amount": "8",
7740 # "quote_min_borrow_amount": "1",
7741 # "leverage": "3"
7742 # },
7743 # ]
7744 #
7745 else:
7746 response = self.publicMarginGetCurrencyPairs(params) # deprecated
7747 #
7748 # [
7749 # {
7750 # "id": "1CAT_USDT",
7751 # "base": "1CAT",
7752 # "quote": "USDT",
7753 # "leverage": 3,
7754 # "min_base_amount": "71",
7755 # "min_quote_amount": "1",
7756 # "max_quote_amount": "10000",
7757 # "status": 1
7758 # },
7759 # ]
7760 #
7761 return self.parse_leverages(response, symbols, marketIdRequest, 'spot')
7762
7763 def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
7764 marketId = self.safe_string_2(leverage, 'currency_pair', 'id')

Callers

nothing calls this directly

Calls 7

market_symbolsMethod · 0.80
safe_boolMethod · 0.80
parse_leveragesMethod · 0.80
load_marketsMethod · 0.45
omitMethod · 0.45

Tested by

no test coverage detected