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

Method fetch_margin_modes

python/ccxt/hitbtc.py:2499–2559  ·  view source on GitHub ↗

fetches margin mode of the user https://api.hitbtc.com/#get-margin-position-parameters https://api.hitbtc.com/#get-futures-position-parameters :param str[] symbols: unified market symbols :param dict [params]: extra parameters specific to the exchange API e

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

Source from the content-addressed store, hash-verified

2497 }, market)
2498
2499 def fetch_margin_modes(self, symbols: Strings = None, params={}) -> MarginModes:
2500 """
2501 fetches margin mode of the user
2502
2503 https://api.hitbtc.com/#get-margin-position-parameters
2504 https://api.hitbtc.com/#get-futures-position-parameters
2505
2506 :param str[] symbols: unified market symbols
2507 :param dict [params]: extra parameters specific to the exchange API endpoint
2508 :returns dict: a list of `margin mode structures <https://docs.ccxt.com/?id=margin-mode-structure>`
2509 """
2510 self.load_markets()
2511 market = None
2512 if symbols is not None:
2513 symbols = self.market_symbols(symbols)
2514 market = self.market(symbols[0])
2515 marketType = None
2516 marketType, params = self.handle_market_type_and_params('fetchMarginMode', market, params)
2517 response: dict
2518 if marketType == 'margin':
2519 response = self.privateGetMarginConfig(params)
2520 #
2521 # {
2522 # "config": [{
2523 # "symbol": "BTCUSD",
2524 # "margin_call_leverage_mul": "1.50",
2525 # "liquidation_leverage_mul": "2.00",
2526 # "max_initial_leverage": "10.00",
2527 # "margin_mode": "Isolated",
2528 # "force_close_fee": "0.05",
2529 # "enabled": True,
2530 # "active": True,
2531 # "limit_base": "50000.00",
2532 # "limit_power": "2.2",
2533 # "unlimited_threshold": "10.0"
2534 # }]
2535 # }
2536 #
2537 elif marketType == 'swap':
2538 response = self.privateGetFuturesConfig(params)
2539 #
2540 # {
2541 # "config": [{
2542 # "symbol": "BTCUSD_PERP",
2543 # "margin_call_leverage_mul": "1.20",
2544 # "liquidation_leverage_mul": "2.00",
2545 # "max_initial_leverage": "100.00",
2546 # "margin_mode": "Isolated",
2547 # "force_close_fee": "0.001",
2548 # "enabled": True,
2549 # "active": False,
2550 # "limit_base": "5000000.000000000000",
2551 # "limit_power": "1.25",
2552 # "unlimited_threshold": "2.00"
2553 # }]
2554 # }
2555 #
2556 else:

Callers

nothing calls this directly

Calls 9

BadSymbolClass · 0.90
market_symbolsMethod · 0.80
safe_listMethod · 0.80
parse_margin_modesMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45

Tested by

no test coverage detected