As I call the fetch_balance method from kucoinfutures in ccxt, it only returns BTC, not any other assets. Shouldn’t there be other assets like USDT or ETH too?
Here’s the python code:
JavaScript
x
12
12
1
exchange = ccxt.kucoinfutures(
2
{
3
'apiKey': API_KEY,
4
'secret': API_SECRET,
5
'password': API_PHRASE
6
}
7
)
8
9
exchange.verbose = True
10
balance = exchange.fetch_balance()
11
print(balance)
12
Here’s what I get from print(balance):
JavaScript
1
2
1
{'info': {'code': '200000', 'data': {'accountEquity': 0, 'unrealisedPNL': 0, 'marginBalance': 0, 'positionMargin': 0, 'orderMargin': 0, 'frozenFunds': 0, 'availableBalance': 0, 'currency': 'XBT'}}, 'timestamp': None, 'datetime': None, 'BTC': {'free': 0.0, 'used': 0.0, 'total': 0.0}, 'free': {'BTC': 0.0}, 'used': {'BTC': 0.0}, 'total': {'BTC': 0.0}}
2
Am I missing something?
Advertisement
Answer
It seems like fetchBalance only returns one currency at a time. To get USDT as the asset to be returned, you must pass the param currency via params currently using the exchange-specific currency id.
JavaScript
1
9
1
import ccxt
2
3
exchange = ccxt.kucoinfutures( )
4
exchange.load_markets()
5
6
currency = exchange.currency('USDT')
7
balance = exchange.fetch_balance({'currency': currency['id']})
8
print(balance)
9