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

Method get_margin_mode

python/ccxt/async_support/gate.py:1869–1896  ·  view source on GitHub ↗

@ignore Gets the margin type for self api call :param bool trigger: True if for a trigger order :param dict [params]: Request params :returns: The marginMode and the updated request params with marginMode removed, marginMode value is the value that can be read by th

(self, trigger, params)

Source from the content-addressed store, hash-verified

1867 return [request, query]
1868
1869 def get_margin_mode(self, trigger, params):
1870 """
1871 @ignore
1872 Gets the margin type for self api call
1873 :param bool trigger: True if for a trigger order
1874 :param dict [params]: Request params
1875 :returns: The marginMode and the updated request params with marginMode removed, marginMode value is the value that can be read by the "account" property specified in gates api docs
1876 """
1877 defaultMarginMode = self.safe_string_lower_2(self.options, 'defaultMarginMode', 'marginMode', 'spot') # 'margin' is isolated margin on gate's api
1878 marginMode = self.safe_string_lower_2(params, 'marginMode', 'account', defaultMarginMode)
1879 params = self.omit(params, ['marginMode', 'account'])
1880 if marginMode == 'cross':
1881 marginMode = 'cross_margin'
1882 elif marginMode == 'isolated':
1883 marginMode = 'margin'
1884 elif marginMode == '':
1885 marginMode = 'spot'
1886 if trigger:
1887 if marginMode == 'spot':
1888 # gate spot trigger orders use the term normal instead of spot
1889 marginMode = 'normal'
1890 if marginMode == 'cross_margin':
1891 raise BadRequest(self.id + ' getMarginMode() does not support trigger orders for cross margin')
1892 isUnifiedAccount = False
1893 isUnifiedAccount, params = self.handle_option_and_params(params, 'getMarginMode', 'unifiedAccount')
1894 if isUnifiedAccount:
1895 marginMode = 'unified'
1896 return [marginMode, params]
1897
1898 def get_settlement_currencies(self, type, method):
1899 options = self.safe_value(self.options, type, {}) # ['BTC', 'USDT'] unified codes

Callers 5

fetch_balanceMethod · 0.95
fetch_my_tradesMethod · 0.95
create_order_requestMethod · 0.95

Calls 4

BadRequestClass · 0.90
safe_string_lower_2Method · 0.80
omitMethod · 0.45

Tested by

no test coverage detected