futures fetch_balance returns balances=0.0
See original GitHub issueHi, I’m working with ccxt version 1.62.29 in python. I have a testnet futures account in binance, which has 100000 USDT as margin balance. I can see it at testnet.binancefuture.com plataform. But I would like to get that data with my python script, using ccxt. Mi code is:
import sys
import numpy as np
import ccxt
from sandapi01 import * #Sandbox futures
#from config_01 import * #real futures
print('ccxt version:',ccxt.__version__ )
# from variable id
exchange_id = 'binance'
exchange_class = getattr(ccxt, exchange_id)
exchange = exchange_class({
"apiKey": API[exchange_id],
"secret": SECRET[exchange_id],
"adjustForTimeDifference": True,
"enableRateLimit": True,
"options": {
'defaultType': 'future',
},
})
print('nombre:', exchange.name)
markets = exchange.load_markets()
print(exchange.requiredCredentials)
balances= exchange.fetch_balance()
print(balances['USDT'])
And what I get is:
ccxt version: 1.62.29
nombre: Binance
{'apiKey': True, 'secret': True, 'uid': False, 'login': False, 'password': False, 'twofa': False, 'privateKey': False, 'walletAddress': False, 'token': False}
{'free': 0.0, 'used': 0.0, 'total': 0.0}
As you can see, the values are all zeros, and I don’t know how to get the actual USDT balance.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
ccxt fetchbalances() returns SPOT balance by default #13382
How can i get the futures balance with fetchBalance() now ? My regular fetchBalances() call without parameters is now translated to
Read more >Exchanges — ccxt 2.4.71 documentation
Many exchanges do not return balances for your empty or unused accounts. In that case some currencies may be missing in returned balance...
Read more >python - fetch_balance method in ccxt won't return all assets
It seems like fetchBalance only returns one currency at a time. To get USDT as the asset to ... import ccxt exchange =...
Read more >Group And Resources – Bybit API Docs - GitHub Pages
Deprecated Fields of self_ratio and platform_ratio, it is returned as 0 currently ... Returns all wallet balances if no parameters are passed.
Read more >CCXT – CryptoCurrency eXchange Trading Library - npm
The CCXT library is used to connect and trade with cryptocurrency exchanges and payment processing services worldwide. It provides quick access to market...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you Kroitor, that code works. I will do later what you say. Thanks again and best regards
@pedruntu does this snippet work for you (with my testnet keys):
If it works with my keypair, then replace it with your keys. If it doesn’t work with your keys, check your keys (make sure they’re correct and you’ve set proper permissions on them, if necessary, recreate your keypair and try a fresh new keypair, see: https://github.com/ccxt/ccxt/wiki/Manual#troubleshooting )