ccxt icon indicating copy to clipboard operation
ccxt copied to clipboard

BingX fetch_balance() take more then 10 seconds

Open alex37529 opened this issue 1 year ago • 3 comments

Operating System

Ubuntu 22.04.2 LTS

Programming Languages

Python

CCXT Version

4.3.1

Description

execution of the fetch_balance method takes a very long time (more than 10 seconds)

Code

          client = ccxt.bingx({
            'apiKey': api_key,
            'secret': api_secret,
            'timeout': 60000
        })

        try:
            balance = client.fetch_balance()
            result = Decimal(balance['USDT']['total'])
        except Exception as ex:
            result = Decimal('-1')

alex37529 avatar Jun 18 '24 12:06 alex37529

Hello @alex37529, most of the time is used to load markets (that is only done once).

You can pre-load them by doing exchange.load_markets() before calling fetch_balance

carlosmiei avatar Jun 18 '24 13:06 carlosmiei

@carlosmiei it would be better if it was possible to get a balance without exchange.load_markets() This is why it is often necessary to quickly just get a balance without additional steps. Because I had to separately implement the quick balance retrieval separately

alex37529 avatar Jun 23 '24 12:06 alex37529

@alex37529 load_markets is needed because loads all the currencies/markets/precisions/etc, but you can load the markets immediately after instantiating the exchange so that when you need to call fetch_balance/any other unified method, the cache is warm and you don't have to wait.

carlosmiei avatar Jun 23 '24 16:06 carlosmiei

Which return spot balance in new update for bingx fetchbalance() not work after update It is return only funds account balance?

waelalahmar avatar Apr 04 '25 17:04 waelalahmar

@waelalahmar This issue targets a different issue, can you open a new one plz?

carlosmiei avatar Apr 05 '25 09:04 carlosmiei

Thank you, I will open a new issue for that.

waelalahmar avatar Apr 05 '25 11:04 waelalahmar