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

Method fetch_balance

python/ccxt/xt.py:2214–2287  ·  view source on GitHub ↗

query for balance and get the amount of funds available for trading or funds locked in orders https://doc.xt.com/#balancebalancesGet https://doc.xt.com/#futures_usergetBalances :param dict params: extra parameters specific to the xt api endpoint :returns di

(self, params={})

Source from the content-addressed store, hash-verified

2212 }, market)
2213
2214 def fetch_balance(self, params={}):
2215 """
2216 query for balance and get the amount of funds available for trading or funds locked in orders
2217
2218 https://doc.xt.com/#balancebalancesGet
2219 https://doc.xt.com/#futures_usergetBalances
2220
2221 :param dict params: extra parameters specific to the xt api endpoint
2222 :returns dict: a `balance structure <https://docs.ccxt.com/en/latest/manual.html?#balance-structure>`
2223 """
2224 self.load_markets()
2225 type = None
2226 subType = None
2227 response = None
2228 type, params = self.handle_market_type_and_params('fetchBalance', None, params)
2229 subType, params = self.handle_sub_type_and_params('fetchBalance', None, params)
2230 isContractWallet = ((type == 'swap') or (type == 'future'))
2231 if subType == 'inverse':
2232 response = self.privateInverseGetFutureUserV1BalanceList(params)
2233 elif (subType == 'linear') or isContractWallet:
2234 response = self.privateLinearGetFutureUserV1BalanceList(params)
2235 else:
2236 response = self.privateSpotGetBalances(params)
2237 #
2238 # spot
2239 #
2240 # {
2241 # "rc": 0,
2242 # "mc": "SUCCESS",
2243 # "ma": [],
2244 # "result": {
2245 # "totalUsdtAmount": "31.75931133",
2246 # "totalBtcAmount": "0.00115951",
2247 # "assets": [
2248 # {
2249 # "currency": "usdt",
2250 # "currencyId": 11,
2251 # "frozenAmount": "0.03834082",
2252 # "availableAmount": "31.70995965",
2253 # "totalAmount": "31.74830047",
2254 # "convertBtcAmount": "0.00115911",
2255 # "convertUsdtAmount": "31.74830047"
2256 # },
2257 # ]
2258 # }
2259 # }
2260 #
2261 # swap and future
2262 #
2263 # {
2264 # "returnCode": 0,
2265 # "msgInfo": "success",
2266 # "error": null,
2267 # "result": [
2268 # {
2269 # "coin": "usdt",
2270 # "walletBalance": "19.29849875",
2271 # "openOrderMarginFrozen": "0",

Callers 15

fetch_balance_n_timesFunction · 0.45
mainFunction · 0.45
watch_balanceFunction · 0.45
testFunction · 0.45
watch_balanceFunction · 0.45
example_2Function · 0.45
htx-swaps.pyFile · 0.45
testFunction · 0.45
sign-in.pyFile · 0.45
mainFunction · 0.45
example_1Function · 0.45

Tested by

no test coverage detected