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

Method fetch_balance

python/ccxt/extended.py:1405–1446  ·  view source on GitHub ↗

query for balance and get the amount of funds available for trading or funds locked in orders https://api.docs.extended.exchange/#get-spot-balances :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: a `balance structure <htt

(self, params={})

Source from the content-addressed store, hash-verified

1403 }, market)
1404
1405 def fetch_balance(self, params={}) -> Balances:
1406 """
1407 query for balance and get the amount of funds available for trading or funds locked in orders
1408
1409 https://api.docs.extended.exchange/#get-spot-balances
1410
1411 :param dict [params]: extra parameters specific to the exchange API endpoint
1412 :returns dict: a `balance structure <https://docs.ccxt.com/?id=balance-structure>`
1413 """
1414 self.load_markets()
1415 response = self.v1PrivateGetUserSpotBalances(params)
1416 #
1417 # {
1418 # "status": "OK",
1419 # "data": [
1420 # {
1421 # "accountId": 123,
1422 # "asset": "USDC",
1423 # "balance": "13500",
1424 # "indexPrice": "1",
1425 # "notionalValue": "13500",
1426 # "contributionFactor": "1",
1427 # "equityContribution": "13500",
1428 # "availableToWithdraw": "100",
1429 # "updatedAt": 1701563440
1430 # },
1431 # {
1432 # "accountId": 123,
1433 # "asset": "BTC",
1434 # "balance": "0.5",
1435 # "indexPrice": "65000",
1436 # "notionalValue": "32500",
1437 # "contributionFactor": "0.95",
1438 # "equityContribution": "30875",
1439 # "availableToWithdraw": "0.5",
1440 # "updatedAt": 1701563440
1441 # }
1442 # ]
1443 # }
1444 #
1445 data = self.safe_list(response, 'data', [])
1446 return self.parse_balance(data)
1447
1448 def parse_balance(self, response) -> Balances:
1449 result = {'info': response}

Callers

nothing calls this directly

Calls 4

load_marketsMethod · 0.95
parse_balanceMethod · 0.95
safe_listMethod · 0.80

Tested by

no test coverage detected